[Libreoffice-commits] core.git: vcl/source
LuboÅ¡ LuÅák (via logerrit)
logerrit at kemper.freedesktop.org
Wed Apr 1 08:04:26 UTC 2020
vcl/source/bitmap/salbmp.cxx | 8 ++++++++
1 file changed, 8 insertions(+)
New commits:
commit 26a989688b7b413e5e9fdfdc5ee1645b76335911
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Tue Mar 31 14:56:43 2020 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Wed Apr 1 10:03:42 2020 +0200
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 at collabora.com>
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;
More information about the Libreoffice-commits
mailing list