diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2019-03-13 17:35:27 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2019-03-25 13:46:57 +0100 |
commit | 4b48f5c2fd2d0d6de1e1df4c13ceba47b1da7b5e (patch) | |
tree | 29872f57b427dbb583435cdabba2fceda1973955 /vcl/source | |
parent | 4304226d79849b31fd0ded168cee45a91f240363 (diff) |
fix grayscale jpeg writing in pdfexport (tdf#121615)
If the bitmap to be written is non-8bit, e.g. in case of using OpenGL
(on Linux the test requires "SAL_FORCEGL=1 SAL_USE_VCLPLUGIN=gen",
on Windows it's probably the default case), then the bitmap is not
in native format for 8bit. This was done correctly by 45e8e0fbee40f
that introduced it but somehow it got lost later (I can't even find
where).
Change-Id: Ib1810cb9cf12e373c1cb41da40fa28e96ad7db28
Reviewed-on: https://gerrit.libreoffice.org/69213
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/filter/jpeg/JpegWriter.cxx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/vcl/source/filter/jpeg/JpegWriter.cxx b/vcl/source/filter/jpeg/JpegWriter.cxx index ac01d6f18aa1..407e2423b64a 100644 --- a/vcl/source/filter/jpeg/JpegWriter.cxx +++ b/vcl/source/filter/jpeg/JpegWriter.cxx @@ -230,7 +230,10 @@ bool JPEGWriter::Write( const Graphic& rGraphic ) if( mpExpWasGrey ) *mpExpWasGrey = mbGreys; - mbNative = ( mpReadAccess->GetScanlineFormat() == ScanlineFormat::N24BitTcRgb ); + if ( mbGreys ) + mbNative = ( mpReadAccess->GetScanlineFormat() == ScanlineFormat::N8BitPal ); + else + mbNative = ( mpReadAccess->GetScanlineFormat() == ScanlineFormat::N24BitTcRgb ); if( !mbNative ) mpBuffer = new sal_uInt8[ AlignedWidth4Bytes( mbGreys ? mpReadAccess->Width() * 8L : mpReadAccess->Width() * 24L ) ]; |