[cairo] Question about cairo_paint
cworth at cworth.org
Thu Feb 7 13:16:17 PST 2008
On Thu, 07 Feb 2008 15:26:45 -0500, Antoine Azar wrote:
> Thanks for the detailed reply Carl.
> So to round up the possible optimizations (all concerning only
> opaque sources):
Uhm... how exactly are you determining what sources are classified as
> All verbs except paint, operator OVER, all extend modes: switch OVER to SOURCE
That's not correct.
In cairo, *all* of the drawing operations are identical at a very
fundamental level. There's nothing special about paint whatsoever. You
could hit the same "sampling translucent source pixels outside the
surface" with something like this:
cairo_surface_t opaque = cairo_image_surface_create (CAIRO_FORMAT_RGB24,
cairo_set_source_surface (cr, opaque, 0, 0);
cairo_rectangle (cr, 0, 0, 10, 10);
So there we are drawing a 10x10 rectangle using a source pattern which
is backed by an RGB-only surface that's only 5x5. With the default
extend mode of EXTEND_NONE, this will again sample translucent
portions of the source[*].
So fill() can have the exact sample problem as paint(). And obviously
stroke(), mask(), and show_text() can also "read" from outside the
Perhaps an easier way to deonstrate that would be to simply point out
that cairo_paint() is equivalent to cairo_rectangle;cairo_fill with a
rectangle that maps to the entire surface bounds.
I do appreciate you looking into this optimization, and I hope the
investigation is fruitful.
[*] At least, the mathematical specification of the operation would
involve examining those portions. The implementation could very well
be clever and optimize those unnecessary reads away. But again, this
is just to point out that the same considerations apply to an
operation such as fill() just as much as paint().
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20080207/559d77a0/attachment.pgp
More information about the cairo