text: Fix assert failure from compositing by SOURCE with a mask internally.

Change the operator used to upgrade the format of a glyph mask from
CAIRO_OPERATOR_SOURCE to CAIRO_OPERATOR_ADD.

The _cairo_scaled_font_show_glyphs() function upgrades the pixel
format of a glyph mask by calling _cairo_surface_composite() to copy
the mask to an image surface of the upgraded destination.  The way it
was doing it however was to use CAIRO_OPERATOR_SOURCE, a white source
pattern and the glyph's rasterised glyph as the mask pattern.  This
combination isn't supported by _cairo_surface_composite(), which
asserts that no mask is present when the operator is SOURCE or CLEAR.

Reported by Mikael Magnusson to #cairo on irc.freenode.net.
This commit is contained in:
M Joonas Pihlaja 2010-02-22 02:26:47 +02:00
parent 20f8f17f0e
commit 75db4f0ece

View file

@ -2163,7 +2163,7 @@ _cairo_scaled_font_show_glyphs (cairo_scaled_font_t *scaled_font,
/* Note that we only upgrade masks, i.e. A1 -> A8 -> ARGB32, so there is
* never any component alpha here.
*/
status = _cairo_surface_composite (CAIRO_OPERATOR_SOURCE,
status = _cairo_surface_composite (CAIRO_OPERATOR_ADD,
&_cairo_pattern_white.base,
&mask_pattern.base,
new_mask,