vcl/source/filter/igif/gifread.cxx |   18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

New commits:
commit 2a5dac6d75b346a77652dec05cafa6562177d40f
Author:     Patrick Luby <plub...@neooffice.org>
AuthorDate: Fri Nov 3 10:37:00 2023 -0400
Commit:     Patrick Luby <plub...@neooffice.org>
CommitDate: Fri Nov 3 18:32:26 2023 +0100

    tdf#158047 allow the tdf#157635 fix for palettes with 64 entries
    
    Change-Id: Ib4e4deb5f7e332a7ef3a9231e993231068c21c4f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158885
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Reviewed-by: Patrick Luby <plub...@neooffice.org>

diff --git a/vcl/source/filter/igif/gifread.cxx 
b/vcl/source/filter/igif/gifread.cxx
index 78d3190a0c85..cac966c665f4 100644
--- a/vcl/source/filter/igif/gifread.cxx
+++ b/vcl/source/filter/igif/gifread.cxx
@@ -319,8 +319,6 @@ void GIFReader::ReadPaletteEntries( BitmapPalette* pPal, 
sal_uLong nCount )
         rColor.SetBlue( *pTmp++ );
     }
 
-    bEnhance = false;
-
     // if possible accommodate some standard colours
     if( nCount < 256 )
     {
@@ -329,15 +327,13 @@ void GIFReader::ReadPaletteEntries( BitmapPalette* pPal, 
sal_uLong nCount )
         if( nCount < 255 )
             (*pPal)[ 254UL ] = COL_BLACK;
     }
-    else
-    {
-        // tdf#157793 limit tdf#157635 fix to only larger palettes
-        // I don't know why, but the fix for tdf#157635 causes
-        // images with a palette of 16 entries to be inverted.
-        // Is this the only condition for masking out black
-        // pixels in non-transparent animation frames?
-        bEnhance = true;
-    }
+
+    // tdf#157793 limit tdf#157635 fix to only larger palettes
+    // I don't know why, but the fix for tdf#157635 causes
+    // images with a palette of 16 entries to be inverted.
+    // Also, fix tdf#158047 by allowing the tdf#157635 fix for
+    // palettes with 64 entries.
+    bEnhance = (nCount > 16);
 }
 
 bool GIFReader::ReadExtension()

Reply via email to