diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2018-01-30 20:40:19 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-06 07:39:11 +0100 |
commit | 3e0efdb50cd9bcf1749993607330ea1567eb33a2 (patch) | |
tree | c740dfc9b598480d5168282154045bbc938f6862 /svx | |
parent | f38e35338e3010f137d7b35fa3150792fabfa825 (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 'svx')
-rw-r--r-- | svx/source/svdraw/svdfmtf.cxx | 6 | ||||
-rw-r--r-- | svx/source/svdraw/svdoashp.cxx | 3 | ||||
-rw-r--r-- | svx/source/xoutdev/_xoutbmp.cxx | 5 |
3 files changed, 9 insertions, 5 deletions
diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx index d8cc89375e49..28fbb9635725 100644 --- a/svx/source/svdraw/svdfmtf.cxx +++ b/svx/source/svdraw/svdfmtf.cxx @@ -1585,12 +1585,13 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaFloatTransparentAction const & rAct) for(long y(0); y < pOld->Height(); y++) { + Scanline pScanline = pOld->GetScanline( y ); for(long x(0); x < pOld->Width(); x++) { const double fOpOld(1.0 - (pOld->GetPixel(y, x).GetIndex() * fFactor)); const sal_uInt8 aCol(basegfx::fround((1.0 - (fOpOld * fOpNew)) * 255.0)); - pOld->SetPixel(y, x, BitmapColor(aCol)); + pOld->SetPixelOnData(pScanline, x, BitmapColor(aCol)); } } } @@ -1604,13 +1605,14 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaFloatTransparentAction const & rAct) { for(long y(0); y < pOld->Height(); y++) { + Scanline pScanline = pOld->GetScanline( y ); for(long x(0); x < pOld->Width(); x++) { const double fOpOld(1.0 - (pOld->GetPixel(y, x).GetIndex() * fFactor)); const double fOpNew(1.0 - (pNew->GetPixel(y, x).GetIndex() * fFactor)); const sal_uInt8 aCol(basegfx::fround((1.0 - (fOpOld * fOpNew)) * 255.0)); - pOld->SetPixel(y, x, BitmapColor(aCol)); + pOld->SetPixelOnData(pScanline, x, BitmapColor(aCol)); } } } diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index ab2465689df4..8b5fce92eea2 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -361,6 +361,7 @@ SdrObject* ImpCreateShadowObjectClone(const SdrObject& rOriginal, const SfxItemS { for(long y(0); y < pReadAccess->Height(); y++) { + Scanline pScanline = pWriteAccess->GetScanline( y ); for(long x(0); x < pReadAccess->Width(); x++) { sal_uInt16 nLuminance(static_cast<sal_uInt16>(pReadAccess->GetLuminance(y, x)) + 1); @@ -368,7 +369,7 @@ SdrObject* ImpCreateShadowObjectClone(const SdrObject& rOriginal, const SfxItemS static_cast<sal_uInt8>((nLuminance * static_cast<sal_uInt16>(aShadowColor.GetRed())) >> 8), static_cast<sal_uInt8>((nLuminance * static_cast<sal_uInt16>(aShadowColor.GetGreen())) >> 8), static_cast<sal_uInt8>((nLuminance * static_cast<sal_uInt16>(aShadowColor.GetBlue())) >> 8)); - pWriteAccess->SetPixel(y, x, aDestColor); + pWriteAccess->SetPixelOnData(pScanline, x, aDestColor); } } diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx index 94f8d3f2cc5b..0dae5e1992d8 100644 --- a/svx/source/xoutdev/_xoutbmp.cxx +++ b/svx/source/xoutdev/_xoutbmp.cxx @@ -479,6 +479,7 @@ Bitmap XOutBitmap::DetectEdges( const Bitmap& rBmp, const sal_uInt8 cThreshold ) for( long nY = 0, nY1 = 1, nY2 = 2; nY < nHeight2; nY++, nY1++, nY2++ ) { + Scanline pScanline = pWriteAcc->GetScanline( nY1 ); for( long nX = 0, nXDst = 1, nXTmp; nX < nWidth2; nX++, nXDst++ ) { nXTmp = nX; @@ -498,9 +499,9 @@ Bitmap XOutBitmap::DetectEdges( const Bitmap& rBmp, const sal_uInt8 cThreshold ) nSum2 -= lGray; if( ( nSum1 * nSum1 + nSum2 * nSum2 ) < lThres2 ) - pWriteAcc->SetPixelIndex( nY1, nXDst, nWhitePalIdx ); + pWriteAcc->SetPixelOnData( pScanline, nXDst, BitmapColor(nWhitePalIdx) ); else - pWriteAcc->SetPixelIndex( nY1, nXDst, nBlackPalIdx ); + pWriteAcc->SetPixelOnData( pScanline, nXDst, BitmapColor(nBlackPalIdx) ); } } |