update dev300-m58
[ooovba.git] / applied_patches / 0276-vcl-bitmap2-negative-height.diff
blobe59d0040a2bcf65c6285702f76d022c1f5f7faac
1 Index: vcl/source/gdi/bitmap2.cxx
2 ===================================================================
3 RCS file: /cvs/gsl/vcl/source/gdi/bitmap2.cxx,v
4 retrieving revision 1.14
5 diff -u -r1.14 bitmap2.cxx
6 --- vcl/source/gdi/bitmap2.cxx 17 Sep 2006 11:57:13 -0000 1.14
7 +++ vcl/source/gdi/bitmap2.cxx 1 Feb 2007 15:36:29 -0000
8 @@ -187,7 +187,7 @@
10 const USHORT nBitCount( discretizeBitcount(aHeader.nBitCount) );
12 - const Size aSizePixel( aHeader.nWidth, aHeader.nHeight );
13 + const Size aSizePixel( aHeader.nWidth, abs(aHeader.nHeight) );
14 BitmapPalette aDummyPal;
15 Bitmap aNewBmp( aSizePixel, nBitCount, &aDummyPal );
16 BitmapWriteAccess* pAcc = aNewBmp.AcquireWriteAccess();
17 @@ -259,7 +259,7 @@
18 Fraction( 1000, aHeader.nYPelsPerMeter ) );
20 aNewBmp.SetPrefMapMode( aMapMode );
21 - aNewBmp.SetPrefSize( Size( aHeader.nWidth, aHeader.nHeight ) );
22 + aNewBmp.SetPrefSize( Size( aHeader.nWidth, abs(aHeader.nHeight) ) );
26 @@ -380,7 +380,7 @@
27 else
29 rIStm >> rHeader.nWidth;
30 - rIStm >> rHeader.nHeight;
31 + rIStm >> rHeader.nHeight; //rHeader.nHeight=abs(rHeader.nHeight);
32 rIStm >> rHeader.nPlanes;
33 rIStm >> rHeader.nBitCount;
34 rIStm >> rHeader.nCompression;
35 @@ -463,7 +463,13 @@
36 if( rHeader.nColsUsed && rHeader.nBitCount > 8 )
37 rIStm.SeekRel( rHeader.nColsUsed * ( ( rHeader.nSize != DIBCOREHEADERSIZE ) ? 4 : 3 ) );
39 - rIStm.Read( rAcc.GetBuffer(), rHeader.nHeight * nAlignedWidth );
40 + if (rHeader.nHeight>0) {
41 + rIStm.Read( rAcc.GetBuffer(), rHeader.nHeight * nAlignedWidth );
42 + } else {
43 + for(int i=abs(rHeader.nHeight)-1;i>=0;i--) {
44 + rIStm.Read( ((char*)rAcc.GetBuffer())+(nAlignedWidth*i), nAlignedWidth );
45 + }
46 + }
48 else
50 @@ -506,7 +512,7 @@
51 else
53 const long nWidth = rHeader.nWidth;
54 - const long nHeight = rHeader.nHeight;
55 + const long nHeight = abs(rHeader.nHeight);
56 BYTE* pBuf = new BYTE[ nAlignedWidth ];
58 // true color DIB's can have a (optimization) palette
59 @@ -1047,7 +1053,7 @@
60 BitmapWriteAccess& rAcc, BOOL bRLE4 )
62 Scanline pRLE = pBuffer;
63 - long nY = rHeader.nHeight - 1L;
64 + long nY = abs(rHeader.nHeight) - 1L;
65 const ULONG nWidth = rAcc.Width();
66 ULONG nCountByte;
67 ULONG nRunByte;