Re: [PATCH] Use the new pixman_glyph_cache_t API that will be in pixman 0.28.0

Behdad Esfahbod <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
On 05/30/2012 08:30 PM, Søren Sandmann wrote:
> From: Søren Sandmann Pedersen <[email protected]>
> 
> This new pixman API allows glyphs to be cached and composited in one
> go, which reduces overhead compared to individual calls to
> pixman_image_composite_region32().

Nice.  Let me take a look.  In the mean time, comments below.


> Notes:
> 
> - There is an explicit call to _cairo_image_scaled_glyph_fini(). This
>   could instead be done with a private, but I chose not to do that
>   since we don't need to store any actual data; we only need
>   notification when the glyph dies.
> 
> - The mask format used with pixman_composite_glyphs() is that of the
>   first glyph. This makes the implicit assumption that all the glyphs
>   in the font have the same format, which I believe is true.

Keith thought so too.  Wrong.  See:

commit 805b668260c47e6d3d854361fcc53f12bd2a57e1
commit 83963d2a9ec445e23cfbe692b877177a9d9d135e
commit 83963d2a9ec445e23cfbe692b877177a9d9d135e
https://bugs.freedesktop.org/show_bug.cgi?id=13479


>   Note that while the current code _looks_ like it will support both
>   a8 and a8r8g8b8 glyphs within the same font, that is not actually
>   the case since if the mask gets upgraded, adding a8 glyphs will
>   produce the wrong result since the RGB channels are considered 0 in
>   this format and so they will be drawn empty.

Again, wrong.  I fixed and tested this.  See:

22d7f311f7733a57ece5d91708b2b5da9b71de86

The trick is:

        status = _cairo_surface_composite (CAIRO_OPERATOR_ADD,
+                                          &white_pattern.base,
                                           &glyph_pattern.base,
-                                          NULL,
                                           mask,

ie. use the glyph raster as mask, not source.


behdad
--
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.