[cairo] Subject: ImageSurfacePattern disappears with a large enough scale factor

Chris Wilson chris at chris-wilson.co.uk
Wed Nov 5 03:54:34 PST 2008


On Tue, 2008-11-04 at 12:52 -0800, Michel Iwaniec wrote:
> I have now put together a minimal test example that shows both the bug with the ImageSurfacePattern, and the bug with the grid lines overlaid on it.
> 
> You can download it here:
> http://www.student.itn.liu.se/~miciw347/cairo_scaling_bug.tar.gz
> 
> I sure hope this precision limit can be fixed or worked around, rather than being a hard limit in Cairo.

At the moment, the residual source of error seems to be a
loss-of-precision when converting to the pixman matrix. [pixman is the
software renderer used by cairo when rendering to image surfaces and
used by the Xserver for the unaccelerated paths.] I've added a test case
that exhibits similar behaviour to your example and I've minimised the
error as much as I can. The differentiation between the two surface
patterns is due to the xlib backend extracting a small subsurface when
presented with an image pattern which reduces the coordinates and
mitigates the precision loss. Renderering via the image surface, the
whole surface is used as the source [i.e. no copying or allocation
involved] but then the coordinates overflow when passed to pixman.
(Again I've mitigated that by splitting the coordinates between the
pattern matrix and the offset). I'm not inclined to always extract the
sub-surface as a work-around to this issue as it incurs a performance
for the more common cases. (Though I feel like it should be possible to
cheaply extract a ROI and maintain the use of small integers for the
indices, though I've not yet decided where that should be performed.) As
it stands with the default condition in your test-case I've reduced the
error to around a 2-pixel offset.

Thanks for the test case!
-- 
Chris



More information about the cairo mailing list