]> git.saurik.com Git - wxWidgets.git/commitdiff
Partial fix for big_endian image conversion probs.
authorRobert Roebling <robert@roebling.de>
Wed, 24 Nov 1999 16:57:36 +0000 (16:57 +0000)
committerRobert Roebling <robert@roebling.de>
Wed, 24 Nov 1999 16:57:36 +0000 (16:57 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4676 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/image.cpp

index 163154260ef10d5180e70a15ed4009bd36e01d16..96d3c58d8a6059040ebdb95150dcbab598ae236b 100644 (file)
@@ -1555,7 +1555,6 @@ wxImage::wxImage( const wxBitmap &bitmap )
         for (int i = 0; i < bitmap.GetWidth(); i++)
         {
             wxInt32 pixel = gdk_image_get_pixel( gdk_image, i, j );
-            // pixel = wxINT32_SWAP_ON_BE( pixel );
             if (bpp <= 8)
             {
                 data[pos] = cmap->colors[pixel].red >> 8;
@@ -1563,19 +1562,31 @@ wxImage::wxImage( const wxBitmap &bitmap )
                 data[pos+2] = cmap->colors[pixel].blue >> 8;
             } else if (bpp == 15)
             {
+#if (wxBYTE_ORDER == wxBIG_ENDIAN)
+                // ?
+#endif
                 data[pos] = (pixel >> 7) & 0xf8;
                 data[pos+1] = (pixel >> 2) & 0xf8;
                 data[pos+2] = (pixel << 3) & 0xf8;
             } else if (bpp == 16)
             {
+#if (wxBYTE_ORDER == wxBIG_ENDIAN)
+                // ?
+#endif
                 data[pos] = (pixel >> 8) & 0xf8;
                 data[pos+1] = (pixel >> 3) & 0xfc;
                 data[pos+2] = (pixel << 3) & 0xf8;
             } else
             {
+#if (wxBYTE_ORDER == wxBIG_ENDIAN)
+                data[pos] = (pixel) & 0xff;            // Red
+                data[pos+1] = (pixel >> 8) & 0xff;     // Green
+                data[pos+2] = (pixel >> 16) & 0xff;    // Blue
+#else
                 data[pos] = (pixel >> 16) & 0xff;
                 data[pos+1] = (pixel >> 8) & 0xff;
                 data[pos+2] = pixel & 0xff;
+#endif
             }
 
             if (gdk_image_mask)