include/vcl/bitmapex.hxx | 12 +++---- vcl/source/bitmap/BitmapEx.cxx | 62 ++++++++++++++++++++--------------------- 2 files changed, 37 insertions(+), 37 deletions(-)
New commits: commit aefc769e62e5a5cba4ba62f9a8c10e8317d2868c Author: Christopher Sherlock <chris.sherloc...@gmail.com> AuthorDate: Sat Nov 30 10:17:15 2024 +1100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Dec 6 10:17:28 2024 +0100 vcl: make Color parameters const in BitmapEx::createAlphaBlendFrame() Change-Id: I6d71552f4d5004477b5980fe6c8de710dd4aea9d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177565 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx index ebc56930192e..bfcbaa99e234 100644 --- a/include/vcl/bitmapex.hxx +++ b/include/vcl/bitmapex.hxx @@ -483,8 +483,8 @@ private: BitmapEx VCL_DLLPUBLIC createAlphaBlendFrame( const Size& rSize, sal_uInt8 nAlpha, - Color aColorTopLeft, - Color aColorBottomRight); + const Color& rColorTopLeft, + const Color& rColorBottomRight); /** Create a blend frame as BitmapEx using an alpha value @@ -501,10 +501,10 @@ BitmapEx VCL_DLLPUBLIC createAlphaBlendFrame( BitmapEx createAlphaBlendFrame( const Size& rSize, sal_uInt8 nAlpha, - Color aColorTopLeft, - Color aColorTopRight, - Color aColorBottomRight, - Color aColorBottomLeft); + const Color& rColorTopLeft, + const Color& rColorTopRight, + const Color& rColorBottomRight, + const Color& rColorBottomLeft); #endif // INCLUDED_VCL_BITMAPEX_HXX diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx index c46f1647aa39..d20954b270dc 100644 --- a/vcl/source/bitmap/BitmapEx.cxx +++ b/vcl/source/bitmap/BitmapEx.cxx @@ -1027,22 +1027,22 @@ BitmapEx BitmapEx::ModifyBitmapEx(const basegfx::BColorModifierStack& rBColorMod BitmapEx createAlphaBlendFrame( const Size& rSize, sal_uInt8 nAlpha, - Color aColorTopLeft, - Color aColorBottomRight) + const Color& rColorTopLeft, + const Color& rColorBottomRight) { const sal_uInt32 nW(rSize.Width()); const sal_uInt32 nH(rSize.Height()); if(nW || nH) { - Color aColTopRight(aColorTopLeft); - Color aColBottomLeft(aColorTopLeft); + Color aColTopRight(rColorTopLeft); + Color aColBottomLeft(rColorTopLeft); const sal_uInt32 nDE(nW + nH); - aColTopRight.Merge(aColorBottomRight, 255 - sal_uInt8((nW * 255) / nDE)); - aColBottomLeft.Merge(aColorBottomRight, 255 - sal_uInt8((nH * 255) / nDE)); + aColTopRight.Merge(rColorBottomRight, 255 - sal_uInt8((nW * 255) / nDE)); + aColBottomLeft.Merge(rColorBottomRight, 255 - sal_uInt8((nH * 255) / nDE)); - return createAlphaBlendFrame(rSize, nAlpha, aColorTopLeft, aColTopRight, aColorBottomRight, aColBottomLeft); + return createAlphaBlendFrame(rSize, nAlpha, rColorTopLeft, aColTopRight, rColorBottomRight, aColBottomLeft); } return BitmapEx(); @@ -1051,29 +1051,29 @@ BitmapEx createAlphaBlendFrame( BitmapEx createAlphaBlendFrame( const Size& rSize, sal_uInt8 nAlpha, - Color aColorTopLeft, - Color aColorTopRight, - Color aColorBottomRight, - Color aColorBottomLeft) + const Color& rColorTopLeft, + const Color& rColorTopRight, + const Color& rColorBottomRight, + const Color& rColorBottomLeft) { BlendFrameCache* pBlendFrameCache = ImplGetBlendFrameCache(); if(pBlendFrameCache->m_aLastSize == rSize && pBlendFrameCache->m_nLastAlpha == nAlpha - && pBlendFrameCache->m_aLastColorTopLeft == aColorTopLeft - && pBlendFrameCache->m_aLastColorTopRight == aColorTopRight - && pBlendFrameCache->m_aLastColorBottomRight == aColorBottomRight - && pBlendFrameCache->m_aLastColorBottomLeft == aColorBottomLeft) + && pBlendFrameCache->m_aLastColorTopLeft == rColorTopLeft + && pBlendFrameCache->m_aLastColorTopRight == rColorTopRight + && pBlendFrameCache->m_aLastColorBottomRight == rColorBottomRight + && pBlendFrameCache->m_aLastColorBottomLeft == rColorBottomLeft) { return pBlendFrameCache->m_aLastResult; } pBlendFrameCache->m_aLastSize = rSize; pBlendFrameCache->m_nLastAlpha = nAlpha; - pBlendFrameCache->m_aLastColorTopLeft = aColorTopLeft; - pBlendFrameCache->m_aLastColorTopRight = aColorTopRight; - pBlendFrameCache->m_aLastColorBottomRight = aColorBottomRight; - pBlendFrameCache->m_aLastColorBottomLeft = aColorBottomLeft; + pBlendFrameCache->m_aLastColorTopLeft = rColorTopLeft; + pBlendFrameCache->m_aLastColorTopRight = rColorTopRight; + pBlendFrameCache->m_aLastColorBottomRight = rColorBottomRight; + pBlendFrameCache->m_aLastColorBottomLeft = rColorBottomLeft; pBlendFrameCache->m_aLastResult.Clear(); const tools::Long nW(rSize.Width()); @@ -1098,15 +1098,15 @@ BitmapEx createAlphaBlendFrame( Scanline pScanAlpha = pContent->GetScanline( 0 ); // x == 0, y == 0, top-left corner - pContent->SetPixelOnData(pScanContent, 0, aColorTopLeft); + pContent->SetPixelOnData(pScanContent, 0, rColorTopLeft); pAlpha->SetPixelOnData(pScanAlpha, 0, BitmapColor(nAlpha)); // y == 0, top line left to right for(x = 1; x < nW - 1; x++) { - Color aMix(aColorTopLeft); + Color aMix(rColorTopLeft); - aMix.Merge(aColorTopRight, 255 - sal_uInt8((x * 255) / nW)); + aMix.Merge(rColorTopRight, 255 - sal_uInt8((x * 255) / nW)); pContent->SetPixelOnData(pScanContent, x, aMix); pAlpha->SetPixelOnData(pScanAlpha, x, BitmapColor(nAlpha)); } @@ -1115,7 +1115,7 @@ BitmapEx createAlphaBlendFrame( // #i123690# Caution! When nW is 1, x == nW is possible (!) if(x < nW) { - pContent->SetPixelOnData(pScanContent, x, aColorTopRight); + pContent->SetPixelOnData(pScanContent, x, rColorTopRight); pAlpha->SetPixelOnData(pScanAlpha, x, BitmapColor(nAlpha)); } @@ -1124,18 +1124,18 @@ BitmapEx createAlphaBlendFrame( { pScanContent = pContent->GetScanline( y ); pScanAlpha = pContent->GetScanline( y ); - Color aMixA(aColorTopLeft); + Color aMixA(rColorTopLeft); - aMixA.Merge(aColorBottomLeft, 255 - sal_uInt8((y * 255) / nH)); + aMixA.Merge(rColorBottomLeft, 255 - sal_uInt8((y * 255) / nH)); pContent->SetPixelOnData(pScanContent, 0, aMixA); pAlpha->SetPixelOnData(pScanAlpha, 0, BitmapColor(nAlpha)); // #i123690# Caution! When nW is 1, x == nW is possible (!) if(x < nW) { - Color aMixB(aColorTopRight); + Color aMixB(rColorTopRight); - aMixB.Merge(aColorBottomRight, 255 - sal_uInt8((y * 255) / nH)); + aMixB.Merge(rColorBottomRight, 255 - sal_uInt8((y * 255) / nH)); pContent->SetPixelOnData(pScanContent, x, aMixB); pAlpha->SetPixelOnData(pScanAlpha, x, BitmapColor(nAlpha)); } @@ -1145,15 +1145,15 @@ BitmapEx createAlphaBlendFrame( if(y < nH) { // x == 0, y == nH - 1, bottom-left corner - pContent->SetPixelOnData(pScanContent, 0, aColorBottomLeft); + pContent->SetPixelOnData(pScanContent, 0, rColorBottomLeft); pAlpha->SetPixelOnData(pScanAlpha, 0, BitmapColor(nAlpha)); // y == nH - 1, bottom line left to right for(x = 1; x < nW - 1; x++) { - Color aMix(aColorBottomLeft); + Color aMix(rColorBottomLeft); - aMix.Merge(aColorBottomRight, 255 - sal_uInt8(((x - 0)* 255) / nW)); + aMix.Merge(rColorBottomRight, 255 - sal_uInt8(((x - 0)* 255) / nW)); pContent->SetPixelOnData(pScanContent, x, aMix); pAlpha->SetPixelOnData(pScanAlpha, x, BitmapColor(nAlpha)); } @@ -1162,7 +1162,7 @@ BitmapEx createAlphaBlendFrame( // #i123690# Caution! When nW is 1, x == nW is possible (!) if(x < nW) { - pContent->SetPixelOnData(pScanContent, x, aColorBottomRight); + pContent->SetPixelOnData(pScanContent, x, rColorBottomRight); pAlpha->SetPixelOnData(pScanAlpha, x, BitmapColor(nAlpha)); } }