diff options
author | Christopher Sherlock <chris.sherlock79@gmail.com> | 2024-11-14 00:38:25 +1100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2024-12-04 18:51:24 +0100 |
commit | 48d0d525d0cc579be2b1ba195ee797fd6f670276 (patch) | |
tree | 6d8bd332696e27921f01b0229231e05786b9df7b /vcl/source | |
parent | 285b66443303b8e240a6af48adb1f58bf4f8644e (diff) |
vcl: fix call sites for createBlendFrame(), rename to createAlphaBlendFrame()
The call sites are actually passing in transparency, in fact to be
consistent with current conventions we are actually dealing with alpha
values. So we need to take the transparent values at the call sites and
convert to alpha values by just subtracting 255. Hence fixing the FIXME
comment.
Change-Id: Ibc55ea77f469ec8afcab0cc26d2b8cdf25ea8a72
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173858
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/bitmap/BitmapEx.cxx | 10 | ||||
-rw-r--r-- | vcl/source/control/imp_listbox.cxx | 8 |
2 files changed, 8 insertions, 10 deletions
diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx index b44a1ca5cad9..8ce9c47dee09 100644 --- a/vcl/source/bitmap/BitmapEx.cxx +++ b/vcl/source/bitmap/BitmapEx.cxx @@ -1024,7 +1024,7 @@ BitmapEx BitmapEx::ModifyBitmapEx(const basegfx::BColorModifierStack& rBColorMod return BitmapEx(aChangedBitmap); } -BitmapEx createBlendFrame( +BitmapEx createAlphaBlendFrame( const Size& rSize, sal_uInt8 nAlpha, Color aColorTopLeft, @@ -1042,13 +1042,13 @@ BitmapEx createBlendFrame( aColTopRight.Merge(aColorBottomRight, 255 - sal_uInt8((nW * 255) / nDE)); aColBottomLeft.Merge(aColorBottomRight, 255 - sal_uInt8((nH * 255) / nDE)); - return createBlendFrame(rSize, nAlpha, aColorTopLeft, aColTopRight, aColorBottomRight, aColBottomLeft); + return createAlphaBlendFrame(rSize, nAlpha, aColorTopLeft, aColTopRight, aColorBottomRight, aColBottomLeft); } return BitmapEx(); } -BitmapEx createBlendFrame( +BitmapEx createAlphaBlendFrame( const Size& rSize, sal_uInt8 nAlpha, Color aColorTopLeft, @@ -1056,8 +1056,6 @@ BitmapEx createBlendFrame( Color aColorBottomRight, Color aColorBottomLeft) { - // FIXME the call sites are actually passing in transparency - nAlpha = 255 - nAlpha; BlendFrameCache* pBlendFrameCache = ImplGetBlendFrameCache(); if(pBlendFrameCache->m_aLastSize == rSize @@ -1340,7 +1338,7 @@ tools::Polygon BitmapEx::GetContour( bool bContourEdgeDetect, pPoints1.reset(new Point[ nHeight ]); pPoints2.reset(new Point[ nHeight ]); - for (tools::Long nY = nStartY1; nY < nEndY1; nY++ ) + for (tools::Long nY = nStartY1; nY < nEndY1; nY++) { tools::Long nX = nStartX1; Scanline pScanline = pAcc->GetScanline( nY ); diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx index 488c032a89f6..45b84c7db4ea 100644 --- a/vcl/source/control/imp_listbox.cxx +++ b/vcl/source/control/imp_listbox.cxx @@ -1691,8 +1691,8 @@ void ImplListBoxWindow::DrawEntry(vcl::RenderContext& rRenderContext, sal_Int32 { const Color& rTopLeft(rStyleSettings.GetEdgeBlendingTopLeftColor()); const Color& rBottomRight(rStyleSettings.GetEdgeBlendingBottomRightColor()); - const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100); - const BitmapEx aBlendFrame(createBlendFrame(aImgSz, nAlpha, rTopLeft, rBottomRight)); + const sal_uInt8 nAlpha(255 - ((nEdgeBlendingPercent * 255) / 100)); + const BitmapEx aBlendFrame(createAlphaBlendFrame(aImgSz, nAlpha, rTopLeft, rBottomRight)); if (!aBlendFrame.IsEmpty()) { @@ -2709,8 +2709,8 @@ void ImplWin::DrawEntry(vcl::RenderContext& rRenderContext, bool bLayout) { const Color& rTopLeft(rStyleSettings.GetEdgeBlendingTopLeftColor()); const Color& rBottomRight(rStyleSettings.GetEdgeBlendingBottomRightColor()); - const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100); - const BitmapEx aBlendFrame(createBlendFrame(aImgSz, nAlpha, rTopLeft, rBottomRight)); + const sal_uInt8 nAlpha(255 - ((nEdgeBlendingPercent * 255) / 100)); + const BitmapEx aBlendFrame(createAlphaBlendFrame(aImgSz, nAlpha, rTopLeft, rBottomRight)); if(!aBlendFrame.IsEmpty()) { |