changeset 6054:35689e1e6745

bigendian fix by Colin Leroy <colin@colino.net>
author arpi
date Sun, 12 May 2002 01:09:10 +0000
parents 759c5a3314a2
children 3ca1f8cf7bfc
files Gui/bitmap.c Gui/bitmap/bitmap.c
diffstat 2 files changed, 28 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/Gui/bitmap.c	Sun May 12 01:07:25 2002 +0000
+++ b/Gui/bitmap.c	Sun May 12 01:09:10 2002 +0000
@@ -30,9 +30,16 @@
    memset( bf->Image,0,bf->ImageSize );
    for ( c=0,i=0;i < (int)(bf->Width * bf->Height * 3); )
     {
-     bf->Image[c++]=tmpImage[i++];
-     bf->Image[c++]=tmpImage[i++];
-     bf->Image[c++]=tmpImage[i++]; c++;
+#ifndef WORDS_BIGENDIAN
+     bf->Image[c++]=tmpImage[i++];	//red
+     bf->Image[c++]=tmpImage[i++];	//green
+     bf->Image[c++]=tmpImage[i++]; c++;	//blue
+#else
+     unsigned char t=tmpImage[i++];
+     bf->Image[c++]=tmpImage[i++];	//green
+     bf->Image[c++]=t;             c++;	//red
+     bf->Image[c++]=tmpImage[i++]; 	//blue
+#endif
     }
    free( tmpImage );
   }
@@ -55,7 +62,11 @@
 void Normalize( txSample * bf )
 {
  int           i;
+#ifndef WORDS_BIGENDIAN 
  for ( i=0;i < (int)bf->ImageSize;i+=4 ) bf->Image[i+3]=0;
+#else
+ for ( i=0;i < (int)bf->ImageSize;i+=4 ) bf->Image[i]=0; 
+#endif
 }
 
 unsigned char tmp[512];
--- a/Gui/bitmap/bitmap.c	Sun May 12 01:07:25 2002 +0000
+++ b/Gui/bitmap/bitmap.c	Sun May 12 01:09:10 2002 +0000
@@ -30,9 +30,16 @@
    memset( bf->Image,0,bf->ImageSize );
    for ( c=0,i=0;i < (int)(bf->Width * bf->Height * 3); )
     {
-     bf->Image[c++]=tmpImage[i++];
-     bf->Image[c++]=tmpImage[i++];
-     bf->Image[c++]=tmpImage[i++]; c++;
+#ifndef WORDS_BIGENDIAN
+     bf->Image[c++]=tmpImage[i++];	//red
+     bf->Image[c++]=tmpImage[i++];	//green
+     bf->Image[c++]=tmpImage[i++]; c++;	//blue
+#else
+     unsigned char t=tmpImage[i++];
+     bf->Image[c++]=tmpImage[i++];	//green
+     bf->Image[c++]=t;             c++;	//red
+     bf->Image[c++]=tmpImage[i++]; 	//blue
+#endif
     }
    free( tmpImage );
   }
@@ -55,7 +62,11 @@
 void Normalize( txSample * bf )
 {
  int           i;
+#ifndef WORDS_BIGENDIAN 
  for ( i=0;i < (int)bf->ImageSize;i+=4 ) bf->Image[i+3]=0;
+#else
+ for ( i=0;i < (int)bf->ImageSize;i+=4 ) bf->Image[i]=0; 
+#endif
 }
 
 unsigned char tmp[512];