summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-02-07 09:49:10 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-02-07 10:08:30 +0100
commite5012e53b919ae4921d6d35660bde323a6f28417 (patch)
treed0ed24f56e29f5d027e21404696fca441cdd0fc5 /svtools
parentc99527385acf367c748b3dcf3e6a3bb8103f5eee (diff)
use scanline when reading pixel data
extracts code from the innermost part of fairly hot loops And add a GetIndexFromData method to make the call sites a little easier to read. Change-Id: I4ce5c5a687ecdb6982562a0aafce8513d86f9107 Reviewed-on: https://gerrit.libreoffice.org/49337 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/graphic/grfmgr2.cxx10
-rw-r--r--svtools/source/graphic/transformer.cxx3
2 files changed, 8 insertions, 5 deletions
diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx
index 3c3c29b776ba..451365cd7270 100644
--- a/svtools/source/graphic/grfmgr2.cxx
+++ b/svtools/source/graphic/grfmgr2.cxx
@@ -588,12 +588,13 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib
for (int yIn = yStart; yIn <= yEnd; yIn++)
{
+ Scanline pScanlineRead = pReadAccess->GetScanline( yIn );
for (int xIn = xStart; xIn <= xEnd; xIn++)
{
if( pReadAccess->HasPalette() )
- aColor = pReadAccess->GetPaletteColor( pReadAccess->GetPixelIndex( yIn, xIn ) );
+ aColor = pReadAccess->GetPaletteColor( pReadAccess->GetIndexFromData( pScanlineRead, xIn ) );
else
- aColor = pReadAccess->GetPixel( yIn, xIn );
+ aColor = pReadAccess->GetPixelFromData( pScanlineRead, xIn );
aSumRed += aColor.GetRed();
aSumGreen += aColor.GetGreen();
@@ -725,9 +726,10 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib
for (int yIn = yStart; yIn <= yEnd; yIn++)
{
+ Scanline pScanlineRead = pReadAccess->GetScanline( yIn );
for (int xIn = xStart; xIn <= xEnd; xIn++)
{
- aSum += pReadAccess->GetPixel( yIn, xIn ).GetIndex();
+ aSum += pReadAccess->GetPixelFromData( pScanlineRead, xIn ).GetIndex();
aCount++;
}
}
@@ -1495,7 +1497,7 @@ void GraphicManager::ImplAdjust( BitmapEx& rBmpEx, const GraphicAttr& rAttr, Gra
Scanline pScanline = pA->GetScanline( nY );
for( long nX = 0; nX < nWidth; nX++ )
{
- nNewTrans = nTrans + pA->GetPixel( nY, nX ).GetIndex();
+ nNewTrans = nTrans + pA->GetIndexFromData( pScanline, nX );
aAlphaValue.SetIndex( static_cast<sal_uInt8>( ( nNewTrans & 0xffffff00 ) ? 255 : nNewTrans ) );
pA->SetPixelOnData( pScanline, nX, aAlphaValue );
}
diff --git a/svtools/source/graphic/transformer.cxx b/svtools/source/graphic/transformer.cxx
index ead61881da39..17fb3a3f87c6 100644
--- a/svtools/source/graphic/transformer.cxx
+++ b/svtools/source/graphic/transformer.cxx
@@ -55,9 +55,10 @@ void setAlpha( Bitmap& rBitmap, AlphaMask& rAlpha, sal_uInt8 cIndexFrom, sal_Int
for ( long nY = 0; nY < pReadAccess->Height(); nY++ )
{
Scanline pScanline = pWriteAccess->GetScanline( nY );
+ Scanline pScanlineRead = pReadAccess->GetScanline( nY );
for ( long nX = 0; nX < pReadAccess->Width(); nX++ )
{
- const sal_uInt8 cIndex = pReadAccess->GetPixelIndex( nY, nX );
+ const sal_uInt8 cIndex = pReadAccess->GetIndexFromData( pScanlineRead, nX );
if ( cIndex == cIndexFrom )
pWriteAccess->SetPixelOnData( pScanline, nX, BitmapColor(nAlphaTo) );
}