summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-09-13 13:56:49 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-09-13 20:44:25 +0200
commitb8766a1555fe644fb7dabdfa943e84f6704c9cee (patch)
treeeb3bd049736946ebd15f69870b248f50f6fbec12
parentf35a95ff215203fc6bd0f943125283610c95ce3f (diff)
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> (cherry picked from commit b732e63a0a4b4dcf74995adf7b679d12ecc09db5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102567
-rw-r--r--vcl/source/filter/jpeg/JpegWriter.cxx9
1 files changed, 8 insertions, 1 deletions
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 )
{