diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2020-06-29 21:09:43 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2020-07-01 07:35:49 +0200 |
commit | eb959d4a964e973ea1cf4b066f6007878c22fcf5 (patch) | |
tree | 640535324879ceacf8968e2ddec1b08c092ae2ea /vcl | |
parent | b1c119679700630d16bcf76d96a99e3a39908914 (diff) |
avoid Bitmap::Erase() duplicating code
Change-Id: I68d388175355fe1fcf5acc300730e8473fa559fd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97486
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/bitmap/bitmappaint.cxx | 65 |
1 files changed, 1 insertions, 64 deletions
diff --git a/vcl/source/bitmap/bitmappaint.cxx b/vcl/source/bitmap/bitmappaint.cxx index 5c14e1476aca..22ddf2ea5e6b 100644 --- a/vcl/source/bitmap/bitmappaint.cxx +++ b/vcl/source/bitmap/bitmappaint.cxx @@ -41,70 +41,7 @@ bool Bitmap::Erase(const Color& rFillColor) if (pWriteAcc) { - const ScanlineFormat nFormat = pWriteAcc->GetScanlineFormat(); - sal_uInt8 cIndex = 0; - bool bFast = false; - - switch (nFormat) - { - case ScanlineFormat::N1BitMsbPal: - case ScanlineFormat::N1BitLsbPal: - { - cIndex = static_cast<sal_uInt8>(pWriteAcc->GetBestPaletteIndex(rFillColor)); - cIndex = (cIndex ? 255 : 0); - bFast = true; - } - break; - - case ScanlineFormat::N4BitMsnPal: - case ScanlineFormat::N4BitLsnPal: - { - cIndex = static_cast<sal_uInt8>(pWriteAcc->GetBestPaletteIndex(rFillColor)); - cIndex = cIndex | (cIndex << 4); - bFast = true; - } - break; - - case ScanlineFormat::N8BitPal: - { - cIndex = static_cast<sal_uInt8>(pWriteAcc->GetBestPaletteIndex(rFillColor)); - bFast = true; - } - break; - - case ScanlineFormat::N24BitTcBgr: - case ScanlineFormat::N24BitTcRgb: - { - if (rFillColor.GetRed() == rFillColor.GetGreen() - && rFillColor.GetRed() == rFillColor.GetBlue()) - { - cIndex = rFillColor.GetRed(); - bFast = true; - } - else - { - bFast = false; - } - } - break; - - default: - bFast = false; - break; - } - - if (bFast) - { - const sal_uLong nBufSize = pWriteAcc->GetScanlineSize() * pWriteAcc->Height(); - memset(pWriteAcc->GetBuffer(), cIndex, nBufSize); - } - else - { - const tools::Rectangle aRect(Point(), Size(pWriteAcc->Width(), pWriteAcc->Height())); - pWriteAcc->SetFillColor(rFillColor); - pWriteAcc->FillRect(aRect); - } - + pWriteAcc->Erase(rFillColor); bRet = true; } |