summaryrefslogtreecommitdiff
path: root/drawinglayer
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2018-01-30 20:40:19 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-02-06 07:39:11 +0100
commit3e0efdb50cd9bcf1749993607330ea1567eb33a2 (patch)
treec740dfc9b598480d5168282154045bbc938f6862 /drawinglayer
parentf38e35338e3010f137d7b35fa3150792fabfa825 (diff)
convert SetPixel->SetPixelOnData
by extracting out the Y scanline computation from the innermost loop. Inspired by commit 078d01c1b6cb9bbd80aeadc49a71cc817413164c. Change-Id: Ic3c1827c01ed3aec629975749a551c7a68ae4a5e Reviewed-on: https://gerrit.libreoffice.org/48926 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'drawinglayer')
-rw-r--r--drawinglayer/source/primitive2d/sceneprimitive2d.cxx12
1 files changed, 8 insertions, 4 deletions
diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx
index 13a81abbaf19..150c13c58db7 100644
--- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx
@@ -63,6 +63,8 @@ namespace
for(sal_uInt32 y(0); y < nHeight; y++)
{
+ Scanline pScanlineContent = pContent->GetScanline( y );
+ Scanline pScanlineAlpha = pAlpha->GetScanline( y );
for(sal_uInt32 x(0); x < nWidth; x++)
{
sal_uInt16 nRed(0);
@@ -89,11 +91,11 @@ namespace
if(nOpacity)
{
- pContent->SetPixel(y, x, BitmapColor(
+ pContent->SetPixelOnData(pScanlineContent, x, BitmapColor(
static_cast<sal_uInt8>(nRed / nDivisor),
static_cast<sal_uInt8>(nGreen / nDivisor),
static_cast<sal_uInt8>(nBlue / nDivisor)));
- pAlpha->SetPixel(y, x, BitmapColor(255 - static_cast<sal_uInt8>(nOpacity)));
+ pAlpha->SetPixelOnData(pScanlineAlpha, x, BitmapColor(255 - static_cast<sal_uInt8>(nOpacity)));
}
}
}
@@ -104,14 +106,16 @@ namespace
for(sal_uInt32 y(0); y < nHeight; y++)
{
+ Scanline pScanlineContent = pContent->GetScanline( y );
+ Scanline pScanlineAlpha = pAlpha->GetScanline( y );
for(sal_uInt32 x(0); 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->SetPixelOnData(pScanlineContent, x, BitmapColor(rPixel.getRed(), rPixel.getGreen(), rPixel.getBlue()));
+ pAlpha->SetPixelOnData(pScanlineAlpha, x, BitmapColor(255 - rPixel.getOpacity()));
}
}
}