diff options
author | Lukas Venhoda <lvenhoda@redhat.com> | 2015-11-25 17:14:30 +0100 |
---|---|---|
committer | Christophe Fergeau <cfergeau@redhat.com> | 2015-12-17 16:03:19 +0100 |
commit | 76a0c2fae8f35eb7c38abe7656f694b436391911 (patch) | |
tree | f6b7a2bdcb3ad6cac6afe5c452fa4a97eb338ce0 /common | |
parent | fc1f511bb8beb7e8efd1773a79eb4d09c93c90d5 (diff) | |
download | spice-common-76a0c2fae8f35eb7c38abe7656f694b436391911.tar.gz spice-common-76a0c2fae8f35eb7c38abe7656f694b436391911.tar.xz spice-common-76a0c2fae8f35eb7c38abe7656f694b436391911.zip |
ppc: Add support for bigendian color byte order
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.
Diffstat (limited to 'common')
-rw-r--r-- | common/canvas_utils.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/common/canvas_utils.c b/common/canvas_utils.c index 0d1591a..46eb012 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; |