summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@redhat.com>2012-05-31 21:29:58 -0400
committerSøren Sandmann Pedersen <ssp@redhat.com>2012-05-31 21:29:58 -0400
commit5b512a31871212d72a8cd82ccbb6b6ef91fea182 (patch)
treee8cb3de2092e49004397ebed6a4f3ed043e533f2
parentc0a92bf8329c5a8aee76ac96034435d4fce043dc (diff)
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.
-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 21fd776a..a36a9918 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);