[Libreoffice-commits] core.git: vcl/source

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Fri Mar 26 07:30:53 UTC 2021


 vcl/source/bitmap/BitmapColorQuantizationFilter.cxx |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

New commits:
commit 720906bb78d6cee61de7fef76a914cccefee68cd
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Mar 25 22:43:29 2021 +0900
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Fri Mar 26 08:30:05 2021 +0100

    vcl: remove use of 4-bit bitmap in BitmapColorQuantizationFilter
    
    Change BitmapColorQuantizationFilter to use only 8-bit palette
    bitmap as result of the filter.
    
    Change-Id: I9c7226288166bcf1769059a2dff81830cf26adc6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113138
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/vcl/source/bitmap/BitmapColorQuantizationFilter.cxx b/vcl/source/bitmap/BitmapColorQuantizationFilter.cxx
index 5bd5a3127911..2205f1ca98f0 100644
--- a/vcl/source/bitmap/BitmapColorQuantizationFilter.cxx
+++ b/vcl/source/bitmap/BitmapColorQuantizationFilter.cxx
@@ -32,15 +32,9 @@ BitmapEx BitmapColorQuantizationFilter::execute(BitmapEx const& aBitmapEx) const
     else
     {
         Bitmap::ScopedReadAccess pRAcc(aBitmap);
-        vcl::PixelFormat ePixelFormat;
 
         auto const cappedNewColorCount = std::min(mnNewColorCount, sal_uInt16(256));
 
-        if (cappedNewColorCount < 17)
-            ePixelFormat = vcl::PixelFormat::N4_BPP;
-        else
-            ePixelFormat = vcl::PixelFormat::N8_BPP;
-
         if (pRAcc)
         {
             const sal_uInt32 nValidBits = 4;
@@ -135,7 +129,7 @@ BitmapEx BitmapColorQuantizationFilter::execute(BitmapEx const& aBitmapEx) const
                                            << nRightShiftBits));
             }
 
-            Bitmap aNewBmp(aBitmap.GetSizePixel(), ePixelFormat, &aNewPal);
+            Bitmap aNewBmp(aBitmap.GetSizePixel(), vcl::PixelFormat::N8_BPP, &aNewPal);
             BitmapScopedWriteAccess pWAcc(aNewBmp);
 
             if (pWAcc)


More information about the Libreoffice-commits mailing list