diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-09-13 13:56:49 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-09-13 16:20:30 +0200 |
commit | b732e63a0a4b4dcf74995adf7b679d12ecc09db5 (patch) | |
tree | 69eef140b115c73d5a6eafe4f5bf71742f9498d4 /vcl/source/filter | |
parent | ffcee12bc09dd1bfd713314788061273ca144efd (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>
Diffstat (limited to 'vcl/source/filter')
-rw-r--r-- | vcl/source/filter/jpeg/JpegWriter.cxx | 9 |
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 ) { |