vcl/source/filter/png/PngImageWriter.cxx |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 1956bd5f27fa10a336b9cf9e27751eca5ff907b5
Author:     Patrick Luby <plub...@libreoffice.org>
AuthorDate: Wed Dec 13 09:03:12 2023 -0500
Commit:     Patrick Luby <plub...@libreoffice.org>
CommitDate: Wed Dec 13 21:37:51 2023 +0100

    Fix unit test failure when using Skia in debug builds
    
    Calling aBitmap.HasGreyPalette8Bit() hits an assert when
    using Skia in a debug build so query the palette through
    the bitmap read access object.
    
    Change-Id: I12fad6783ec7d6df6c99db197aaa52fd4b01ed69
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160684
    Tested-by: Jenkins
    Reviewed-by: Patrick Luby <plub...@libreoffice.org>

diff --git a/vcl/source/filter/png/PngImageWriter.cxx 
b/vcl/source/filter/png/PngImageWriter.cxx
index 584487fabdd5..1674f80e14a0 100644
--- a/vcl/source/filter/png/PngImageWriter.cxx
+++ b/vcl/source/filter/png/PngImageWriter.cxx
@@ -209,7 +209,10 @@ static bool pngWrite(SvStream& rStream, const Graphic& 
rGraphic, int nCompressio
             }
             case ScanlineFormat::N8BitPal:
             {
-                if (!aBitmap.HasGreyPalette8Bit())
+                // Calling aBitmap.HasGreyPalette8Bit() hits an assert when
+                // using Skia in a debug build so query the palette through
+                // the bitmap read access object.
+                if (!pAccess->HasPalette() || 
!pAccess->GetPalette().IsGreyPalette8Bit())
                     colorType = PNG_COLOR_TYPE_PALETTE;
                 else
                 {

Reply via email to