[cairo] device offsets handling and push/pop group support patches

Vladimir Vukicevic vladimirv at gmail.com
Tue Dec 20 20:55:18 PST 2005


I've been working for the past little while to make the handling of
device offsets sane; I think things are at a working state now.  This
patch moves all device offset handling into the surface abstraction
layer; that is, it introduces two surface coordinate spaces -- the
"surface coordinate space", which is what the _cairo_surface_*
functions take, and the "device coordinate space", which is what the
backends receive.  The transform from surface->device coords takes
place at every call into a backend function.

I've also added a CAIRO_TEST_DEV_OFFSET environment variable that can
be set to a number to set as the surface device offset when running
the tests; I patched the image diff tools to also accept an offset, so
that the current test suite can be run with the same reference images.

All tests pass without offsets applied; with offsets, self-copy fails
because it makes assumptions about which part of the surface region
it's going to get, and there's an extra region of white space in the
upper left corner in an offset-test image.  A few of the xlib tests
also claim they fail, but the rendering is correct -- there are just a
few pixel differences due to different coordinates on the trapezoids.

The additional patch adds push/pop group, with a
cairo_push_group()/cairo_pop_group()/cairo_pop_group_to_source() API. 
If pop_group_to_source() is followed by paint(), the group is painted
in the right place -- the intermediate surface is created constrained
by the clip, and so the paint fills the clip region correctly. 
Otherwise, it can be used as a normal pattern.  I also added a
push-group test  (which should probably be a little more extensive).

Postscript fails with device offsets, mainly because I don't handle
device scale at the moment -- I'll probably get to this today, but I
wanted to throw this patch out for comments.  There's also an issue
with group stuff with the ps backend; the intermediate surface is an
image surface, which doesn't support the same type of clipping.  I
think I just need to check whether the clip types are compatible in
push_group, and recreate as a mask if not...

(There may be some cruft in some of these patches; I've tried to split
them up as best as I could, but I have around 3-4 patches in my tree
at the moment [the others adding user data to cairo_t and some
compilation fixes]).

    - Vlad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: device-offset.patch
Type: text/x-patch
Size: 47919 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20051221/7df9b7a4/device-offset-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: push-pop-group.patch
Type: text/x-patch
Size: 22990 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20051221/7df9b7a4/push-pop-group-0001.bin


More information about the cairo mailing list