Update ooo320-m1
[ooovba.git] / applied_patches / 0498-vcl-grey-alpha-unix-sal-bitmap.diff
blob2d9fd0721613169cac77f54f54651dd933406983
1 diff -rup /home/rodo/svn/ooo-build-1/build/ooh680-m8/vcl/unx/inc/salbmp.h vcl/unx/inc/salbmp.h
2 --- /home/rodo/svn/ooo-build-1/build/ooh680-m8/vcl/unx/inc/salbmp.h 2008-03-03 11:01:10.000000000 +0100
3 +++ vcl/unx/inc/salbmp.h 2008-02-28 13:18:23.000000000 +0100
4 @@ -74,7 +74,8 @@ private:
5 int nScreen,
6 long nDrawableDepth,
7 long nX, long nY,
8 - long nWidth, long nHeight );
9 + long nWidth, long nHeight,
10 + bool bGrey );
12 public:
14 @@ -95,6 +96,7 @@ private:
16 BitmapBuffer* mpDIB;
17 ImplSalDDB* mpDDB;
18 + bool mbGrey;
20 public:
22 diff -rup /home/rodo/svn/ooo-build-1/build/ooh680-m8/vcl/unx/source/gdi/salbmp.cxx vcl/unx/source/gdi/salbmp.cxx
23 --- /home/rodo/svn/ooo-build-1/build/ooh680-m8/vcl/unx/source/gdi/salbmp.cxx 2008-03-03 11:01:10.000000000 +0100
24 +++ vcl/unx/source/gdi/salbmp.cxx 2008-02-28 13:39:01.000000000 +0100
25 @@ -97,7 +98,8 @@ ULONG X11SalBitmap::mnCacheInstCount
27 X11SalBitmap::X11SalBitmap() :
28 mpDIB( NULL ),
29 - mpDDB( NULL )
30 + mpDDB( NULL ),
31 + mbGrey( false )
35 @@ -211,7 +213,8 @@ BitmapBuffer* X11SalBitmap::ImplCreateDI
36 int nScreen,
37 long nDrawableDepth,
38 long nX, long nY,
39 - long nWidth, long nHeight )
40 + long nWidth, long nHeight,
41 + bool bGrey )
43 BitmapBuffer* pDIB = NULL;
45 @@ -322,6 +325,21 @@ BitmapBuffer* X11SalBitmap::ImplCreateDI
46 rPal[ 0 ] = Color( COL_BLACK );
47 rPal[ 1 ] = Color( COL_WHITE );
49 + else if( pImage->depth == 8 && bGrey )
50 + {
51 + rPal.SetEntryCount( 256 );
52 + pDstPal = &rPal;
54 + for( USHORT i = 0; i < 256; i++ )
55 + {
56 + BitmapColor& rBmpCol = rPal[ i ];
58 + rBmpCol.SetRed( i );
59 + rBmpCol.SetGreen( i );
60 + rBmpCol.SetBlue( i );
61 + }
63 + }
64 else if( aSrcBuf.mnBitCount <= 8 )
66 const SalColormap& rColMap = pSalDisp->GetColormap( nScreen );
67 @@ -365,7 +383,8 @@ XImage* X11SalBitmap::ImplCreateXImage(
68 mpDDB->ImplGetDepth(),
69 0, 0,
70 mpDDB->ImplGetWidth(),
71 - mpDDB->ImplGetHeight() );
72 + mpDDB->ImplGetHeight(),
73 + mbGrey );
76 if( mpDIB && mpDIB->mnWidth && mpDIB->mnHeight )
77 @@ -448,6 +467,20 @@ XImage* X11SalBitmap::ImplCreateXImage(
78 (*pPal)[ 0 ] = Color( COL_BLACK );
79 (*pPal)[ 1 ] = Color( COL_WHITE );
81 + else if( pImage->depth == 8 && mbGrey )
82 + {
83 + pPal = new BitmapPalette( 256 );
85 + for( USHORT i = 0; i < 256; i++ )
86 + {
87 + BitmapColor& rBmpCol = (*pPal)[ i ];
89 + rBmpCol.SetRed( i );
90 + rBmpCol.SetGreen( i );
91 + rBmpCol.SetBlue( i );
92 + }
94 + }
95 else if( pImage->depth <= 8 )
97 const SalColormap& rColMap = pSalDisp->GetColormap( nScreen );
98 @@ -612,7 +645,8 @@ ImplSalDDB* X11SalBitmap::ImplGetDDB( Dr
99 mpDDB->ImplGetDepth(),
100 0, 0,
101 mpDDB->ImplGetWidth(),
102 - mpDDB->ImplGetHeight() );
103 + mpDDB->ImplGetHeight(),
104 + mbGrey );
107 delete mpDDB, const_cast<X11SalBitmap*>(this)->mpDDB = NULL;
108 @@ -775,6 +809,8 @@ bool X11SalBitmap::Create( const ::com::
110 if( xFastPropertySet->getFastPropertyValue(bMask ? 2 : 1) >>= args ) {
111 if( ( args[1] >>= pixmapHandle ) && ( args[2] >>= depth ) ) {
113 + mbGrey = bMask;
114 bool bSuccess = ImplCreateFromDrawable( pixmapHandle, 0, depth, 0, 0, (long) rSize.Width(), (long) rSize.Height() );
115 bool bFreePixmap;
116 if( bSuccess && (args[0] >>= bFreePixmap) && bFreePixmap )
117 @@ -844,7 +882,7 @@ BitmapBuffer* X11SalBitmap::AcquireBuffe
118 mpDIB = ImplCreateDIB( mpDDB->ImplGetPixmap(),
119 mpDDB->ImplGetScreen(),
120 mpDDB->ImplGetDepth(),
121 - 0, 0, mpDDB->ImplGetWidth(), mpDDB->ImplGetHeight() );
122 + 0, 0, mpDDB->ImplGetWidth(), mpDDB->ImplGetHeight(), mbGrey );
125 return mpDIB;