vcl/source/bitmap/salbmp.cxx |    8 ++++++++
 1 file changed, 8 insertions(+)

New commits:
commit 26a989688b7b413e5e9fdfdc5ee1645b76335911
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Tue Mar 31 14:56:43 2020 +0200
Commit:     Luboš Luňák <l.lu...@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.lu...@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;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to