diff options
author | Noel Grandin <noelgrandin@collabora.co.uk> | 2024-11-26 14:18:59 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-11-26 17:29:19 +0100 |
commit | 668dbfd99ada1888d5919cffedcfd7486c101717 (patch) | |
tree | ac021e88062fc8c0dc51419d9a45cee4ce0d9edb /vcl | |
parent | 2af9fcddba57632e4a13797dcd5894f4cfeb51a7 (diff) |
tdf#162815 Greyscale images not corrrectly exported to PDF
regression from commit 21734247d58a6e915b058d8fa55ece949d049613
"drop internal support for 1-bit images"
This only works on Linux because the HasGreyPaletteAny() check
is returning false on Linux, because on linux the swap in/out is more aggressive, and after it is has gone through the swap in/out process,
the image palette is no longer one that matches anything that HasGreyPaletteAny() checks for (it contains 256 entries, but only 2 of them are used)
I'm not exactly sure why the greyscale bitmap generation code
is generating bad PDF data, but the RGB code works great, so
lets just use that rather.
Change-Id: Ibb9e837540d5ed567c706e21e7ff93fe92118580
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177329
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 71c097d6b36e..3665709fd42b 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -9738,37 +9738,6 @@ bool PDFWriterImpl::writeBitmapObject( const BitmapEmit& rObject, bool bMask ) aLine.append( "/ColorSpace" ); if( bTrueColor ) aLine.append( "/DeviceRGB\n" ); - else if( aBitmap.HasGreyPaletteAny() ) - { - aLine.append( "/DeviceGray\n" ); - if (aBitmap.getPixelFormat() == vcl::PixelFormat::N8_BPP) - { - // #i47395# 1 bit bitmaps occasionally have an inverted grey palette - sal_uInt16 nBlackIndex = pAccess->GetBestPaletteIndex( BitmapColor( COL_BLACK ) ); - assert( nBlackIndex == 0 || nBlackIndex == 1); - sal_uInt16 nWhiteIndex = pAccess->GetBestPaletteIndex( BitmapColor( COL_WHITE ) ); - if( pAccess->GetPalette()[nBlackIndex] == BitmapColor( COL_BLACK ) && - pAccess->GetPalette()[nWhiteIndex] == BitmapColor( COL_WHITE ) ) - { - // It is black and white - if( nBlackIndex == 1 ) - aLine.append( "/Decode[1 0]\n" ); - } - else - { - // It is two levels of grey - aLine.append( "/Decode[" ); - assert( pAccess->GetPalette()[0].GetRed() == pAccess->GetPalette()[0].GetGreen() && - pAccess->GetPalette()[0].GetRed() == pAccess->GetPalette()[0].GetBlue() && - pAccess->GetPalette()[1].GetRed() == pAccess->GetPalette()[1].GetGreen() && - pAccess->GetPalette()[1].GetRed() == pAccess->GetPalette()[1].GetBlue() ); - aLine.append( pAccess->GetPalette()[0].GetRed() / 255.0 ); - aLine.append( " " ); - aLine.append( pAccess->GetPalette()[1].GetRed() / 255.0 ); - aLine.append( "]\n" ); - } - } - } else { aLine.append( "[ /Indexed/DeviceRGB " ); |