]> git.pld-linux.org Git - packages/libreoffice.git/blame - openoffice-gui-insensitive.patch
- up
[packages/libreoffice.git] / openoffice-gui-insensitive.patch
CommitLineData
efef92ce 1Index: vcl/inc/image.h
2===================================================================
3RCS file: /cvs/gsl/vcl/inc/image.h,v
4retrieving revision 1.3
5diff -u -p -u -r1.3 image.h
6--- vcl/inc/image.h 22 Aug 2002 13:54:19 -0000 1.3
7+++ vcl/inc/image.h 15 Sep 2003 13:52:49 -0000
8@@ -85,6 +85,7 @@ class ImplImageBmp
9 Bitmap aBmp;
10 Bitmap aMask;
11 Bitmap aDisa;
12+ Bitmap aDisaMask;
13 Bitmap aBmpDisp;
14 Bitmap aMaskDisp;
15 Bitmap aDisaDisp;
16Index: vcl/source/gdi/impimage.cxx
17===================================================================
18RCS file: /cvs/gsl/vcl/source/gdi/impimage.cxx,v
19retrieving revision 1.10
20diff -u -p -u -r1.10 impimage.cxx
21--- vcl/source/gdi/impimage.cxx 22 Aug 2002 13:57:18 -0000 1.10
22+++ vcl/source/gdi/impimage.cxx 25 Sep 2003 08:48:08 -0000
23@@ -193,8 +193,10 @@ void ImplImageBmp::Expand( USHORT nGrowS
24 aBmp.Expand( nDX, 0UL );
25 aMask.Expand( nDX, 0UL );
26
27- if( !!aDisa )
28+ if( !!aDisa ) {
29 aDisa.Expand( nDX, 0UL );
30+ aDisaMask.Expand( nDX, 0UL );
31+ }
32
33 memset( pNewAry, 0, nSize );
34 memcpy( pNewAry, pInfoAry, nOldSize );
35@@ -218,8 +220,10 @@ void ImplImageBmp::Replace( USHORT nPos,
36 {
37 aMask.CopyPixel( aDstRect, aSrcRect );
38
39- if( !!aDisa )
40+ if( !!aDisa ) {
41 aDisa.CopyPixel( aDstRect, aSrcRect );
42+ aDisaMask.CopyPixel( aDstRect, aSrcRect );
43+ }
44 }
45
46 pInfoAry[ nPos ] = pInfoAry[ nSrcPos ];
47@@ -241,8 +245,10 @@ void ImplImageBmp::Replace( USHORT nPos,
48 {
49 aMask.CopyPixel( aDstRect, aSrcRect, &rImageBmp.aMask );
50
51- if( !!aDisa )
52+ if( !!aDisa ) {
53 aDisa.CopyPixel( aDstRect, aSrcRect, &rImageBmp.aDisa );
54+ aDisaMask.CopyPixel( aDstRect, aSrcRect, &rImageBmp.aDisa );
55+ }
56 }
57
58 pInfoAry[ nPos ] = rImageBmp.pInfoAry[ nSrcPos ];
59@@ -299,7 +305,10 @@ void ImplImageBmp::ReplaceColors( const
60 ClearCaches();
61
62 if( !aDisa.IsEmpty() )
63+ {
64 aDisa.SetEmpty();
65+ aDisaMask.SetEmpty();
66+ }
67
68 aBmp.Replace( pSrcColors, pDstColors, nColorCount );
69 }
70@@ -395,7 +404,9 @@ BOOL ImplImageBmp::HasMaskBitmap() const
71
72 Bitmap ImplImageBmp::GetMaskBitmap( USHORT nPosCount, USHORT* pPosAry ) const
73 {
74- Bitmap aNewMask( Size( nPosCount * aSize.Width(), aSize.Height() ), aMask.GetBitCount() );
75+ Bitmap aNewMask( Size( nPosCount * aSize.Width(), aSize.Height() ),
76+ aMask.GetBitCount(),
77+ aMask.GetBitCount() > 1 ? &Bitmap::GetGreyPalette( 256 ) : NULL );
78
79 for( USHORT i = 0; i < nPosCount; i++ )
80 {
81@@ -482,7 +493,11 @@ void ImplImageBmp::Draw( USHORT nPos, Ou
82
83 if( !aDisa )
84 {
85- aDisa = Bitmap( aBmpEx.GetSizePixel(), 1 );
86+ aDisa = Bitmap( aBmpEx.GetSizePixel(), aBmpEx.GetBitCount() );
87+ if( aBmpEx.GetMask().GetBitCount() == 1 )
88+ aDisaMask = Bitmap( aBmpEx.GetSizePixel(), 1 );
89+ else
90+ aDisaMask = Bitmap( aBmpEx.GetSizePixel(), 8, &Bitmap::GetGreyPalette( 256 ) );
91 ImplUpdateDisaBmp( DISA_ALL );
92 #ifndef REMOTE_APPSERVER
93 aDisaDisp = aDisa.CreateDisplayBitmap( pOutDev );
94@@ -494,10 +509,18 @@ void ImplImageBmp::Draw( USHORT nPos, Ou
95 if( !aDisaDisp && !!aDisa )
96 aDisaDisp = aDisa.CreateDisplayBitmap( pOutDev );
97
98- pOutDev->DrawMask( aOutPos1, aOutSize, aPos, aSize,
99- aDisaDisp, rSettings.GetLightColor() );
100- pOutDev->DrawMask( aOutPos, aOutSize, aPos, aSize,
101- aDisaDisp, rSettings.GetShadowColor() );
102+ if (aDisaDisp.GetBitCount() == 1)
103+ { // A mask
104+ pOutDev->DrawMask( aOutPos1, aOutSize, aPos, aSize,
105+ aDisaDisp, rSettings.GetLightColor() );
106+ pOutDev->DrawMask( aOutPos, aOutSize, aPos, aSize,
107+ aDisaDisp, rSettings.GetShadowColor() );
108+ }
109+ else
110+ {
111+ BitmapEx tBmpEx( aDisa, aDisaMask );
112+ pOutDev->DrawBitmapEx( aOutPos, aOutSize, aPos, aSize, tBmpEx );
113+ }
114 }
115 else
116 {
117@@ -505,9 +528,10 @@ void ImplImageBmp::Draw( USHORT nPos, Ou
118
119 if( nStyle & ( IMAGE_DRAW_COLORTRANSFORM | IMAGE_DRAW_HIGHLIGHT | IMAGE_DRAW_DEACTIVE | IMAGE_DRAW_SEMITRANSPARENT ) )
120 {
121+
122 Bitmap aTmpBmp( aBmp ), aTmpMsk( aMask );
123 const Rectangle aCropRect( aPos, aSize );
124-
125+
126 aTmpBmp.Crop( aCropRect );
127 aTmpMsk.Crop( aCropRect );
128
129@@ -607,11 +631,8 @@ void ImplImageBmp::Draw( USHORT nPos, Ou
130 aTmpMsk.Convert( BMP_CONVERSION_8BIT_GREYS );
131 aTmpMsk.Adjust( 50 );
132 }
133-
134- aTmpBmpEx = BitmapEx( aTmpBmp, AlphaMask( aTmpMsk ) );
135 }
136- else
137- aTmpBmpEx = BitmapEx( aTmpBmp, aTmpMsk );
138+ aTmpBmpEx = BitmapEx( aTmpBmp, aTmpMsk );
139
140 pOutDev->DrawBitmapEx( aOutPos, aTmpBmpEx );
141 bDrawn = TRUE;
142@@ -651,6 +672,7 @@ void ImplImageBmp::ImplUpdateDisaBmp( US
143 BitmapReadAccess* pAcc = aBmp.AcquireReadAccess();
144 BitmapReadAccess* pMsk = aMask.AcquireReadAccess();
145 BitmapWriteAccess* pDis = aDisa.AcquireWriteAccess();
146+ BitmapWriteAccess* pDisMask = aDisaMask.AcquireWriteAccess();
147
148 if( pAcc && pMsk && pDis )
149 {
150@@ -741,22 +763,52 @@ void ImplImageBmp::ImplUpdateDisaBmp( US
151 }
152 }
153 }
154- else
155- {
156+ else if (pAcc->GetBitCount() == 32)
157+ {
158+ for( long nX = nCurLeft; nX < nCurRight; nX++ )
159+ {
160 for( long nY = nTop; nY < nBottom; nY++ )
161 {
162- for( long nX = nCurLeft; nX < nCurRight; nX++ )
163- {
164- if( ( aMskWhite == pMsk->GetPixel( nY, nX ) ) ||
165- ( aAccWhite == pAcc->GetPixel( nY, nX ) ) )
166+ BitmapColor col = pAcc->GetPixel( nY, nX );
167+
168+ if ((nY + nX) % 2 == 0)
169 {
170- pDis->SetPixel( nY, nX, aDisWhite );
171+ unsigned char i;
172+ i = ( col.GetRed() * 0.3 + // magic numbers from gdk-pixbuf
173+ col.GetGreen() * 0.59 +
174+ col.GetBlue () * 0.11 );
175+
176+ col.SetRed (i / 2 + 127);
177+ col.SetGreen (i / 2 + 127);
178+ col.SetBlue (i / 2 + 127);
179 }
180 else
181 {
182- pDis->SetPixel( nY, nX, aDisBlack );
183- ++nBlackCount;
184+#define GT_ZERO(c) (((c) >= 0) ? c : 0)
185+ col.SetRed (GT_ZERO (( col.GetRed ()) * 0.7));
186+ col.SetGreen (GT_ZERO (( col.GetGreen ()) * 0.7));
187+ col.SetBlue (GT_ZERO (( col.GetBlue ()) * 0.7));
188+#undef GT_ZERO
189 }
190+ pDis->SetPixel( nY, nX, col );
191+ // The way the mask is polarised is most strange
192+ BYTE nAlpha = 255 - (BYTE)pMsk->GetPixel( nY, nX );
193+ pDisMask->SetPixel( nY, nX, BitmapColor( 255 - (nAlpha / 2) ) );
194+ }
195+ }
196+ nBlackCount = nBlackThreshold;
197+ }
198+ else
199+ {
200+ for( long nY = nTop; nY < nBottom; nY++ )
201+ {
202+ for( long nX = nCurLeft; nX < nCurRight; nX++ )
203+ {
204+ if( ( aMskWhite == pMsk->GetPixel( nY, nX ) ) &&
205+ ( aAccWhite != pAcc->GetPixel( nY, nX ) ) )
206+ pDis->SetPixel( nY, nX, aDisBlack );
207+ else
208+ pDis->SetPixel( nY, nX, aDisWhite );
209 }
210 }
211 }
212@@ -784,6 +836,7 @@ void ImplImageBmp::ImplUpdateDisaBmp( US
213 aBmp.ReleaseAccess( pAcc );
214 aMask.ReleaseAccess( pMsk );
215 aDisa.ReleaseAccess( pDis );
216+ aDisa.ReleaseAccess( pDisMask );
217 }
218
219 // -----------------------------------------------------------------------
This page took 0.075035 seconds and 4 git commands to generate.