[cairo] Transform+Repeat patch for libpixman
David Reveman
c99drn at cs.umu.se
Sat Sep 11 20:13:57 PDT 2004
On Mon, 2004-09-06 at 11:22 -0400, Owen Taylor wrote:
> Here's a patch for libpixman that makes sources/masks with both
> a transform and repeat work correctly.
great!
>
> Notes:
>
> - I've extended the pixman_compositeOperand 'transform'
> union member:
>
> op->u.transform.transform = image->transform;
> op->u.transform.filter = image->filter;
> + op->u.transform.repeat = image->repeat;
> + op->u.transform.width = image->pixels->width;
> + op->u.transform.height = image->pixels->height;
>
> All five are likely best replaced with:
>
> op->u.transform.image = image;
>
> But I didn't want to do that in this patch since it would obscure
> the logic of the patch.
>
> - This is far from brilliantly efficient, but it isn't horrible
> and actually improves the case of 1x1 source since
> pixmap_compositeGeneral isn't getting called for every pixel
> individually. (Though that case could be optimized a *lot* more, the
> transform can be ignored for a 1x1 source.)
>
> - I've interpreted the clip as clipping *after* the repeat,
> I think this matches what happens without the transform
The patch looks good to me, one little problem though:
I changed
#define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a)
% (b))
to
#define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (a) % (b)
== 0 ? 0: (b) + (a) % (b))
as if
a == [-b | -2b | -3b... ]
then
(-a) % (b) == 0
and
(b) - (-a) % (b) == b
which is a coordinate outside the image.
With this fixed, I've now committed your patch along with some byte-
order and clipping fixes that I've been sitting on. I've attached a copy
of the final version of your patch.
I've also added a pixman backend to the rendertest program, glitz and
pixman output now matches for all transform+repeat tests.
> Assuming that this patch looks good, there should be a fairly
> obvious port to the X server.
yeah, we should probably modify cairo's xlib and xcb backends so that
they fall-back to image rendering when transform+repeat is used until
the X server port is done.
-David
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libpixman-transform-repeat-fix.diff
Type: text/x-patch
Size: 4037 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20040912/b85e4dd6/libpixman-transform-repeat-fix.bin
More information about the cairo
mailing list