changeset 15277:fed5d4ab5e5f

fix palette8tobgr32/palette8torgb32 on big endian
author nplourde
date Wed, 27 Apr 2005 18:17:53 +0000
parents f331ff9ff453
children a45c7e1b998f
files postproc/rgb2rgb.c
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/postproc/rgb2rgb.c	Wed Apr 27 18:16:00 2005 +0000
+++ b/postproc/rgb2rgb.c	Wed Apr 27 18:17:53 2005 +0000
@@ -332,11 +332,17 @@
 
 	for(i=0; i<num_pixels; i++)
 	{
+		#ifdef WORDS_BIGENDIAN
+		dst[3]= palette[ src[i]*4+2 ];
+		dst[2]= palette[ src[i]*4+1 ];
+		dst[1]= palette[ src[i]*4+0 ];
+		#else
 		//FIXME slow?
 		dst[0]= palette[ src[i]*4+2 ];
 		dst[1]= palette[ src[i]*4+1 ];
 		dst[2]= palette[ src[i]*4+0 ];
 //		dst[3]= 0; /* do we need this cleansing? */
+		#endif
 		dst+= 4;
 	}
 }
@@ -346,11 +352,18 @@
 	unsigned i;
 	for(i=0; i<num_pixels; i++)
 	{
+		#ifdef WORDS_BIGENDIAN
+		dst[3]= palette[ src[i]*4+0 ];
+		dst[2]= palette[ src[i]*4+1 ];
+		dst[1]= palette[ src[i]*4+2 ];
+		#else
 		//FIXME slow?
 		dst[0]= palette[ src[i]*4+0 ];
 		dst[1]= palette[ src[i]*4+1 ];
 		dst[2]= palette[ src[i]*4+2 ];
 //		dst[3]= 0; /* do we need this cleansing? */
+		#endif
+		
 		dst+= 4;
 	}
 }