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.weghorn@posteo.de> Tested-by: Jenkins
This commit is contained in:
parent
50bf9a5e97
commit
aefc769e62
2 changed files with 37 additions and 37 deletions
|
@ -483,8 +483,8 @@ private:
|
||||||
BitmapEx VCL_DLLPUBLIC createAlphaBlendFrame(
|
BitmapEx VCL_DLLPUBLIC createAlphaBlendFrame(
|
||||||
const Size& rSize,
|
const Size& rSize,
|
||||||
sal_uInt8 nAlpha,
|
sal_uInt8 nAlpha,
|
||||||
Color aColorTopLeft,
|
const Color& rColorTopLeft,
|
||||||
Color aColorBottomRight);
|
const Color& rColorBottomRight);
|
||||||
|
|
||||||
/** Create a blend frame as BitmapEx using an alpha value
|
/** Create a blend frame as BitmapEx using an alpha value
|
||||||
|
|
||||||
|
@ -501,10 +501,10 @@ BitmapEx VCL_DLLPUBLIC createAlphaBlendFrame(
|
||||||
BitmapEx createAlphaBlendFrame(
|
BitmapEx createAlphaBlendFrame(
|
||||||
const Size& rSize,
|
const Size& rSize,
|
||||||
sal_uInt8 nAlpha,
|
sal_uInt8 nAlpha,
|
||||||
Color aColorTopLeft,
|
const Color& rColorTopLeft,
|
||||||
Color aColorTopRight,
|
const Color& rColorTopRight,
|
||||||
Color aColorBottomRight,
|
const Color& rColorBottomRight,
|
||||||
Color aColorBottomLeft);
|
const Color& rColorBottomLeft);
|
||||||
|
|
||||||
#endif // INCLUDED_VCL_BITMAPEX_HXX
|
#endif // INCLUDED_VCL_BITMAPEX_HXX
|
||||||
|
|
||||||
|
|
|
@ -1027,22 +1027,22 @@ BitmapEx BitmapEx::ModifyBitmapEx(const basegfx::BColorModifierStack& rBColorMod
|
||||||
BitmapEx createAlphaBlendFrame(
|
BitmapEx createAlphaBlendFrame(
|
||||||
const Size& rSize,
|
const Size& rSize,
|
||||||
sal_uInt8 nAlpha,
|
sal_uInt8 nAlpha,
|
||||||
Color aColorTopLeft,
|
const Color& rColorTopLeft,
|
||||||
Color aColorBottomRight)
|
const Color& rColorBottomRight)
|
||||||
{
|
{
|
||||||
const sal_uInt32 nW(rSize.Width());
|
const sal_uInt32 nW(rSize.Width());
|
||||||
const sal_uInt32 nH(rSize.Height());
|
const sal_uInt32 nH(rSize.Height());
|
||||||
|
|
||||||
if(nW || nH)
|
if(nW || nH)
|
||||||
{
|
{
|
||||||
Color aColTopRight(aColorTopLeft);
|
Color aColTopRight(rColorTopLeft);
|
||||||
Color aColBottomLeft(aColorTopLeft);
|
Color aColBottomLeft(rColorTopLeft);
|
||||||
const sal_uInt32 nDE(nW + nH);
|
const sal_uInt32 nDE(nW + nH);
|
||||||
|
|
||||||
aColTopRight.Merge(aColorBottomRight, 255 - sal_uInt8((nW * 255) / nDE));
|
aColTopRight.Merge(rColorBottomRight, 255 - sal_uInt8((nW * 255) / nDE));
|
||||||
aColBottomLeft.Merge(aColorBottomRight, 255 - sal_uInt8((nH * 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();
|
return BitmapEx();
|
||||||
|
@ -1051,29 +1051,29 @@ BitmapEx createAlphaBlendFrame(
|
||||||
BitmapEx createAlphaBlendFrame(
|
BitmapEx createAlphaBlendFrame(
|
||||||
const Size& rSize,
|
const Size& rSize,
|
||||||
sal_uInt8 nAlpha,
|
sal_uInt8 nAlpha,
|
||||||
Color aColorTopLeft,
|
const Color& rColorTopLeft,
|
||||||
Color aColorTopRight,
|
const Color& rColorTopRight,
|
||||||
Color aColorBottomRight,
|
const Color& rColorBottomRight,
|
||||||
Color aColorBottomLeft)
|
const Color& rColorBottomLeft)
|
||||||
{
|
{
|
||||||
BlendFrameCache* pBlendFrameCache = ImplGetBlendFrameCache();
|
BlendFrameCache* pBlendFrameCache = ImplGetBlendFrameCache();
|
||||||
|
|
||||||
if(pBlendFrameCache->m_aLastSize == rSize
|
if(pBlendFrameCache->m_aLastSize == rSize
|
||||||
&& pBlendFrameCache->m_nLastAlpha == nAlpha
|
&& pBlendFrameCache->m_nLastAlpha == nAlpha
|
||||||
&& pBlendFrameCache->m_aLastColorTopLeft == aColorTopLeft
|
&& pBlendFrameCache->m_aLastColorTopLeft == rColorTopLeft
|
||||||
&& pBlendFrameCache->m_aLastColorTopRight == aColorTopRight
|
&& pBlendFrameCache->m_aLastColorTopRight == rColorTopRight
|
||||||
&& pBlendFrameCache->m_aLastColorBottomRight == aColorBottomRight
|
&& pBlendFrameCache->m_aLastColorBottomRight == rColorBottomRight
|
||||||
&& pBlendFrameCache->m_aLastColorBottomLeft == aColorBottomLeft)
|
&& pBlendFrameCache->m_aLastColorBottomLeft == rColorBottomLeft)
|
||||||
{
|
{
|
||||||
return pBlendFrameCache->m_aLastResult;
|
return pBlendFrameCache->m_aLastResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
pBlendFrameCache->m_aLastSize = rSize;
|
pBlendFrameCache->m_aLastSize = rSize;
|
||||||
pBlendFrameCache->m_nLastAlpha = nAlpha;
|
pBlendFrameCache->m_nLastAlpha = nAlpha;
|
||||||
pBlendFrameCache->m_aLastColorTopLeft = aColorTopLeft;
|
pBlendFrameCache->m_aLastColorTopLeft = rColorTopLeft;
|
||||||
pBlendFrameCache->m_aLastColorTopRight = aColorTopRight;
|
pBlendFrameCache->m_aLastColorTopRight = rColorTopRight;
|
||||||
pBlendFrameCache->m_aLastColorBottomRight = aColorBottomRight;
|
pBlendFrameCache->m_aLastColorBottomRight = rColorBottomRight;
|
||||||
pBlendFrameCache->m_aLastColorBottomLeft = aColorBottomLeft;
|
pBlendFrameCache->m_aLastColorBottomLeft = rColorBottomLeft;
|
||||||
pBlendFrameCache->m_aLastResult.Clear();
|
pBlendFrameCache->m_aLastResult.Clear();
|
||||||
|
|
||||||
const tools::Long nW(rSize.Width());
|
const tools::Long nW(rSize.Width());
|
||||||
|
@ -1098,15 +1098,15 @@ BitmapEx createAlphaBlendFrame(
|
||||||
Scanline pScanAlpha = pContent->GetScanline( 0 );
|
Scanline pScanAlpha = pContent->GetScanline( 0 );
|
||||||
|
|
||||||
// x == 0, y == 0, top-left corner
|
// x == 0, y == 0, top-left corner
|
||||||
pContent->SetPixelOnData(pScanContent, 0, aColorTopLeft);
|
pContent->SetPixelOnData(pScanContent, 0, rColorTopLeft);
|
||||||
pAlpha->SetPixelOnData(pScanAlpha, 0, BitmapColor(nAlpha));
|
pAlpha->SetPixelOnData(pScanAlpha, 0, BitmapColor(nAlpha));
|
||||||
|
|
||||||
// y == 0, top line left to right
|
// y == 0, top line left to right
|
||||||
for(x = 1; x < nW - 1; x++)
|
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);
|
pContent->SetPixelOnData(pScanContent, x, aMix);
|
||||||
pAlpha->SetPixelOnData(pScanAlpha, x, BitmapColor(nAlpha));
|
pAlpha->SetPixelOnData(pScanAlpha, x, BitmapColor(nAlpha));
|
||||||
}
|
}
|
||||||
|
@ -1115,7 +1115,7 @@ BitmapEx createAlphaBlendFrame(
|
||||||
// #i123690# Caution! When nW is 1, x == nW is possible (!)
|
// #i123690# Caution! When nW is 1, x == nW is possible (!)
|
||||||
if(x < nW)
|
if(x < nW)
|
||||||
{
|
{
|
||||||
pContent->SetPixelOnData(pScanContent, x, aColorTopRight);
|
pContent->SetPixelOnData(pScanContent, x, rColorTopRight);
|
||||||
pAlpha->SetPixelOnData(pScanAlpha, x, BitmapColor(nAlpha));
|
pAlpha->SetPixelOnData(pScanAlpha, x, BitmapColor(nAlpha));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1124,18 +1124,18 @@ BitmapEx createAlphaBlendFrame(
|
||||||
{
|
{
|
||||||
pScanContent = pContent->GetScanline( y );
|
pScanContent = pContent->GetScanline( y );
|
||||||
pScanAlpha = 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);
|
pContent->SetPixelOnData(pScanContent, 0, aMixA);
|
||||||
pAlpha->SetPixelOnData(pScanAlpha, 0, BitmapColor(nAlpha));
|
pAlpha->SetPixelOnData(pScanAlpha, 0, BitmapColor(nAlpha));
|
||||||
|
|
||||||
// #i123690# Caution! When nW is 1, x == nW is possible (!)
|
// #i123690# Caution! When nW is 1, x == nW is possible (!)
|
||||||
if(x < nW)
|
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);
|
pContent->SetPixelOnData(pScanContent, x, aMixB);
|
||||||
pAlpha->SetPixelOnData(pScanAlpha, x, BitmapColor(nAlpha));
|
pAlpha->SetPixelOnData(pScanAlpha, x, BitmapColor(nAlpha));
|
||||||
}
|
}
|
||||||
|
@ -1145,15 +1145,15 @@ BitmapEx createAlphaBlendFrame(
|
||||||
if(y < nH)
|
if(y < nH)
|
||||||
{
|
{
|
||||||
// x == 0, y == nH - 1, bottom-left corner
|
// x == 0, y == nH - 1, bottom-left corner
|
||||||
pContent->SetPixelOnData(pScanContent, 0, aColorBottomLeft);
|
pContent->SetPixelOnData(pScanContent, 0, rColorBottomLeft);
|
||||||
pAlpha->SetPixelOnData(pScanAlpha, 0, BitmapColor(nAlpha));
|
pAlpha->SetPixelOnData(pScanAlpha, 0, BitmapColor(nAlpha));
|
||||||
|
|
||||||
// y == nH - 1, bottom line left to right
|
// y == nH - 1, bottom line left to right
|
||||||
for(x = 1; x < nW - 1; x++)
|
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);
|
pContent->SetPixelOnData(pScanContent, x, aMix);
|
||||||
pAlpha->SetPixelOnData(pScanAlpha, x, BitmapColor(nAlpha));
|
pAlpha->SetPixelOnData(pScanAlpha, x, BitmapColor(nAlpha));
|
||||||
}
|
}
|
||||||
|
@ -1162,7 +1162,7 @@ BitmapEx createAlphaBlendFrame(
|
||||||
// #i123690# Caution! When nW is 1, x == nW is possible (!)
|
// #i123690# Caution! When nW is 1, x == nW is possible (!)
|
||||||
if(x < nW)
|
if(x < nW)
|
||||||
{
|
{
|
||||||
pContent->SetPixelOnData(pScanContent, x, aColorBottomRight);
|
pContent->SetPixelOnData(pScanContent, x, rColorBottomRight);
|
||||||
pAlpha->SetPixelOnData(pScanAlpha, x, BitmapColor(nAlpha));
|
pAlpha->SetPixelOnData(pScanAlpha, x, BitmapColor(nAlpha));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue