diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-01 12:59:47 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-01 14:33:11 +0200 |
commit | 5c23560ba39fe17c75cafe3d495af743238e4d67 (patch) | |
tree | d868af88ebbec737e4dd867ce3f650c1518b7556 | |
parent | c94d45cd08e2d5db5c007b9a77352f7621f84a09 (diff) |
BmpCombine::And is dead
ever since
commit ddd2639a482befb4a3bf1f75a88e66c21a691b67
Date: Sat Feb 27 15:50:37 2021 +0200
drop mask from BitmapEx
Change-Id: I45fae0140067e2bfe5ce1ae2f5014ce733835ef1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118220
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | include/vcl/bitmap.hxx | 14 | ||||
-rw-r--r-- | svx/source/dialog/_bmpmask.cxx | 2 | ||||
-rw-r--r-- | svx/source/dialog/_contdlg.cxx | 2 | ||||
-rw-r--r-- | vcl/source/bitmap/BitmapEx.cxx | 2 | ||||
-rw-r--r-- | vcl/source/bitmap/bitmappaint.cxx | 49 |
5 files changed, 15 insertions, 54 deletions
diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx index 2a6872c179f0..d27ffdaa8559 100644 --- a/include/vcl/bitmap.hxx +++ b/include/vcl/bitmap.hxx @@ -78,11 +78,6 @@ enum class BmpConversion N8BitNoConversion // make 8bit without color conversion (e.g. take the red channel) }; -enum class BmpCombine -{ - Or, And -}; - class BitmapInfoAccess; class BitmapReadAccess; class BitmapWriteAccess; @@ -238,19 +233,14 @@ public: const tools::Rectangle& rRectSrc, const Bitmap* pBmpSrc ); - /** Perform boolean operations with another bitmap + /** Perform boolean OR operation with another bitmap @param rMask The mask bitmap in the selected combine operation - @param eCombine - The combine operation to perform on the bitmap - @return true, if the operation was completed successfully. */ - bool CombineSimple( - const Bitmap& rMask, - BmpCombine eCombine ); + bool CombineOr( const Bitmap& rMask ); /** Alpha-blend the given bitmap against a specified uniform background color. diff --git a/svx/source/dialog/_bmpmask.cxx b/svx/source/dialog/_bmpmask.cxx index 7f65bb697517..420321d2a9be 100644 --- a/svx/source/dialog/_bmpmask.cxx +++ b/svx/source/dialog/_bmpmask.cxx @@ -615,7 +615,7 @@ BitmapEx SvxBmpMask::ImpMaskTransparent( const BitmapEx& rBitmapEx, const Color& Bitmap aMask( rBitmapEx.GetBitmap().CreateMask( rColor, nTol ) ); if( rBitmapEx.IsAlpha() ) - aMask.CombineSimple( rBitmapEx.GetAlpha(), BmpCombine::Or ); + aMask.CombineOr( rBitmapEx.GetAlpha() ); aBmpEx = BitmapEx( rBitmapEx.GetBitmap(), aMask ); LeaveWait(); diff --git a/svx/source/dialog/_contdlg.cxx b/svx/source/dialog/_contdlg.cxx index c6fcde5d1dfc..712544ff0c01 100644 --- a/svx/source/dialog/_contdlg.cxx +++ b/svx/source/dialog/_contdlg.cxx @@ -634,7 +634,7 @@ IMPL_LINK( SvxSuperContourDlg, PipetteClickHdl, ContourWindow&, rWnd, void ) Bitmap aMask = aGraphic.GetBitmapEx().GetBitmap().CreateMask( rColor, nTol ); if( aGraphic.IsTransparent() ) - aMask.CombineSimple( aGraphic.GetBitmapEx().GetAlpha(), BmpCombine::Or ); + aMask.CombineOr( aGraphic.GetBitmapEx().GetAlpha() ); if( !aMask.IsEmpty() ) { diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx index 2c56ab44b6a0..91ee55c58ed3 100644 --- a/vcl/source/bitmap/BitmapEx.cxx +++ b/vcl/source/bitmap/BitmapEx.cxx @@ -1443,7 +1443,7 @@ void BitmapEx::CombineMaskOr(Color maskColor, sal_uInt8 nTol) { Bitmap aNewMask = maBitmap.CreateMask( maskColor, nTol ); if ( IsAlpha() ) - aNewMask.CombineSimple( maAlphaMask, BmpCombine::Or ); + aNewMask.CombineOr( maAlphaMask ); maAlphaMask = aNewMask; } diff --git a/vcl/source/bitmap/bitmappaint.cxx b/vcl/source/bitmap/bitmappaint.cxx index 847dd4171b18..e06f96e8abd7 100644 --- a/vcl/source/bitmap/bitmappaint.cxx +++ b/vcl/source/bitmap/bitmappaint.cxx @@ -1047,7 +1047,7 @@ bool Bitmap::Replace(const Color* pSearchColors, const Color* pReplaceColors, si return bRet; } -bool Bitmap::CombineSimple(const Bitmap& rMask, BmpCombine eCombine) +bool Bitmap::CombineOr(const Bitmap& rMask) { ScopedReadAccess pMaskAcc(const_cast<Bitmap&>(rMask)); BitmapScopedWriteAccess pAcc(*this); @@ -1062,51 +1062,22 @@ bool Bitmap::CombineSimple(const Bitmap& rMask, BmpCombine eCombine) const BitmapColor aBlack(pAcc->GetBestMatchingColor(aColBlack)); const BitmapColor aMaskBlack(pMaskAcc->GetBestMatchingColor(aColBlack)); - switch (eCombine) + for (tools::Long nY = 0; nY < nHeight; nY++) { - case BmpCombine::And: + Scanline pScanline = pAcc->GetScanline(nY); + Scanline pScanlineMask = pMaskAcc->GetScanline(nY); + for (tools::Long nX = 0; nX < nWidth; nX++) { - for (tools::Long nY = 0; nY < nHeight; nY++) + if (pMaskAcc->GetPixelFromData(pScanlineMask, nX) != aMaskBlack + || pAcc->GetPixelFromData(pScanline, nX) != aBlack) { - Scanline pScanline = pAcc->GetScanline(nY); - Scanline pScanlineMask = pMaskAcc->GetScanline(nY); - for (tools::Long nX = 0; nX < nWidth; nX++) - { - if (pMaskAcc->GetPixelFromData(pScanlineMask, nX) != aMaskBlack - && pAcc->GetPixelFromData(pScanline, nX) != aBlack) - { - pAcc->SetPixelOnData(pScanline, nX, aWhite); - } - else - { - pAcc->SetPixelOnData(pScanline, nX, aBlack); - } - } + pAcc->SetPixelOnData(pScanline, nX, aWhite); } - } - break; - - case BmpCombine::Or: - { - for (tools::Long nY = 0; nY < nHeight; nY++) + else { - Scanline pScanline = pAcc->GetScanline(nY); - Scanline pScanlineMask = pMaskAcc->GetScanline(nY); - for (tools::Long nX = 0; nX < nWidth; nX++) - { - if (pMaskAcc->GetPixelFromData(pScanlineMask, nX) != aMaskBlack - || pAcc->GetPixelFromData(pScanline, nX) != aBlack) - { - pAcc->SetPixelOnData(pScanline, nX, aWhite); - } - else - { - pAcc->SetPixelOnData(pScanline, nX, aBlack); - } - } + pAcc->SetPixelOnData(pScanline, nX, aBlack); } } - break; } bRet = true; |