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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sun Sep 13 14:21:06 UTC 2020


 vcl/source/filter/jpeg/JpegWriter.cxx |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit b732e63a0a4b4dcf74995adf7b679d12ecc09db5
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sun Sep 13 13:56:49 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Sep 13 16:20:30 2020 +0200

    tdf#132561 fix png export from Draw
    
    fixes a regression from
        commit 61e8387fa8ab55a04b95839c7c385c163d6de1cd
        tdf#128992 Compressing PNG files with alpha channel get a black background
    
    Change-Id: I8a225f76072c49f64393bb4b28c4d92c6e85587e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102548
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/vcl/source/filter/jpeg/JpegWriter.cxx b/vcl/source/filter/jpeg/JpegWriter.cxx
index bc41530047ed..da0774667545 100644
--- a/vcl/source/filter/jpeg/JpegWriter.cxx
+++ b/vcl/source/filter/jpeg/JpegWriter.cxx
@@ -197,7 +197,14 @@ bool JPEGWriter::Write( const Graphic& rGraphic )
         mxStatusIndicator->start( OUString(), 100 );
     }
 
-    Bitmap aGraphicBmp( rGraphic.GetBitmapEx().GetBitmap(COL_WHITE) );
+    // This slightly weird logic is here to match the behaviour in ImpGraphic::ImplGetBitmap
+    // and is necessary to match pre-existing behaviour. We should probably pass down the expected
+    // background color for alpha from the higher layers.
+    Bitmap aGraphicBmp;
+    if (rGraphic.GetType() == GraphicType::Bitmap)
+        aGraphicBmp = rGraphic.GetBitmapEx().GetBitmap(COL_WHITE);
+    else
+        aGraphicBmp = rGraphic.GetBitmapEx().GetBitmap();
 
     if ( mbGreys )
     {


More information about the Libreoffice-commits mailing list