vcl/source/bitmap/bitmappaint.cxx | 56 ++++---------------------------------- 1 file changed, 7 insertions(+), 49 deletions(-)
New commits: commit efda8aa8ee0e8ec7afe5ad56937ae2e3c5570c32 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Sun Jan 1 21:14:14 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sun Jan 1 20:24:51 2023 +0000 remove dead code this code has been dead for some time, no need to keep it anymore. Change-Id: I9c553fa7460bda5331f5908311783207bf88be17 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144927 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/vcl/source/bitmap/bitmappaint.cxx b/vcl/source/bitmap/bitmappaint.cxx index 9caca46342e0..c0f6715238e7 100644 --- a/vcl/source/bitmap/bitmappaint.cxx +++ b/vcl/source/bitmap/bitmappaint.cxx @@ -441,7 +441,6 @@ Bitmap Bitmap::CreateMask(const Color& rTransColor, sal_uInt8 nTol) const // better supported by hardware, and the memory savings are not worth // it anymore. // TODO: Possibly remove the 1bpp code later. - constexpr bool use8BitMask = true; if (!nTol && pReadAcc && (pReadAcc->GetScanlineFormat() == ScanlineFormat::N1BitLsbPal @@ -453,9 +452,8 @@ Bitmap Bitmap::CreateMask(const Color& rTransColor, sal_uInt8 nTol) const return *this; } - auto ePixelFormat = use8BitMask ? vcl::PixelFormat::N8_BPP : vcl::PixelFormat::N1_BPP; - Bitmap aNewBmp(GetSizePixel(), ePixelFormat, - use8BitMask ? &Bitmap::GetGreyPalette(256) : nullptr); + auto ePixelFormat = vcl::PixelFormat::N8_BPP; + Bitmap aNewBmp(GetSizePixel(), ePixelFormat, &Bitmap::GetGreyPalette(256)); BitmapScopedWriteAccess pWriteAcc(aNewBmp); bool bRet = false; @@ -470,49 +468,10 @@ Bitmap Bitmap::CreateMask(const Color& rTransColor, sal_uInt8 nTol) const { const BitmapColor aTest(pReadAcc->GetBestMatchingColor(rTransColor)); - if (pWriteAcc->GetBitCount() == 1 - && pReadAcc->GetScanlineFormat() == ScanlineFormat::N8BitPal) - { - // optimized for 8Bit source palette - const sal_uInt8 cTest = aTest.GetIndex(); - - if (pWriteAcc->GetScanlineFormat() == ScanlineFormat::N1BitMsbPal - && aWhite.GetIndex() == 1) - { - // optimized for 1Bit-MSB destination palette - for (tools::Long nY = 0; nY < nHeight; ++nY) - { - Scanline pSrc = pReadAcc->GetScanline(nY); - Scanline pDst = pWriteAcc->GetScanline(nY); - for (tools::Long nX = 0; nX < nWidth; ++nX) - { - if (cTest == pSrc[nX]) - pDst[nX >> 3] |= 1 << (7 - (nX & 7)); - else - pDst[nX >> 3] &= ~(1 << (7 - (nX & 7))); - } - } - } - else - { - for (tools::Long nY = 0; nY < nHeight; ++nY) - { - Scanline pSrc = pReadAcc->GetScanline(nY); - Scanline pDst = pWriteAcc->GetScanline(nY); - for (tools::Long nX = 0; nX < nWidth; ++nX) - { - if (cTest == pSrc[nX]) - pWriteAcc->SetPixelOnData(pDst, nX, aWhite); - else - pWriteAcc->SetPixelOnData(pDst, nX, aBlack); - } - } - } - } - else if (pWriteAcc->GetScanlineFormat() == pReadAcc->GetScanlineFormat() - && aWhite.GetIndex() == 1 - && (pReadAcc->GetScanlineFormat() == ScanlineFormat::N1BitLsbPal - || pReadAcc->GetScanlineFormat() == ScanlineFormat::N1BitMsbPal)) + if (pWriteAcc->GetScanlineFormat() == pReadAcc->GetScanlineFormat() + && aWhite.GetIndex() == 1 + && (pReadAcc->GetScanlineFormat() == ScanlineFormat::N1BitLsbPal + || pReadAcc->GetScanlineFormat() == ScanlineFormat::N1BitMsbPal)) { for (tools::Long nY = 0; nY < nHeight; ++nY) { @@ -524,8 +483,7 @@ Bitmap Bitmap::CreateMask(const Color& rTransColor, sal_uInt8 nTol) const pDst[nX] = ~pSrc[nX]; } } - else if (use8BitMask && pWriteAcc->GetBitCount() == 8 - && pReadAcc->GetScanlineFormat() == ScanlineFormat::N8BitPal) + else if (pReadAcc->GetScanlineFormat() == ScanlineFormat::N8BitPal) { // optimized for 8Bit source palette const sal_uInt8 cTest = aTest.GetIndex();