summaryrefslogtreecommitdiff
path: root/vcl/source/bitmap/bitmap.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-08-19 20:36:03 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-08-20 11:28:26 +0200
commit02c9c9adf65883ecaeef0e86a4b0b70ee3d5cf52 (patch)
tree367be04bd1b33cdc64c93a1ae00fe99b79f95f6e /vcl/source/bitmap/bitmap.cxx
parent4bb59cd1f45133994d3d13642367470f528094f4 (diff)
make BitmapPalette a COW type
so we can avoid copying it during rendering Change-Id: Id83d2bb2682f46188ee6ccc90c92d338a1e05b98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120759 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/bitmap/bitmap.cxx')
-rw-r--r--vcl/source/bitmap/bitmap.cxx40
1 files changed, 0 insertions, 40 deletions
diff --git a/vcl/source/bitmap/bitmap.cxx b/vcl/source/bitmap/bitmap.cxx
index e688296aa606..07f2c7bf8219 100644
--- a/vcl/source/bitmap/bitmap.cxx
+++ b/vcl/source/bitmap/bitmap.cxx
@@ -229,46 +229,6 @@ const BitmapPalette& Bitmap::GetGreyPalette( int nEntries )
return GetGreyPalette(2);
}
-bool BitmapPalette::IsGreyPaletteAny() const
-{
- const int nEntryCount = GetEntryCount();
- if( !nEntryCount ) // NOTE: an empty palette means 1:1 mapping
- return true;
- // See above: only certain entry values will result in a valid call to GetGreyPalette
- if( nEntryCount == 2 || nEntryCount == 4 || nEntryCount == 16 || nEntryCount == 256 )
- {
- const BitmapPalette& rGreyPalette = Bitmap::GetGreyPalette( nEntryCount );
- if( rGreyPalette == *this )
- return true;
- }
-
- bool bRet = false;
- // TODO: is it worth to compare the entries for the general case?
- if (nEntryCount == 2)
- {
- const BitmapColor& rCol0(maBitmapColor[0]);
- const BitmapColor& rCol1(maBitmapColor[1]);
- bRet = rCol0.GetRed() == rCol0.GetGreen() && rCol0.GetRed() == rCol0.GetBlue() &&
- rCol1.GetRed() == rCol1.GetGreen() && rCol1.GetRed() == rCol1.GetBlue();
- }
- return bRet;
-}
-
-bool BitmapPalette::IsGreyPalette8Bit() const
-{
- const int nEntryCount = GetEntryCount();
- if( !nEntryCount ) // NOTE: an empty palette means 1:1 mapping
- return true;
- if( nEntryCount != 256 )
- return false;
- for (sal_uInt16 i = 0; i < 256; ++i)
- {
- if( maBitmapColor[i] != BitmapColor(i, i, i))
- return false;
- }
- return true;
-}
-
Bitmap& Bitmap::operator=( const Bitmap& rBitmap )
{
if (this == &rBitmap)