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

This commit is contained in:
Jonathan Kew 2014-03-04 05:37:40 +00:00
Родитель fa0a7c6033
Коммит 3a0e99a68b
1 изменённых файлов: 33 добавлений и 17 удалений

Просмотреть файл

@ -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;
}