mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 08:48:00 +02:00
[xlib] Fix _draw_image_surface() with opaque images.
If the image was opaque with no alpha channel, we filled the output alpha with 0. Typically, the destination surface for dithering is an RGB window, so this bug went unnoticed. However, test/xlib-expose-event is an example where we generate an intermediate alpha-only pixmap for use as a stencil and this was failing as the mask was left completely transparent. The simple solution is to ensure that for opaque images, the output alpha is set to the maximum permissible value.
This commit is contained in:
parent
c3940d342a
commit
42711a5586
1 changed files with 8 additions and 1 deletions
|
|
@ -1055,7 +1055,14 @@ _draw_image_surface (cairo_xlib_surface_t *surface,
|
|||
else
|
||||
in_pixel = row[x];
|
||||
|
||||
a = _field_to_8 (in_pixel & image_masks.alpha_mask, i_a_width, i_a_shift);
|
||||
/* If the incoming image has no alpha channel, then the input
|
||||
* is opaque and the output should have the maximum alpha value.
|
||||
* For all other channels, their absence implies 0.
|
||||
*/
|
||||
if (image_masks.alpha_mask == 0x0)
|
||||
a = 0xff;
|
||||
else
|
||||
a = _field_to_8 (in_pixel & image_masks.alpha_mask, i_a_width, i_a_shift);
|
||||
r = _field_to_8 (in_pixel & image_masks.red_mask , i_r_width, i_r_shift);
|
||||
g = _field_to_8 (in_pixel & image_masks.green_mask, i_g_width, i_g_shift);
|
||||
b = _field_to_8 (in_pixel & image_masks.blue_mask , i_b_width, i_b_shift);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue