mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-02-17 05:30:36 +01:00
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:
parent
72b0a44a1f
commit
8d7486a6ea
1 changed files with 3 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue