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

[XaraXtreme-commits] Commit Complete



Commit by  : alex
Repository : xara
Revision   : 1372
Date       : Tue Jun 27 12:23:22 BST 2006

Changed paths:
   M /Trunk/XaraLX/Kernel/cxfrec.cpp
   M /Trunk/XaraLX/Kernel/gradtbl.cpp
   M /Trunk/XaraLX/wxOil/dibconv.cpp
   M /Trunk/XaraLX/wxOil/dragmgr.cpp
   M /Trunk/XaraLX/wxOil/outptpng.cpp
   M /Trunk/XaraLX/wxOil/pngutil.cpp

More RGB/BGR ordering fixes. Do not assume GTK is the only platform with 4 byte Unicode. Remove some spurious WXGTK dependency which should hopefully help the Mac build.


Diff:
Index: Trunk/XaraLX/Kernel/gradtbl.cpp
===================================================================
--- Trunk/XaraLX/Kernel/gradtbl.cpp	(revision 1371)
+++ Trunk/XaraLX/Kernel/gradtbl.cpp	(revision 1372)
@@ -2462,7 +2462,7 @@
 					const double T = V * (1.0 - (S * (1.0 - F)));
 
 // Define a wee macro to make this all a lot more readable
-#if defined(__WXGTK__)
+#if 0
 #define SETRGBENTRY(P1,P2,P3) pRGBTable[col].rgbRed = (BYTE)P3; pRGBTable[col].rgbGreen = (BYTE)P2; pRGBTable[col].rgbBlue = (BYTE)P1;
 #else
 #define SETRGBENTRY(P1,P2,P3) pRGBTable[col].rgbRed = (BYTE)P1; pRGBTable[col].rgbGreen = (BYTE)P2; pRGBTable[col].rgbBlue = (BYTE)P3;
Index: Trunk/XaraLX/Kernel/cxfrec.cpp
===================================================================
--- Trunk/XaraLX/Kernel/cxfrec.cpp	(revision 1371)
+++ Trunk/XaraLX/Kernel/cxfrec.cpp	(revision 1372)
@@ -1463,11 +1463,11 @@
 		if (ok) *pBuf++ = b2;
 
 		// Yick, Linux has 4 byte unicdoe chars
-#if defined(__WXGTK__)
-		*pBuf++ = '
-		*pBuf++ = '
-#endif		
-		
+		if (sizeof(TCHAR) == 4)
+		{
+			*pBuf++ = '
+			*pBuf++ = '
+		}	
 	}
 #else
 	BYTE* pBufEnd = pBuf+MaxChars;
Index: Trunk/XaraLX/wxOil/outptpng.cpp
===================================================================
--- Trunk/XaraLX/wxOil/outptpng.cpp	(revision 1371)
+++ Trunk/XaraLX/wxOil/outptpng.cpp	(revision 1372)
@@ -604,15 +604,9 @@
 				// Palette supplied in RGBQUAD form 
 				for (INT32 i = 0; i < PaletteEntries; i++)
 				{
-#if defined(__WXGTK__)
-					pPNGPalette->red 	= pQuadPalette->rgbBlue;	// NOTE! Swap BGR <=> BGR
-					pPNGPalette->green 	= pQuadPalette->rgbGreen;
-					pPNGPalette->blue 	= pQuadPalette->rgbRed;		// NOTE! Swap BGR <=> BGR
-#else
 					pPNGPalette->red 	= pQuadPalette->rgbRed;
 					pPNGPalette->green 	= pQuadPalette->rgbGreen;
 					pPNGPalette->blue 	= pQuadPalette->rgbBlue;
-#endif
 					// skip to the next palette entry
 					pQuadPalette++;
 					pPNGPalette++;
@@ -623,15 +617,9 @@
 				// Palette supplied in LOGPALETTE form 
 				for (INT32 i = 0; i < PaletteEntries; i++)
 				{
-#if defined(__WXGTK__)
-					pPNGPalette->red  	= pPalette->palPalEntry[i].peBlue;	// NOTE! Swap BGR <=> BGR
-					pPNGPalette->green 	= pPalette->palPalEntry[i].peGreen;
-					pPNGPalette->blue 	= pPalette->palPalEntry[i].peRed;	// NOTE! Swap BGR <=> BGR
-#else
 					pPNGPalette->red  	= pPalette->palPalEntry[i].peRed;
 					pPNGPalette->green 	= pPalette->palPalEntry[i].peGreen;
 					pPNGPalette->blue 	= pPalette->palPalEntry[i].peBlue;
-#endif
 					pPNGPalette++;
 				}
 			}
@@ -735,10 +723,7 @@
 		// pack pixels into bytes
 		//png_set_packing(png_ptr);
 
-		// flip bgr pixels to rgb
-#if !defined(__WXMSW__) && defined(BIG_ENDIAN)
 		png_set_bgr(png_ptr);
-#endif
 
 		// swap bytes of 16 bit files to most significant bit first
 		png_set_swap(png_ptr);
Index: Trunk/XaraLX/wxOil/pngutil.cpp
===================================================================
--- Trunk/XaraLX/wxOil/pngutil.cpp	(revision 1371)
+++ Trunk/XaraLX/wxOil/pngutil.cpp	(revision 1372)
@@ -332,11 +332,9 @@
 				png_set_gamma(png_ptr, screen_gamma, 0.45455);
 		}
 		
-#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);
-#endif
 
 		/* Scan the palletes */
 		png_colorp pPalette;
@@ -493,15 +491,6 @@
 			{
 				File->GotError( _R(IDS_PNG_ERR_READ_PALETTE) ); // Should be bad palette error
 			}
-
-#if defined(__WXGTK__)
-			// Convert palettes for Linuxs BGR ordering (would be nice if png_set_bgr
-			// did this)
-			for( INT32 ord = 0; ord < PaletteSize; ++ord )
-			{
-				std::swap( lpPalette[ord].rgbBlue, lpPalette[ord].rgbRed );
-			}
-#endif
 		} 
 		else if (png_get_bit_depth(png_ptr, info_ptr) * png_get_channels(png_ptr, info_ptr) <= 8 
 			&& png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY)
Index: Trunk/XaraLX/wxOil/dibconv.cpp
===================================================================
--- Trunk/XaraLX/wxOil/dibconv.cpp	(revision 1371)
+++ Trunk/XaraLX/wxOil/dibconv.cpp	(revision 1372)
@@ -114,9 +114,9 @@
 CC_IMPLEMENT_MEMDUMP( DIBConvert, CC_CLASS_MEMDUMP )
 
 #if defined(__WXGTK__)
-#define GetLastError() 0
+#define GetLastError() (0)
 #elif defined(__WXMAC__)
-#define GetLastError() 0
+#define GetLastError() (0)
 #endif
 
 // these classes are never referred to outside this source file, so they live in the .cpp
Index: Trunk/XaraLX/wxOil/dragmgr.cpp
===================================================================
--- Trunk/XaraLX/wxOil/dragmgr.cpp	(revision 1371)
+++ Trunk/XaraLX/wxOil/dragmgr.cpp	(revision 1372)
@@ -695,7 +695,6 @@
 	if(!DragManagerOp::CurrentManager->CurrentDragInfo->DoesSolidDrag)
 	   	return TRUE;
 
-//#ifndef __WXGTK__
 	INT32 DragTransparency = DragManagerOp::CurrentManager->CurrentDragInfo->
 															GetDragTransparency();
 	// If the Drag Info says it wants to be transparent,
@@ -708,7 +707,6 @@
 		// If the Transparency Drag fails (eg. not enough resources under Win32s !!)
 		// then just fall though, and try a normal solid drag .....
 	}
-//#endif
 
 	// offset mouse pos by drag offset
 	point += DragManagerOp::CurrentManager->CurrentDragInfo->SolidDragOffset;


Xara