summaryrefslogtreecommitdiff
path: root/src/cairo-image-compositor.c
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@redhat.com>2012-06-01 08:13:17 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-06-01 08:13:17 +0100
commit4b5d3436a36e7a2fe29131dff58b50999cd972bb (patch)
treee8cb3de2092e49004397ebed6a4f3ed043e533f2 /src/cairo-image-compositor.c
parentc0a92bf8329c5a8aee76ac96034435d4fce043dc (diff)
downloadcairo-4b5d3436a36e7a2fe29131dff58b50999cd972bb.tar.gz
image: Fix bugs related to glyph mask creation
In addition to fixing a bug 7d8d98b91ccf7165be853c36e6d5ef releated to expanding a8 glyphs into a8r8g8b8, this commit also added an optimization where if the first glyph had format a8r8g8b8, the mask was created in this format from the beginning instead of later converting from a8 to a8r8g8b8. However, the optimization had two bugs in it: (1) The computed stride was 3 * width, not 4 * times width, and (2) In the case where the mask was allocated on the stack, it was allocated as PIXMAN_a8 and not a8r8g8b8. The commit fixes both bugs.
Diffstat (limited to 'src/cairo-image-compositor.c')
-rw-r--r--src/cairo-image-compositor.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cairo-image-compositor.c b/src/cairo-image-compositor.c
index 21fd776a9..a36a99188 100644
--- a/src/cairo-image-compositor.c
+++ b/src/cairo-image-compositor.c
@@ -854,7 +854,7 @@ composite_glyphs_via_mask (void *_dst,
i = (info->extents.width + 3) & ~3;
if (scaled_glyph->surface->base.content & CAIRO_CONTENT_COLOR) {
format = PIXMAN_a8r8g8b8;
- i = info->extents.width * 3;
+ i = info->extents.width * 4;
}
if (i * info->extents.height > (int) sizeof (buf)) {
@@ -864,7 +864,7 @@ composite_glyphs_via_mask (void *_dst,
NULL, 0);
} else {
memset (buf, 0, i * info->extents.height);
- mask = pixman_image_create_bits (PIXMAN_a8,
+ mask = pixman_image_create_bits (format,
info->extents.width,
info->extents.height,
(uint32_t *)buf, i);