[cairo-commit] src/cairo-image-compositor.c

Chris Wilson ickle at kemper.freedesktop.org
Fri Jun 1 00:15:29 PDT 2012


 src/cairo-image-compositor.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 4b5d3436a36e7a2fe29131dff58b50999cd972bb
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Fri Jun 1 08:13:17 2012 +0100

    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.

diff --git a/src/cairo-image-compositor.c b/src/cairo-image-compositor.c
index 21fd776..a36a991 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);


More information about the cairo-commit mailing list