[Spice-devel] [spice-common PATCH 3/7 v2] ppc: Added supprt for bigendian color byte order

Lukas Venhoda lvenhoda at redhat.com
Thu Jul 2 07:01:40 PDT 2015


On LE machine, color order will always be ARGB.
On BE mcahines both ARGB and BGRA states are correct.

This change introduces cases for BGRA color byte orders on BE machines.
---
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 | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/common/canvas_utils.c b/common/canvas_utils.c
index 0d1591a..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.4.3



More information about the Spice-devel mailing list