[PATCH spice-common] canvas: Fix some semi transparent drawing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 right 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@xxxxxxxxxx>
---
 common/canvas_base.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/common/canvas_base.c b/common/canvas_base.c
index 42f0eea..f0f6bbf 100644
--- a/common/canvas_base.c
+++ b/common/canvas_base.c
@@ -1941,8 +1941,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;
-- 
2.14.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]