summaryrefslogtreecommitdiff
path: root/vcl/source/bitmap
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2020-03-31 14:56:43 +0200
committerLuboš Luňák <l.lunak@collabora.com>2020-04-01 10:03:42 +0200
commit26a989688b7b413e5e9fdfdc5ee1645b76335911 (patch)
tree57e2953acd71545a083b526b9149719d5640157b /vcl/source/bitmap
parent55661298bb3e9087a89a08637e4285f090c4e0e8 (diff)
avoid needless "palette" conversion with gray palette
Change-Id: I29be80180c6d7ddc83c66e14744f49cdbd4d5124 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91423 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl/source/bitmap')
-rw-r--r--vcl/source/bitmap/salbmp.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/vcl/source/bitmap/salbmp.cxx b/vcl/source/bitmap/salbmp.cxx
index c9aca589edba..7e1b9a347140 100644
--- a/vcl/source/bitmap/salbmp.cxx
+++ b/vcl/source/bitmap/salbmp.cxx
@@ -149,6 +149,14 @@ std::unique_ptr< sal_uInt8[] > SalBitmap::convertDataBitCount( const sal_uInt8*
assert( bitCount == 1 || bitCount == 4 || bitCount == 8 );
static const int bpp[] = { 1, 3, 3, 4, 4 };
std::unique_ptr< sal_uInt8[] > data( new sal_uInt8[width * height * bpp[ static_cast<int>(type) ]] );
+
+ if(type == BitConvert::A8 && bitCount == 8 && palette.IsGreyPalette())
+ { // no actual data conversion
+ for( int y = 0; y < height; ++y )
+ memcpy( data.get() + y * width, src + y * bytesPerRow, width );
+ return data;
+ }
+
std::unique_ptr<ImplPixelFormat> pSrcFormat(ImplPixelFormat::GetFormat(bitCount, palette));
const sal_uInt8* pSrcData = src;