bug 974575 - support color glyphs in cairo_image_surface's _composite_glyphs function. r=jrmuizel

This commit is contained in:
Jonathan Kew 2014-03-06 12:29:23 +00:00
parent 2b7b569692
commit a6dad90e47

View File

@ -3958,16 +3958,6 @@ _composite_glyphs (void *closure,
cairo_status_t status;
int i;
if (pattern != NULL) {
src = _pixman_image_for_pattern (pattern, FALSE, extents, &src_x, &src_y);
src_x -= dst_x;
src_y -= dst_y;
} else {
src = _pixman_white_image ();
}
if (unlikely (src == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
memset (glyph_cache, 0, sizeof (glyph_cache));
status = CAIRO_STATUS_SUCCESS;
@ -4018,17 +4008,43 @@ _composite_glyphs (void *closure,
if (y2 > extents->y + extents->height)
y2 = extents->y + extents->height;
pixman_image_composite32 (pixman_op,
src, glyph_surface->pixman_image, dst,
x1 + src_x, y1 + src_y,
x1 - x, y1 - y,
x1 - dst_x, y1 - dst_y,
x2 - x1, y2 - y1);
if (glyph_surface->format == CAIRO_FORMAT_A8 ||
glyph_surface->format == CAIRO_FORMAT_A1)
{
if (unlikely (src == NULL)) {
if (pattern != NULL) {
src = _pixman_image_for_pattern (pattern, FALSE, extents, &src_x, &src_y);
src_x -= dst_x;
src_y -= dst_y;
} else {
src = _pixman_white_image ();
}
if (unlikely (src == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
break;
}
}
pixman_image_composite32 (pixman_op,
src, glyph_surface->pixman_image, dst,
x1 + src_x, y1 + src_y,
x1 - x, y1 - y,
x1 - dst_x, y1 - dst_y,
x2 - x1, y2 - y1);
} else {
pixman_image_composite32 (pixman_op,
glyph_surface->pixman_image, NULL, dst,
x1 - x, y1 - y,
0, 0,
x1 - dst_x, y1 - dst_y,
x2 - x1, y2 - y1);
}
}
}
_cairo_scaled_font_thaw_cache (info->font);
pixman_image_unref (src);
if (src != NULL)
pixman_image_unref (src);
return status;
}