[Mesa-dev] [PATCH 7/7] st/vdpau: Implement VdpOutputSurfacePutBitsIndexed and VdpOutputSurfaceRenderOutputSurface

Younes Manton younes.m at gmail.com
Thu Sep 1 10:28:15 PDT 2011


2011/9/1 Christian König <deathsimple at vodafone.de>:
> This gets mplayers menu overlay working.

> +   if (destination_rect) {
> +      res_tmpl.width0 = abs(destination_rect->x0-destination_rect->x1);
> +      res_tmpl.height0 = abs(destination_rect->y0-destination_rect->y1);
> +   } else {
> +      res_tmpl.width0 = vlsurface->surface->texture->width0;
> +      res_tmpl.height0 = vlsurface->surface->texture->height0;
> +   }
...
> +static inline struct pipe_video_rect *
> +RectToPipe(const VdpRect *src, struct pipe_video_rect *dst)
> +{
> +   if (src) {
> +      dst->x = MIN2(src->x1, src->x0);
> +      dst->y = MIN2(src->y1, src->y0);
> +      dst->w = abs(src->x1 - src->x0);
> +      dst->h = abs(src->y1 - src->y0);
> +      return dst;
> +   }
> +   return NULL;
> +}

VdpRect is guaranteed to have x0 <= x1 and y0 <= y1 (i.e. 0 is
top/left [inclusive], 1 is bottom/right [exclusive]) according to the
reference, so we don't have to use MIN2 or abs and we can simplify
these calculations.


More information about the mesa-dev mailing list