[maemo-commits] [maemo-commits] r17230 - in projects/haf/trunk/libmatchbox2: . matchbox/theme-engines

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Sun Jan 18 17:40:33 EET 2009
Author: tthurman
Date: 2009-01-18 17:40:19 +0200 (Sun, 18 Jan 2009)
New Revision: 17230

Modified:
   projects/haf/trunk/libmatchbox2/ChangeLog
   projects/haf/trunk/libmatchbox2/configure.ac
   projects/haf/trunk/libmatchbox2/matchbox/theme-engines/mb-wm-theme-png.c
Log:
	* configure.ac: determine endianness
	* matchbox/theme-engines/mb-wm-theme-png.c: PNG RGB values should
	  be swapped on little-endian machines (e.g. the Intel scratchbox)



Modified: projects/haf/trunk/libmatchbox2/ChangeLog
===================================================================
--- projects/haf/trunk/libmatchbox2/ChangeLog	2009-01-16 14:27:51 UTC (rev 17229)
+++ projects/haf/trunk/libmatchbox2/ChangeLog	2009-01-18 15:40:19 UTC (rev 17230)
@@ -1,3 +1,9 @@
+2009-01-18  Thomas Thurman  <thomas.thurman at collabora.co.uk>
+
+	* configure.ac: determine endianness
+	* matchbox/theme-engines/mb-wm-theme-png.c: PNG RGB values should
+	  be swapped on little-endian machines (e.g. the Intel scratchbox)
+
 2009-01-15  Thomas Thurman  <thomas.thurman at collabora.co.uk>
 
 	* matchbox/core/mb-wm-client-base.c: remove irrelevant stacking

Modified: projects/haf/trunk/libmatchbox2/configure.ac
===================================================================
--- projects/haf/trunk/libmatchbox2/configure.ac	2009-01-16 14:27:51 UTC (rev 17229)
+++ projects/haf/trunk/libmatchbox2/configure.ac	2009-01-18 15:40:19 UTC (rev 17230)
@@ -276,6 +276,13 @@
   AC_DEFINE(HAVE_XCURSOR, [1], [Use XCursor to sync pointer themes])
 fi
 
+AC_C_BIGENDIAN
+if test "x$ac_cv_c_bigendian" = "xyes"; then
+	CPPFLAGS="$CPPFLAGS -DBYTE_ORDER=BIG_ENDIAN"
+else
+	CPPFLAGS="$CPPFLAGS -DBYTE_ORDER=LITTLE_ENDIAN"
+fi
+
 MBWM_INCS='-I$(top_srcdir) -I$(top_srcdir)/matchbox/core -I$(top_srcdir)/matchbox/client-types -I$(top_srcdir)/matchbox/theme-engines -I$(top_srcdir)/matchbox/comp-mgr -I$(top_builddir)'
 MBWM_CORE_LIB='$(top_builddir)/matchbox/core/libmatchbox-window-manager-2-core.a'
 MBWM_CLIENT_BUILDDIR='$(top_builddir)/matchbox/client-types'

Modified: projects/haf/trunk/libmatchbox2/matchbox/theme-engines/mb-wm-theme-png.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/theme-engines/mb-wm-theme-png.c	2009-01-16 14:27:51 UTC (rev 17229)
+++ projects/haf/trunk/libmatchbox2/matchbox/theme-engines/mb-wm-theme-png.c	2009-01-18 15:40:19 UTC (rev 17230)
@@ -1306,7 +1306,15 @@
     for (x = 0; x < width; x++)
       {
 	unsigned char a, r, g, b;
+#if BYTE_ORDER==LITTLE_ENDIAN
+	/* This is probably an Intel scratchbox */
+	b = *p++; g = *p++; r = *p++; a = *p++;
+#elif BYTE_ORDER==BIG_ENDIAN
+	/* This is probably the ARM */
 	r = *p++; g = *p++; b = *p++; a = *p++;
+#else
+#error "Could not determine byte order!  Please define BYTE_ORDER to BIG_ENDIAN or LITTLE_ENDIAN"
+#endif
 	r = (r * (a + 1)) / 256;
 	g = (g * (a + 1)) / 256;
 	b = (b * (a + 1)) / 256;


More information about the maemo-commits mailing list