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

Younes Manton younes.m at gmail.com
Thu Sep 1 11:14:16 PDT 2011


2011/9/1 Christian König <deathsimple at vodafone.de>:
> Am Donnerstag, den 01.09.2011, 13:28 -0400 schrieb Younes Manton:
>> 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.
> Nope, according to the docs it's possible to flip the image by reversing
> x0/x1 and y0/y1. I haven't implemented it, but it should be supported at
> some time.

True, for source rects, but not destination rects as far as I can see,
so the first one can be explicitly simplified.


More information about the mesa-dev mailing list