diff options
author | Philipp Lohmann [pl] <Philipp.Lohmann@Sun.COM> | 2010-03-23 18:54:21 +0100 |
---|---|---|
committer | Philipp Lohmann [pl] <Philipp.Lohmann@Sun.COM> | 2010-03-23 18:54:21 +0100 |
commit | 8e24fa4567fb4d3fc47190be1f9bf058061d0ec4 (patch) | |
tree | 99158546f5158180577e67d2c042fe099176bf72 /vcl/source/gdi/bitmap.cxx | |
parent | dd69e7d54931e7510482a35a0a605f0c8792ee7c (diff) |
vcl110: #i60481# fix HasGreyPalette for 1 bit
Diffstat (limited to 'vcl/source/gdi/bitmap.cxx')
-rw-r--r-- | vcl/source/gdi/bitmap.cxx | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx index 51c76b5a4626..074935086b0b 100644 --- a/vcl/source/gdi/bitmap.cxx +++ b/vcl/source/gdi/bitmap.cxx @@ -323,7 +323,23 @@ BOOL Bitmap::HasGreyPalette() const BOOL bRet = FALSE; if( 1 == nBitCount ) - bRet = TRUE; + { + BitmapReadAccess* pRAcc = ( (Bitmap*) this )->AcquireReadAccess(); + + if( pRAcc ) + { + const BitmapColor& rCol0( pRAcc->GetPaletteColor( 0 ) ); + const BitmapColor& rCol1( pRAcc->GetPaletteColor( 1 ) ); + if( rCol0.GetRed() == rCol0.GetGreen() && rCol0.GetRed() == rCol0.GetBlue() && + rCol1.GetRed() == rCol1.GetGreen() && rCol1.GetRed() == rCol1.GetBlue() ) + { + bRet = TRUE; + } + ( (Bitmap*) this )->ReleaseAccess( pRAcc ); + } + else + bRet = TRUE; + } else if( 4 == nBitCount || 8 == nBitCount ) { BitmapReadAccess* pRAcc = ( (Bitmap*) this )->AcquireReadAccess(); |