canvas: Fix some semi transparent drawing

This is reproducible using desktop icons on Windows XP.

These drawing are sent for the icons on the desktop.
To get an extends.x1 >= 32 you have to move an icon out of the
screen on the left side. Set the icon size to 72 as the icon has
to be out of the screen quite a lot.
Disable the grid alignment on the desktop and move an icon out of
the screen. Select and unselect the icon.
Using "/ 32" the icon will have a white background instead of a
transparent one.
Using a "/ 8" the icon is rendered correctly.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe de Dinechin <cdupontd@redhat.com>
This commit is contained in:
Frediano Ziglio 2018-01-23 17:05:48 +00:00
parent f3478aa4b6
commit fd0aba2750

View File

@ -1943,8 +1943,16 @@ static void canvas_mask_pixman(CanvasBase *canvas,
/* round down X to even 32 pixels (i.e. uint32_t) */
extents.x1 = extents.x1 & ~(0x1f);
mask_data_src = (uint8_t *)mask_data + mask_stride * extents.y1 + extents.x1 / 32;
mask_data = SPICE_UNALIGNED_CAST(uint32_t *, mask_data_src);
/* mask_data_src is surely aligned to 4 bytes:
* - pixman requires mask_data (pixman_image_get_data) to be
* aligned to 4 bytes;
* - pixman requires mask_stride (pixman_image_get_stride) to be
* multiple of 4;
* - extents.x1 is multiple of 32 (see previous line) so
* extents.x1 / 8 is multiple of 4.
*/
mask_data_src = (uint8_t *)mask_data + mask_stride * extents.y1 + extents.x1 / 8;
mask_data = SPICE_ALIGNED_CAST(uint32_t *, mask_data_src);
mask_x -= extents.x1;
mask_y -= extents.y1;