diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2011-09-09 15:43:58 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2011-09-09 17:46:38 +0200 |
commit | 4209a6127d96c61295fad6e8f2c512644aadf850 (patch) | |
tree | 797b2e025bf2d5d710318bdbe60ed624dfdeebee /drawinglayer | |
parent | fd652012ce85b9905c687e5490facba043f40a88 (diff) |
sb140: #i116872# avoid uninitialized RGB values for full-transparency pixels
plus
sb140: #i116872# optimize for nOpacity == 0 (requested by aw)
Diffstat (limited to 'drawinglayer')
-rw-r--r-- | drawinglayer/source/processor3d/zbufferprocessor3d.cxx | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx index 5b6536ea2d28..e2eca1b4000d 100644 --- a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx +++ b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx @@ -62,9 +62,8 @@ namespace if(nWidth && nHeight) { const Size aDestSize(nWidth, nHeight); - sal_uInt8 nInitAlpha(255); Bitmap aContent(aDestSize, 24); - AlphaMask aAlpha(aDestSize, &nInitAlpha); + AlphaMask aAlpha(aDestSize); BitmapWriteAccess* pContent = aContent.AcquireWriteAccess(); BitmapWriteAccess* pAlpha = aAlpha.AcquireWriteAccess(); @@ -99,14 +98,20 @@ namespace } nOpacity = nOpacity / nDivisor; - if(nOpacity) { pContent->SetPixel(y, x, BitmapColor( (sal_uInt8)(nRed / nDivisor), (sal_uInt8)(nGreen / nDivisor), (sal_uInt8)(nBlue / nDivisor))); - pAlpha->SetPixel(y, x, BitmapColor(255 - (sal_uInt8)nOpacity)); + pAlpha->SetPixel( + y, x, + BitmapColor(255 - (sal_uInt8)nOpacity)); + } + else + { + pContent->SetPixel(y, x, BitmapColor(0, 0, 0)); + pAlpha->SetPixel(y, x, BitmapColor(255)); } } } @@ -120,12 +125,8 @@ namespace for(sal_uInt32 x(0L); x < nWidth; x++) { const basegfx::BPixel& rPixel(rRaster.getBPixel(nIndex++)); - - if(rPixel.getOpacity()) - { - pContent->SetPixel(y, x, BitmapColor(rPixel.getRed(), rPixel.getGreen(), rPixel.getBlue())); - pAlpha->SetPixel(y, x, BitmapColor(255 - rPixel.getOpacity())); - } + pContent->SetPixel(y, x, BitmapColor(rPixel.getRed(), rPixel.getGreen(), rPixel.getBlue())); + pAlpha->SetPixel(y, x, BitmapColor(255 - rPixel.getOpacity())); } } } |