From 8d7486a6ea3eff4976dacd2629d07ed5b143af23 Mon Sep 17 00:00:00 2001 From: Andrea Canciani Date: Sun, 28 Nov 2010 14:33:41 +0100 Subject: [PATCH] image: Fix _pixel_to_solid An A1 image with full alpha should be opaque black, not opaque white. Use specialized solid black image instead of the generic constructor for an A8 image with full alpha (it is likely to be cached). --- src/cairo-image-surface.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c index e0ec561af..1ebadee68 100644 --- a/src/cairo-image-surface.c +++ b/src/cairo-image-surface.c @@ -1322,13 +1322,15 @@ _pixel_to_solid (cairo_image_surface_t *image, int x, int y) case CAIRO_FORMAT_A1: pixel = *(uint8_t *) (image->data + y * image->stride + x/8); - return pixel & (1 << (x&7)) ? _pixman_white_image () : _pixman_transparent_image (); + return pixel & (1 << (x&7)) ? _pixman_black_image () : _pixman_transparent_image (); case CAIRO_FORMAT_A8: color.alpha = *(uint8_t *) (image->data + y * image->stride + x); color.alpha |= color.alpha << 8; if (color.alpha == 0) return _pixman_transparent_image (); + if (color.alpha == 0xffff) + return _pixman_black_image (); color.red = color.green = color.blue = 0; return pixman_image_create_solid_fill (&color);