vcl: followup to remove unnecessary resets
Followup for 44dfcebde64b9edfa9f50eace34e5e1497ab9314 Just enclose it in the correct scope. Change-Id: I3bb3bfa0fa8bc5996d728f175aad16b64da52166 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180260 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
parent
94d851b27f
commit
f7af54d39a
@ -43,93 +43,92 @@ BlendFrameCache::BlendFrameCache(Size const& rSize, sal_uInt8 nAlpha, Color cons
|
|||||||
|
|
||||||
aContent.Erase(COL_BLACK);
|
aContent.Erase(COL_BLACK);
|
||||||
|
|
||||||
BitmapScopedWriteAccess pContent(aContent);
|
|
||||||
BitmapScopedWriteAccess pAlpha(aAlpha);
|
|
||||||
|
|
||||||
if (!pContent || !pAlpha)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Scanline pScanContent = pContent->GetScanline(0);
|
|
||||||
Scanline pScanAlpha = pContent->GetScanline(0);
|
|
||||||
|
|
||||||
// x == 0, y == 0, top-left corner
|
|
||||||
pContent->SetPixelOnData(pScanContent, 0, rColorTopLeft);
|
|
||||||
pAlpha->SetPixelOnData(pScanAlpha, 0, BitmapColor(nAlpha));
|
|
||||||
|
|
||||||
tools::Long x(0);
|
|
||||||
const tools::Long nW(rSize.Width());
|
|
||||||
|
|
||||||
// y == 0, top line left to right
|
|
||||||
for (x = 1; x < nW - 1; x++)
|
|
||||||
{
|
{
|
||||||
Color aMix(rColorTopLeft);
|
BitmapScopedWriteAccess pContent(aContent);
|
||||||
|
BitmapScopedWriteAccess pAlpha(aAlpha);
|
||||||
|
|
||||||
aMix.Merge(rColorTopRight, 255 - sal_uInt8((x * 255) / nW));
|
if (!pContent || !pAlpha)
|
||||||
pContent->SetPixelOnData(pScanContent, x, aMix);
|
return;
|
||||||
pAlpha->SetPixelOnData(pScanAlpha, x, BitmapColor(nAlpha));
|
|
||||||
}
|
|
||||||
|
|
||||||
// x == nW - 1, y == 0, top-right corner
|
Scanline pScanContent = pContent->GetScanline(0);
|
||||||
// #i123690# Caution! When nW is 1, x == nW is possible (!)
|
Scanline pScanAlpha = pContent->GetScanline(0);
|
||||||
if (x < nW)
|
|
||||||
{
|
|
||||||
pContent->SetPixelOnData(pScanContent, x, rColorTopRight);
|
|
||||||
pAlpha->SetPixelOnData(pScanAlpha, x, BitmapColor(nAlpha));
|
|
||||||
}
|
|
||||||
|
|
||||||
tools::Long y(0);
|
// x == 0, y == 0, top-left corner
|
||||||
const tools::Long nH(rSize.Height());
|
pContent->SetPixelOnData(pScanContent, 0, rColorTopLeft);
|
||||||
|
|
||||||
// x == 0 and nW - 1, left and right line top-down
|
|
||||||
for (y = 1; y < nH - 1; y++)
|
|
||||||
{
|
|
||||||
pScanContent = pContent->GetScanline(y);
|
|
||||||
pScanAlpha = pContent->GetScanline(y);
|
|
||||||
Color aMixA(rColorTopLeft);
|
|
||||||
|
|
||||||
aMixA.Merge(rColorBottomLeft, 255 - sal_uInt8((y * 255) / nH));
|
|
||||||
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 (!)
|
tools::Long x(0);
|
||||||
if (x < nW)
|
const tools::Long nW(rSize.Width());
|
||||||
{
|
|
||||||
Color aMixB(rColorTopRight);
|
|
||||||
|
|
||||||
aMixB.Merge(rColorBottomRight, 255 - sal_uInt8((y * 255) / nH));
|
// y == 0, top line left to right
|
||||||
pContent->SetPixelOnData(pScanContent, x, aMixB);
|
|
||||||
pAlpha->SetPixelOnData(pScanAlpha, x, BitmapColor(nAlpha));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// #i123690# Caution! When nH is 1, y == nH is possible (!)
|
|
||||||
if (y < nH)
|
|
||||||
{
|
|
||||||
// x == 0, y == nH - 1, bottom-left corner
|
|
||||||
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++)
|
for (x = 1; x < nW - 1; x++)
|
||||||
{
|
{
|
||||||
Color aMix(rColorBottomLeft);
|
Color aMix(rColorTopLeft);
|
||||||
|
|
||||||
aMix.Merge(rColorBottomRight, 255 - sal_uInt8(((x - 0) * 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));
|
||||||
}
|
}
|
||||||
|
|
||||||
// x == nW - 1, y == nH - 1, bottom-right corner
|
// x == nW - 1, y == 0, top-right corner
|
||||||
// #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, rColorBottomRight);
|
pContent->SetPixelOnData(pScanContent, x, rColorTopRight);
|
||||||
pAlpha->SetPixelOnData(pScanAlpha, x, BitmapColor(nAlpha));
|
pAlpha->SetPixelOnData(pScanAlpha, x, BitmapColor(nAlpha));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
pContent.reset();
|
tools::Long y(0);
|
||||||
pAlpha.reset();
|
const tools::Long nH(rSize.Height());
|
||||||
|
|
||||||
|
// x == 0 and nW - 1, left and right line top-down
|
||||||
|
for (y = 1; y < nH - 1; y++)
|
||||||
|
{
|
||||||
|
pScanContent = pContent->GetScanline(y);
|
||||||
|
pScanAlpha = pContent->GetScanline(y);
|
||||||
|
Color aMixA(rColorTopLeft);
|
||||||
|
|
||||||
|
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(rColorTopRight);
|
||||||
|
|
||||||
|
aMixB.Merge(rColorBottomRight, 255 - sal_uInt8((y * 255) / nH));
|
||||||
|
pContent->SetPixelOnData(pScanContent, x, aMixB);
|
||||||
|
pAlpha->SetPixelOnData(pScanAlpha, x, BitmapColor(nAlpha));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// #i123690# Caution! When nH is 1, y == nH is possible (!)
|
||||||
|
if (y < nH)
|
||||||
|
{
|
||||||
|
// x == 0, y == nH - 1, bottom-left corner
|
||||||
|
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(rColorBottomLeft);
|
||||||
|
|
||||||
|
aMix.Merge(rColorBottomRight, 255 - sal_uInt8(((x - 0) * 255) / nW));
|
||||||
|
pContent->SetPixelOnData(pScanContent, x, aMix);
|
||||||
|
pAlpha->SetPixelOnData(pScanAlpha, x, BitmapColor(nAlpha));
|
||||||
|
}
|
||||||
|
|
||||||
|
// x == nW - 1, y == nH - 1, bottom-right corner
|
||||||
|
// #i123690# Caution! When nW is 1, x == nW is possible (!)
|
||||||
|
if (x < nW)
|
||||||
|
{
|
||||||
|
pContent->SetPixelOnData(pScanContent, x, rColorBottomRight);
|
||||||
|
pAlpha->SetPixelOnData(pScanAlpha, x, BitmapColor(nAlpha));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_aLastResult = BitmapEx(aContent, aAlpha);
|
m_aLastResult = BitmapEx(aContent, aAlpha);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user