When checking, whether we use alpha channel, we need to compare color format with constant with the same byte order. When clearing alpha channel, we must clear in proper byte order. --- Changes since v2: - Added macro for proper alpha clearing - Improved commit msg Changes since v1: - New commit --- common/canvas_base.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/common/canvas_base.c b/common/canvas_base.c index 65b1c3f..1e401ed 100644 --- a/common/canvas_base.c +++ b/common/canvas_base.c @@ -45,6 +45,12 @@ #include "mem.h" #include "macros.h" +#ifdef WORDS_BIGENDIAN + #define x8r8g8b8_ALPHA 0xff000000u +#else + #define x8r8g8b8_ALPHA 0x000000ffu +#endif + #define ROUND(_x) ((int)floor((_x) + 0.5)) #define IS_IMAGE_LOSSY(descriptor) \ @@ -1208,12 +1214,12 @@ static pixman_image_t *canvas_get_image_internal(CanvasBase *canvas, SpiceImage #ifdef SW_CANVAS_CACHE descriptor->type != SPICE_IMAGE_TYPE_FROM_CACHE_LOSSLESS && #endif - surface_format == PIXMAN_x8r8g8b8) { + surface_format == PIXMAN_LE_x8r8g8b8) { spice_pixman_fill_rect_rop(surface, 0, 0, pixman_image_get_width(surface), pixman_image_get_height(surface), - 0xff000000U, SPICE_ROP_OR); + x8r8g8b8_ALPHA, SPICE_ROP_OR); } if (descriptor->flags & SPICE_IMAGE_FLAGS_CACHE_ME && @@ -1267,7 +1273,7 @@ static pixman_image_t *canvas_get_image_internal(CanvasBase *canvas, SpiceImage If so we convert here. */ wanted_format = canvas_get_target_format(canvas, - surface_format == PIXMAN_a8r8g8b8); + surface_format == PIXMAN_LE_a8r8g8b8); if (surface_format != wanted_format) { converted = surface_create( -- 2.4.3 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel