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

Chris Wilson chris at chris-wilson.co.uk
Mon Nov 3 07:50:26 PST 2008

On Mon, 2008-11-03 at 07:11 -0800, Michel Iwaniec wrote:
> Unfortunately, I just discovered that I declared victory too early. The patch you pushed merely seems to have reverted the situation to the one I had before upgrading my Ubuntu distribution. 
> Rendering to an ImageSurface instead of my GtkDrawingArea still gives the same problem with the ImageSurfacePattern misaligning and eventually disappearing when scaled too much. Which again makes me wonder why the result from rendering to an ImageSurface can be so different from rendering to a GtkDrawingArea? Exactly what might differ in how cairo handles these targets?
> I will try to create a repro case, but since I'm working on a closed-source application that I'm not allowed to share, it might take some time.

If you're feeling brave, in the master git branch there is a cairo-trace
tool that is installed alongside the main library. It's currently
experimental (as in the replay tools are still out of tree, but you can
look at some WIP at people.freedesktop.org/~ickle/cairo-script,
people.freedesktop.org/~ickle/sphinx, but those seem to be at the mercy
of the fdo server presently).

The trace will capture everything drawn, so it still may contain
confidential information, but I would appreciate someone else attempting
to use the tool and providing some feedback. :-)

As for your particular question: image surfaces used to have special
casing which caused the entire source to be cloned and bypassed the ROI
optimizations and manipulation of the pattern matrix. So one aspect of
the patch was to remove that and put image surfaces on a par with the
xlib surface (i.e. the GtkDrawingArea). The second source of discrepancy
is that cairo uses a 24.8 fixed point format, but pixman (the software
renderer) uses a 16.16 fixed point format. In particular it sounds like
you're hitting an overflow, but it's hard to tell at this stage if it's
possible to workaround/mitigate that condition without a clear test
case. (Though at some point you will hit the limits of cairo's fixed
point representation.)

More information about the cairo mailing list