[Spice-devel] [common PATCH 2/9 v4] pixman_utils: Add macros for color byte ordering

Lukas Venhoda lvenhoda at redhat.com
Wed Nov 25 08:14:28 PST 2015


When using image compression on PowerPC architecture, colors are in
wrong order ARGB -> BGRA.

This commit introduces macros, that will change the color order
according to machine endianness.

Theese macros are similar to QEMU macros in qemu-pixman.h
---
Changes since v3:
Changes since v2:
 - None

Changes since v1:
 - Added last line into commit log
---
 common/pixman_utils.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/common/pixman_utils.h b/common/pixman_utils.h
index dd565ef..f892777 100644
--- a/common/pixman_utils.h
+++ b/common/pixman_utils.h
@@ -27,6 +27,16 @@

 #include "draw.h"

+#ifdef WORDS_BIGENDIAN
+# define PIXMAN_LE_x8r8g8b8   PIXMAN_b8g8r8x8
+# define PIXMAN_LE_a8r8g8b8   PIXMAN_b8g8r8a8
+# define PIXMAN_LE_r8g8b8     PIXMAN_b8g8r8
+#else
+# define PIXMAN_LE_x8r8g8b8   PIXMAN_x8r8g8b8
+# define PIXMAN_LE_a8r8g8b8   PIXMAN_a8r8g8b8
+# define PIXMAN_LE_r8g8b8     PIXMAN_r8g8b8
+#endif
+
 SPICE_BEGIN_DECLS

 /* This lists all possible 2 argument binary raster ops.
--
2.5.0



More information about the Spice-devel mailing list