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).
This commit is contained in:
Andrea Canciani 2010-11-28 14:33:41 +01:00
parent 72b0a44a1f
commit 8d7486a6ea

View file

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