[common PATCH 3/8 v3] ppc: Added supprt for bigendian color byte order

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On LE machine, color order will always be ARGB.
On BE machines color order will sometimes be ARGB and sometimes BGRA.
(This is because surface is sometimes created using native byte order,
and sometimes using the network byte order, which is always LE)

This change introduces cases for BGRA color byte orders on BE machines.
---
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 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;
--
2.4.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]