Index: vcl/source/gdi/bitmap2.cxx
===================================================================
RCS file: /cvs/gsl/vcl/source/gdi/bitmap2.cxx,v
retrieving revision 1.14
diff -u -r1.14 bitmap2.cxx
--- vcl/source/gdi/bitmap2.cxx	17 Sep 2006 11:57:13 -0000	1.14
+++ vcl/source/gdi/bitmap2.cxx	1 Feb 2007 15:36:29 -0000
@@ -187,7 +187,7 @@
 	{
 		const USHORT nBitCount( discretizeBitcount(aHeader.nBitCount) );
 
-		const Size			aSizePixel( aHeader.nWidth, aHeader.nHeight );
+		const Size			aSizePixel( aHeader.nWidth, abs(aHeader.nHeight) );
 		BitmapPalette		aDummyPal;
 		Bitmap				aNewBmp( aSizePixel, nBitCount, &aDummyPal );
 		BitmapWriteAccess*	pAcc = aNewBmp.AcquireWriteAccess();
@@ -259,7 +259,7 @@
 									  Fraction( 1000, aHeader.nYPelsPerMeter ) );
 
 					aNewBmp.SetPrefMapMode( aMapMode );
-					aNewBmp.SetPrefSize( Size( aHeader.nWidth, aHeader.nHeight ) );
+					aNewBmp.SetPrefSize( Size( aHeader.nWidth, abs(aHeader.nHeight) ) );
 				}
 			}
 
@@ -380,7 +380,7 @@
 		else
 		{
 			rIStm >> rHeader.nWidth;
-			rIStm >> rHeader.nHeight;
+			rIStm >> rHeader.nHeight; //rHeader.nHeight=abs(rHeader.nHeight);
 			rIStm >> rHeader.nPlanes;
 			rIStm >> rHeader.nBitCount;
 			rIStm >> rHeader.nCompression;
@@ -463,7 +463,13 @@
 		if( rHeader.nColsUsed && rHeader.nBitCount > 8 )
 			rIStm.SeekRel( rHeader.nColsUsed * ( ( rHeader.nSize != DIBCOREHEADERSIZE ) ? 4 : 3 ) );
 
-		rIStm.Read( rAcc.GetBuffer(), rHeader.nHeight * nAlignedWidth );
+		if (rHeader.nHeight>0) {
+		    rIStm.Read( rAcc.GetBuffer(), rHeader.nHeight * nAlignedWidth );
+		} else {
+		    for(int i=abs(rHeader.nHeight)-1;i>=0;i--) {
+			rIStm.Read( ((char*)rAcc.GetBuffer())+(nAlignedWidth*i), nAlignedWidth );		
+		    }
+		}
 	}
 	else
 	{
@@ -506,7 +512,7 @@
 		else
 		{
 			const long	nWidth = rHeader.nWidth;
-			const long	nHeight = rHeader.nHeight;
+			const long	nHeight = abs(rHeader.nHeight);
 			BYTE*		pBuf = new BYTE[ nAlignedWidth ];
 
 			// true color DIB's can have a (optimization) palette
@@ -1047,7 +1053,7 @@
 							BitmapWriteAccess& rAcc, BOOL bRLE4 )
 {
 	Scanline	pRLE = pBuffer;
-	long		nY = rHeader.nHeight - 1L;
+	long		nY = abs(rHeader.nHeight) - 1L;
 	const ULONG	nWidth = rAcc.Width();
 	ULONG		nCountByte;
 	ULONG		nRunByte;
