[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

[XaraXtreme-commits] Commit Complete



Commit by  : luke
Repository : xara
Revision   : 1341
Date       : Tue Jun 20 14:08:48 BST 2006

Changed paths:
   M /Trunk/XaraLX/Kernel/exjpeg.cpp
   M /Trunk/XaraLX/Kernel/imjpeg.cpp
   M /Trunk/XaraLX/wxOil/outptpng.cpp
   M /Trunk/XaraLX/wxOil/pngutil.cpp

Fix RGB component ordering for JPEG and PNG, may need revisting for Big Endian


Diff:
Index: Trunk/XaraLX/Kernel/exjpeg.cpp
===================================================================
--- Trunk/XaraLX/Kernel/exjpeg.cpp	(revision 1340)
+++ Trunk/XaraLX/Kernel/exjpeg.cpp	(revision 1341)
@@ -1358,6 +1358,12 @@
 				pConverter->Convert(pBitmapLine, pExportBuffer, 1, FALSE);
 			}
 
+#if !defined(__WXMSW__) && defined(BIG_ENDIAN)
+			RGBTRIPLE* pExportRGB = (RGBTRIPLE*)pExportLine;
+			for( unsigned ord = 0; ord < Width; ++ord, ++ pExportRGB )
+				std::swap( pExportRGB->rgbtBlue, pExportRGB->rgbtRed );
+#endif
+
 			libJPEG::jpeg_write_scanlines(&m_cinfo, &pExportLine, 1);
 
 			if (pFilterForUpdate != NULL)
Index: Trunk/XaraLX/Kernel/imjpeg.cpp
===================================================================
--- Trunk/XaraLX/Kernel/imjpeg.cpp	(revision 1340)
+++ Trunk/XaraLX/Kernel/imjpeg.cpp	(revision 1341)
@@ -1123,7 +1123,7 @@
 		//
 		// Swap red and blue channels.
 		//
-#if defined(__WXMSW__)
+#if !defined(__WXMSW__) && defined(BIG_ENDIAN)
 		if ( m_uBitsPerPixel==24 )
 		{
 			BYTE* pLine = pCurrentScanLine;
Index: Trunk/XaraLX/wxOil/outptpng.cpp
===================================================================
--- Trunk/XaraLX/wxOil/outptpng.cpp	(revision 1340)
+++ Trunk/XaraLX/wxOil/outptpng.cpp	(revision 1341)
@@ -736,7 +736,7 @@
 		//png_set_packing(png_ptr);
 
 		// flip bgr pixels to rgb
-#if !defined(__WXGTK__)
+#if !defined(__WXMSW__) && defined(BIG_ENDIAN)
 		png_set_bgr(png_ptr);
 #endif
 
Index: Trunk/XaraLX/wxOil/pngutil.cpp
===================================================================
--- Trunk/XaraLX/wxOil/pngutil.cpp	(revision 1340)
+++ Trunk/XaraLX/wxOil/pngutil.cpp	(revision 1341)
@@ -332,7 +332,7 @@
 				png_set_gamma(png_ptr, screen_gamma, 0.45455);
 		}
 		
-#if !defined(__WXGTK__)
+#if defined(__WXGTK__)
 		/* flip the RGB pixels to BGR (or RGBA to BGRA) */
 		if (color_type & PNG_COLOR_MASK_COLOR)
 			png_set_bgr(png_ptr);


Xara