diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-07-05 14:51:20 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-07-06 08:43:13 +0200 |
commit | cea402a5adfda2ba2d75411691401a2971d78d83 (patch) | |
tree | 97f796367b3a3f6b32b62deecaf7ec9e80ddb728 /vcl/source/gdi | |
parent | e5e324a3420fc74fc147601bb125421e87060d93 (diff) |
ScanlineFormat::N1BitLsbPal is unused
ever since
commit 4160be791daaef1a0c059a248f678cbad6408a69
Author: Caolán McNamara <caolanm@redhat.com>
Date: Tue Jan 10 20:55:31 2023 +0000
no more X11SalBitmap
Change-Id: I9dd55acdde6af1bf7501a71e92725ab739801b0b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154060
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/gdi')
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 36 | ||||
-rw-r--r-- | vcl/source/gdi/salmisc.cxx | 2 |
2 files changed, 3 insertions, 35 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index b5653748ac8e..75e74b4e1af9 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -9387,36 +9387,6 @@ void PDFWriterImpl::writeReferenceXObject(const ReferenceXObjectEmit& rEmit) CHECK_RETURN2(writeBuffer(aLine)); } -namespace -{ - unsigned char reverseByte(unsigned char b) - { - b = (b & 0xF0) >> 4 | (b & 0x0F) << 4; - b = (b & 0xCC) >> 2 | (b & 0x33) << 2; - b = (b & 0xAA) >> 1 | (b & 0x55) << 1; - return b; - } - - //tdf#103051 convert any N1BitLsbPal to N1BitMsbPal - Bitmap getExportBitmap(const Bitmap &rBitmap) - { - Bitmap::ScopedReadAccess pAccess(const_cast<Bitmap&>(rBitmap)); - const ScanlineFormat eFormat = pAccess->GetScanlineFormat(); - if (eFormat != ScanlineFormat::N1BitLsbPal) - return rBitmap; - Bitmap aNewBmp(rBitmap); - BitmapScopedWriteAccess xWriteAcc(aNewBmp); - const int nScanLineBytes = (pAccess->Width() + 7U) / 8U; - for (tools::Long nY = 0L; nY < xWriteAcc->Height(); ++nY) - { - Scanline pBitSwap = xWriteAcc->GetScanline(nY); - for (int x = 0; x < nScanLineBytes; ++x) - pBitSwap[x] = reverseByte(pBitSwap[x]); - } - return aNewBmp; - } -} - bool PDFWriterImpl::writeBitmapObject( const BitmapEmit& rObject, bool bMask ) { if (rObject.m_aReferenceXObject.hasExternalPDFData() && !m_aContext.UseReferenceXObject) @@ -9431,7 +9401,7 @@ bool PDFWriterImpl::writeBitmapObject( const BitmapEmit& rObject, bool bMask ) bool bWriteMask = false; if( ! bMask ) { - aBitmap = getExportBitmap(rObject.m_aBitmap.GetBitmap()); + aBitmap = rObject.m_aBitmap.GetBitmap(); if( rObject.m_aBitmap.IsAlpha() ) { if( m_aContext.Version >= PDFWriter::PDFVersion::PDF_1_4 ) @@ -9445,14 +9415,14 @@ bool PDFWriterImpl::writeBitmapObject( const BitmapEmit& rObject, bool bMask ) { if( rObject.m_aBitmap.IsAlpha() ) { - aBitmap = getExportBitmap(rObject.m_aBitmap.GetAlphaMask()); + aBitmap = rObject.m_aBitmap.GetAlphaMask(); aBitmap.Convert( BmpConversion::N1BitThreshold ); SAL_WARN_IF(aBitmap.getPixelFormat() != vcl::PixelFormat::N8_BPP, "vcl.pdfwriter", "mask conversion failed" ); } } else if (aBitmap.getPixelFormat() != vcl::PixelFormat::N8_BPP) { - aBitmap = getExportBitmap(rObject.m_aBitmap.GetAlphaMask().GetBitmap()); + aBitmap = rObject.m_aBitmap.GetAlphaMask().GetBitmap(); aBitmap.Convert( BmpConversion::N8BitGreys ); SAL_WARN_IF(aBitmap.getPixelFormat() != vcl::PixelFormat::N8_BPP, "vcl.pdfwriter", "alpha mask conversion failed" ); } diff --git a/vcl/source/gdi/salmisc.cxx b/vcl/source/gdi/salmisc.cxx index 83ebbd000719..443718616e48 100644 --- a/vcl/source/gdi/salmisc.cxx +++ b/vcl/source/gdi/salmisc.cxx @@ -250,7 +250,6 @@ std::unique_ptr<BitmapBuffer> StretchAndConvert( switch( nDstScanlineFormat ) { IMPL_CASE_SET_FORMAT( N1BitMsbPal, 1 ); - IMPL_CASE_SET_FORMAT( N1BitLsbPal, 1 ); IMPL_CASE_SET_FORMAT( N8BitPal, 8 ); IMPL_CASE_SET_FORMAT( N24BitTcBgr, 24 ); IMPL_CASE_SET_FORMAT( N24BitTcRgb, 24 ); @@ -302,7 +301,6 @@ std::unique_ptr<BitmapBuffer> StretchAndConvert( // do we need a destination palette or color mask? if( ( nDstScanlineFormat == ScanlineFormat::N1BitMsbPal ) || - ( nDstScanlineFormat == ScanlineFormat::N1BitLsbPal ) || ( nDstScanlineFormat == ScanlineFormat::N8BitPal ) ) { assert(pDstPal && "destination buffer requires palette"); |