On LE machine, color order when creating surface will always be A/XRGB. On BE machines the color order will sometimes be ARGB and sometimes BGRA/X. This is because we actually create the surface two times on BE machines. Once with BE order, and then again with LE order. Copying data inbetween theese two surfaces will byteswap the colors automatically. This change introduces cases for BGRA/X color byte orders on BE machines. --- Changes since v3: - Fixed typo Changes since v2: - Improved commit msg Changes since v1: - Originaly I used the macros here too - This doesn't work, because pixman converts some of the color orderings by itself - Then the format is ARGB even on BE machine, but the resulting color is correct --- common/canvas_utils.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/common/canvas_utils.c b/common/canvas_utils.c index 789cd76..a3e205f 100644 --- a/common/canvas_utils.c +++ b/common/canvas_utils.c @@ -162,10 +162,17 @@ pixman_image_t * surface_create(pixman_format_code_t format, int width, int heig switch (format) { case PIXMAN_a8r8g8b8: case PIXMAN_x8r8g8b8: +#ifdef WORDS_BIGENDIAN + case PIXMAN_b8g8r8a8: + case PIXMAN_b8g8r8x8: +#endif bitmap_info.inf.bmiHeader.biBitCount = 32; nstride = width * 4; break; case PIXMAN_r8g8b8: +#ifdef WORDS_BIGENDIAN + case PIXMAN_b8g8r8: +#endif bitmap_info.inf.bmiHeader.biBitCount = 24; nstride = SPICE_ALIGN(width * 3, 4); break; @@ -235,9 +242,16 @@ pixman_image_t * surface_create(pixman_format_code_t format, int width, int heig switch (format) { case PIXMAN_a8r8g8b8: case PIXMAN_x8r8g8b8: +#ifdef WORDS_BIGENDIAN + case PIXMAN_b8g8r8a8: + case PIXMAN_b8g8r8x8: +#endif stride = width * 4; break; case PIXMAN_r8g8b8: +#ifdef WORDS_BIGENDIAN + case PIXMAN_b8g8r8: +#endif // NOTE: LZ4 also decodes to RGB24 stride = SPICE_ALIGN(width * 3, 4); break; -- 2.5.0 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel