summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2010-04-13 11:48:13 +0200
committerAlexander Larsson <alexl@redhat.com>2010-04-13 11:48:13 +0200
commitcc9b7a21fb239effae480c11188c340863caf509 (patch)
treeea5da4e900d0fcba6c9c6f56d7f3b37d5da56385
parent3f94cad6576d0a0fbf50671f94a6ceebdc2b62f6 (diff)
downloadspice-cc9b7a21fb239effae480c11188c340863caf509.tar.gz
spice-cc9b7a21fb239effae480c11188c340863caf509.tar.xz
spice-cc9b7a21fb239effae480c11188c340863caf509.zip
Fix A1 handling in RedDrawable combine_pixels.
The previous code was just busted, as apparent on e.g. the cursor in MS Paint.
-rw-r--r--client/x11/red_drawable.cpp41
1 files changed, 18 insertions, 23 deletions
diff --git a/client/x11/red_drawable.cpp b/client/x11/red_drawable.cpp
index ec6ad53c..ccb9af41 100644
--- a/client/x11/red_drawable.cpp
+++ b/client/x11/red_drawable.cpp
@@ -479,42 +479,37 @@ static inline void combine_to_pixmap_from_pixmap(const RedDrawable_p* dest,
if (pixman_image_get_depth (src_surface) == 1) {
+ pixman_color_t white = { 0xffff, 0xffff, 0xffff, 0xffff };
+ pixman_image_t *solid;
pixman_image_t *temp;
+ /* Create a temporary rgb32 image that is black where mask is 0
+ and white where mask is 1 */
temp = pixman_image_create_bits(pixman_image_get_depth(dest_surface) == 24 ?
PIXMAN_x8r8g8b8 : PIXMAN_a8r8g8b8,
area.right - area.left,
area.bottom - area.top, NULL, 0);
-
- /* Copy from dest to temp */
- pixman_image_composite32(PIXMAN_OP_SRC,
- dest_surface, NULL, temp,
- area.left + offset.x,
- area.top + offset.y,
- 0, 0,
- 0, 0,
- area.right - area.left,
- area.bottom - area.top);
-
- /* rop white over temp */
- spice_pixman_fill_rect_rop(temp,
- 0, 0,
- area.right - area.left,
- area.bottom - area.top,
- 0xffffff,
- rop);
-
- /* copy back using a1 mask */
+ solid = pixman_image_create_solid_fill(&white);
pixman_image_composite32(PIXMAN_OP_SRC,
- temp, src_surface, dest_surface,
+ solid, src_surface, temp,
0, 0,
src_x + offset.x,
src_y + offset.y,
- area.left + offset.x,
- area.top + offset.y,
+ 0, 0,
area.right - area.left,
area.bottom - area.top);
+ pixman_image_unref(solid);
+ /* ROP the temp image on the destination */
+ spice_pixman_blit_rop(dest_surface,
+ temp,
+ 0,
+ 0,
+ area.left + offset.x,
+ area.top + offset.y,
+ area.right - area.left,
+ area.bottom - area.top,
+ rop);
pixman_image_unref(temp);
} else {