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@collabora.co.uk>
diff --git a/vcl/source/filter/jpeg/JpegWriter.cxx b/vcl/source/filter/jpeg/JpegWriter.cxx
index bc41530..da077466 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 )
{