diff options
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/bitmap.cxx | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx index bacea96c8df4..2d12a67efedf 100644 --- a/vcl/source/gdi/bitmap.cxx +++ b/vcl/source/gdi/bitmap.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: bitmap.cxx,v $ - * $Revision: 1.22 $ + * $Revision: 1.23 $ * * This file is part of OpenOffice.org. * @@ -162,7 +162,7 @@ Bitmap::~Bitmap() // ------------------------------------------------------------------ -const BitmapPalette& Bitmap::GetGreyPalette( USHORT nEntries ) +const BitmapPalette& Bitmap::GetGreyPalette( int nEntries ) { static BitmapPalette aGreyPalette2; static BitmapPalette aGreyPalette4; @@ -232,6 +232,22 @@ const BitmapPalette& Bitmap::GetGreyPalette( USHORT nEntries ) // ------------------------------------------------------------------ +bool BitmapPalette::IsGreyPalette() const +{ + // TODO: add an IsGreyPalette flag to BitmapPalette + // TODO: unless this causes problems binary compatibility + const int nEntryCount = GetEntryCount(); + if( !nEntryCount ) // NOTE: an empty palette means 1:1 mapping + return true; + const BitmapPalette& rGreyPalette = Bitmap::GetGreyPalette( nEntryCount ); + if( rGreyPalette == *this ) + return true; + // TODO: is it worth to compare the entries? + return false; +} + +// ------------------------------------------------------------------ + Bitmap& Bitmap::operator=( const Bitmap& rBitmap ) { maPrefSize = rBitmap.maPrefSize; |