diff options
author | Armin Le Grand <alg@apache.org> | 2014-01-15 15:27:52 +0000 |
---|---|---|
committer | Armin Le Grand <alg@apache.org> | 2014-01-15 15:27:52 +0000 |
commit | f3263e7b8bfe740f8e1e7825214e3936cc938ea9 (patch) | |
tree | de08e9aef5a481b7dc3d2cccacd492f90408437b /vcl/source | |
parent | 5c1be8b527783b7e72c82d0cf8c3474f80d26ce4 (diff) |
i123690 handle the extremes Width or Height equal one
Notes
Notes:
merged as: e7d5f5e3f0941ff2f0311845e84da87d7477c7b0
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/gdi/bitmapex.cxx | 74 |
1 files changed, 47 insertions, 27 deletions
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx index d23946e25a29..bc7c95d07f77 100644 --- a/vcl/source/gdi/bitmapex.cxx +++ b/vcl/source/gdi/bitmapex.cxx @@ -1251,53 +1251,73 @@ BitmapEx VCL_DLLPUBLIC createBlendFrame( long x(0); long y(0); - // x == 0, y == 0 - pContent->SetPixel(y, x, aColorTopLeft); - pAlpha->SetPixelIndex(y, x, nAlpha); + // x == 0, y == 0, top-left corner + pContent->SetPixel(0, 0, aColorTopLeft); + pAlpha->SetPixelIndex(0, 0, nAlpha); - for(x = 1; x < nW - 1; x++) // y == 0 + // y == 0, top line left to right + for(x = 1; x < nW - 1; x++) { Color aMix(aColorTopLeft); aMix.Merge(aColorTopRight, 255 - sal_uInt8((x * 255) / nW)); - pContent->SetPixel(y, x, aMix); - pAlpha->SetPixelIndex(y, x, nAlpha); + pContent->SetPixel(0, x, aMix); + pAlpha->SetPixelIndex(0, x, nAlpha); } - // x == nW - 1, y == 0 - pContent->SetPixel(y, x, aColorTopRight); - pAlpha->SetPixelIndex(y, x, nAlpha); + // x == nW - 1, y == 0, top-right corner + // #123690# Caution! When nW is 1, x == nW is possible (!) + if(x < nW) + { + pContent->SetPixel(0, x, aColorTopRight); + pAlpha->SetPixelIndex(0, x, nAlpha); + } - for(y = 1; y < nH - 1; y++) // x == 0 and nW - 1 + // x == 0 and nW - 1, left and right line top-down + for(y = 1; y < nH - 1; y++) { Color aMixA(aColorTopLeft); - Color aMixB(aColorTopRight); aMixA.Merge(aColorBottomLeft, 255 - sal_uInt8((y * 255) / nH)); pContent->SetPixel(y, 0, aMixA); pAlpha->SetPixelIndex(y, 0, nAlpha); - aMixB.Merge(aColorBottomRight, 255 - sal_uInt8((y * 255) / nH)); - pContent->SetPixel(y, nW - 1, aMixB); - pAlpha->SetPixelIndex(y, nW - 1, nAlpha); - } + // #123690# Caution! When nW is 1, x == nW is possible (!) + if(x < nW) + { + Color aMixB(aColorTopRight); - x = 0; // x == 0, y == nH - 1 - pContent->SetPixel(y, x, aColorBottomLeft); - pAlpha->SetPixelIndex(y, x, nAlpha); + aMixB.Merge(aColorBottomRight, 255 - sal_uInt8((y * 255) / nH)); + pContent->SetPixel(y, x, aMixB); + pAlpha->SetPixelIndex(y, x, nAlpha); + } + } - for(x = 1; x < nW - 1; x++) // y == nH - 1 + // #123690# Caution! When nH is 1, y == nH is possible (!) + if(y < nH) { - Color aMix(aColorBottomLeft); + // x == 0, y == nH - 1, bottom-left corner + pContent->SetPixel(y, 0, aColorBottomLeft); + pAlpha->SetPixelIndex(y, 0, nAlpha); - aMix.Merge(aColorBottomRight, 255 - sal_uInt8(((x - 0)* 255) / nW)); - pContent->SetPixel(y, x, aMix); - pAlpha->SetPixelIndex(y, x, nAlpha); - } + // y == nH - 1, bottom line left to right + for(x = 1; x < nW - 1; x++) + { + Color aMix(aColorBottomLeft); + + aMix.Merge(aColorBottomRight, 255 - sal_uInt8(((x - 0)* 255) / nW)); + pContent->SetPixel(y, x, aMix); + pAlpha->SetPixelIndex(y, x, nAlpha); + } - // x == nW - 1, y == nH - 1 - pContent->SetPixel(y, x, aColorBottomRight); - pAlpha->SetPixelIndex(y, x, nAlpha); + // x == nW - 1, y == nH - 1, bottom-right corner + // #123690# Caution! When nW is 1, x == nW is possible (!) + if(x < nW) + { + pContent->SetPixel(y, x, aColorBottomRight); + pAlpha->SetPixelIndex(y, x, nAlpha); + } + } aContent.ReleaseAccess(pContent); aAlpha.ReleaseAccess(pAlpha); |