diff --git a/src/xpra/client/gtk2/pixmap_backing.py b/src/xpra/client/gtk2/pixmap_backing.py index 6062526c3d..79febd0956 100644 --- a/src/xpra/client/gtk2/pixmap_backing.py +++ b/src/xpra/client/gtk2/pixmap_backing.py @@ -100,9 +100,22 @@ def _do_paint_rgb24(self, img_data, x, y, width, height, rowstride, options): return True def _do_paint_rgb32(self, img_data, x, y, width, height, rowstride, options): - img_data = memoryview_to_bytes(self.unpremultiply(img_data)) + has_alpha = options.boolget("has_alpha", False) or options.get("rgb_format", "").find("A")>=0 + if has_alpha: + img_data = self.unpremultiply(img_data) + img_data = memoryview_to_bytes(img_data) if INDIRECT_BGR: img_data, rowstride = self.bgr_to_rgb(img_data, width, height, rowstride, options.strget("rgb_format", ""), "RGBA") - gc = self._backing.new_gc() - self._backing.draw_rgb_32_image(gc, x, y, width, height, gdk.RGB_DITHER_NONE, img_data, rowstride) + if has_alpha: + #draw_rgb_32_image does not honour alpha, we have to use pixbuf: + pixbuf = gdk.pixbuf_new_from_data(img_data, gdk.COLORSPACE_RGB, True, 8, width, height, rowstride) + cr = self._backing.cairo_create() + cr.rectangle(x, y, width, height) + cr.set_source_pixbuf(pixbuf, x, y) + cr.set_operator(cairo.OPERATOR_SOURCE) + cr.paint() + else: + #no alpha is easier: + gc = self._backing.new_gc() + self._backing.draw_rgb_32_image(gc, x, y, width, height, gdk.RGB_DITHER_NONE, img_data, rowstride) return True