[Libreoffice-commits] core.git: canvas/source emfio/source filter/source forms/source include/vcl sc/source sd/qa svtools/source svx/source vcl/source vcl/workben
Noel Grandin
noel.grandin at collabora.co.uk
Wed Feb 7 09:08:56 UTC 2018
canvas/source/vcl/canvasbitmaphelper.cxx | 3
emfio/source/reader/mtftools.cxx | 21 +++--
filter/source/flash/swfwriter1.cxx | 3
filter/source/graphicfilter/egif/egif.cxx | 3
filter/source/graphicfilter/eps/eps.cxx | 24 ++++--
filter/source/graphicfilter/etiff/etiff.cxx | 14 ++-
filter/source/graphicfilter/ipsd/ipsd.cxx | 3
filter/source/msfilter/msdffimp.cxx | 5 -
filter/source/msfilter/svdfppt.cxx | 6 +
forms/source/component/imgprod.cxx | 18 +++-
include/vcl/bitmapaccess.hxx | 5 +
sc/source/filter/excel/xeescher.cxx | 3
sd/qa/unit/import-tests.cxx | 3
svtools/source/graphic/grfmgr2.cxx | 10 +-
svtools/source/graphic/transformer.cxx | 3
svx/source/svdraw/svdfmtf.cxx | 6 -
svx/source/xoutdev/_xoutbmp.cxx | 29 ++++---
vcl/source/bitmap/BitmapProcessor.cxx | 10 +-
vcl/source/bitmap/BitmapScaleConvolution.cxx | 5 -
vcl/source/bitmap/BitmapSymmetryCheck.cxx | 11 +-
vcl/source/bitmap/bitmapscalesuper.cxx | 6 +
vcl/source/filter/jpeg/JpegWriter.cxx | 11 +-
vcl/source/gdi/alpha.cxx | 5 -
vcl/source/gdi/bitmap.cxx | 100 ++++++++++++++++---------
vcl/source/gdi/bitmap3.cxx | 108 ++++++++++++++++++---------
vcl/source/gdi/bitmap4.cxx | 26 ++++--
vcl/source/gdi/bmpacc.cxx | 3
vcl/source/gdi/dibtools.cxx | 29 ++++---
vcl/source/gdi/impvect.cxx | 10 +-
vcl/source/gdi/octree.cxx | 6 +
vcl/source/gdi/pngwrite.cxx | 30 ++++---
vcl/source/helper/canvasbitmap.cxx | 3
vcl/source/outdev/bitmap.cxx | 7 +
vcl/source/outdev/transparent.cxx | 8 +-
vcl/workben/vcldemo.cxx | 6 +
35 files changed, 349 insertions(+), 194 deletions(-)
New commits:
commit e5012e53b919ae4921d6d35660bde323a6f28417
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Wed Feb 7 09:49:10 2018 +0200
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 at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/canvas/source/vcl/canvasbitmaphelper.cxx b/canvas/source/vcl/canvasbitmaphelper.cxx
index bdb4444016fd..869957546498 100644
--- a/canvas/source/vcl/canvasbitmaphelper.cxx
+++ b/canvas/source/vcl/canvasbitmaphelper.cxx
@@ -156,6 +156,7 @@ namespace vclcanvas
y<aBmpSize.Height() && y<rect.Y2;
++y )
{
+ Scanline pScanlineReadAlpha = pAlphaReadAccess->GetScanline( y );
if( pAlphaReadAccess.get() != nullptr )
{
for( long x=rect.X1;
@@ -165,7 +166,7 @@ namespace vclcanvas
pRes[ nCurrPos++ ] = pReadAccess->GetColor( y, x ).GetRed();
pRes[ nCurrPos++ ] = pReadAccess->GetColor( y, x ).GetGreen();
pRes[ nCurrPos++ ] = pReadAccess->GetColor( y, x ).GetBlue();
- pRes[ nCurrPos++ ] = pAlphaReadAccess->GetPixel( y, x ).GetIndex();
+ pRes[ nCurrPos++ ] = pAlphaReadAccess->GetIndexFromData( pScanlineReadAlpha, x );
}
}
else
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx
index 79f7efc90abd..efbfe52364f7 100644
--- a/emfio/source/reader/mtftools.cxx
+++ b/emfio/source/reader/mtftools.cxx
@@ -1666,17 +1666,22 @@ namespace emfio
const long nWidth(std::min(pR->Width(), pW->Width()));
const long nHeight(std::min(pR->Height(), pW->Height()));
- for(long nY(0); nY < nHeight; nY++) for(long nX(0); nX < nWidth; nX++)
+ for(long nY(0); nY < nHeight; nY++)
{
- const sal_uInt8 nIndR(pR->GetPixelIndex(nY, nX));
- const sal_uInt8 nIndW(pW->GetPixelIndex(nY, nX));
+ Scanline pScanlineR = pR->GetScanline( nY );
+ Scanline pScanlineW = pW->GetScanline( nY );
+ for(long nX(0); nX < nWidth; nX++)
+ {
+ const sal_uInt8 nIndR(pR->GetIndexFromData(pScanlineR, nX));
+ const sal_uInt8 nIndW(pW->GetIndexFromData(pScanlineW, nX));
- // these values represent transparency (0 == no, 255 == fully transparent),
- // so to blend these we have to multiply the inverse (opacity)
- // and re-invert the result to transparence
- const sal_uInt8 nCombined(0x00ff - (((0x00ff - nIndR) * (0x00ff - nIndW)) >> 8));
+ // these values represent transparency (0 == no, 255 == fully transparent),
+ // so to blend these we have to multiply the inverse (opacity)
+ // and re-invert the result to transparence
+ const sal_uInt8 nCombined(0x00ff - (((0x00ff - nIndR) * (0x00ff - nIndW)) >> 8));
- pW->SetPixelIndex(nY, nX, nCombined);
+ pW->SetPixelOnData(pScanlineW, nX, BitmapColor(nCombined));
+ }
}
}
diff --git a/filter/source/flash/swfwriter1.cxx b/filter/source/flash/swfwriter1.cxx
index 908faffb1f9f..7f82c97e8491 100644
--- a/filter/source/flash/swfwriter1.cxx
+++ b/filter/source/flash/swfwriter1.cxx
@@ -733,9 +733,10 @@ void getBitmapData( const BitmapEx& aBmpEx, sal_uInt8*& tgadata, sal_uInt8*& tga
{
for( sal_uInt32 nY = 0; nY < nHeight; nY++ )
{
+ Scanline pScanlineAA = pAAcc->GetScanline( nY );
for( sal_uInt32 nX = 0; nX < nWidth; nX++ )
{
- const sal_uInt8 nAlpha = pAAcc->GetPixel( nY, nX ).GetIndex();
+ const sal_uInt8 nAlpha = pAAcc->GetIndexFromData( pScanlineAA, nX );
const BitmapColor aPixelColor( pRAcc->GetColor( nY, nX ) );
if( nAlpha == 0xff )
diff --git a/filter/source/graphicfilter/egif/egif.cxx b/filter/source/graphicfilter/egif/egif.cxx
index a34632d9061f..17c78bec69f7 100644
--- a/filter/source/graphicfilter/egif/egif.cxx
+++ b/filter/source/graphicfilter/egif/egif.cxx
@@ -506,8 +506,9 @@ void GIFWriter::WriteAccess()
aCompressor.Compress( m_pAcc->GetScanline( nY ), nWidth );
else
{
+ Scanline pScanline = m_pAcc->GetScanline( nY );
for( long nX = 0; nX < nWidth; nX++ )
- pBuffer[ nX ] = m_pAcc->GetPixelIndex( nY, nX );
+ pBuffer[ nX ] = m_pAcc->GetIndexFromData( pScanline, nX );
aCompressor.Compress( pBuffer.get(), nWidth );
}
diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx
index 4afe1f137e5f..01aa15a71dc2 100644
--- a/filter/source/graphicfilter/eps/eps.cxx
+++ b/filter/source/graphicfilter/eps/eps.cxx
@@ -497,6 +497,7 @@ void PSWriter::ImplWriteProlog( const Graphic* pPreview )
{
nCount2 = 0;
char nVal = 0;
+ Scanline pScanline = pAcc->GetScanline( nY );
for ( long nX = 0; nX < aSizeBitmap.Width(); nX++ )
{
if ( !nCount2 )
@@ -506,7 +507,7 @@ void PSWriter::ImplWriteProlog( const Graphic* pPreview )
nCount2 = 312;
}
nVal <<= 1;
- if ( pAcc->GetPixel( nY, nX ) == aBlack )
+ if ( pAcc->GetPixelFromData( pScanline, nX ) == aBlack )
nVal |= 1;
if ( ! ( --nCount ) )
{
@@ -1756,9 +1757,10 @@ void PSWriter::ImplBmp( Bitmap const * pBitmap, Bitmap const * pMaskBitmap, cons
ImplWriteLine( "image" );
for ( long y = 0; y < nHeight; y++ )
{
+ Scanline pScanlineRead = pAcc->GetScanline( y );
for ( long x = 0; x < nWidth; x++ )
{
- ImplWriteHexByte( pAcc->GetPixelIndex( y, x ) );
+ ImplWriteHexByte( pAcc->GetIndexFromData( pScanlineRead, x ) );
}
}
mpPS->WriteUChar( 10 );
@@ -1794,9 +1796,10 @@ void PSWriter::ImplBmp( Bitmap const * pBitmap, Bitmap const * pMaskBitmap, cons
StartCompression();
for ( long y = 0; y < nHeight; y++ )
{
+ Scanline pScanlineRead = pAcc->GetScanline( y );
for ( long x = 0; x < nWidth; x++ )
{
- Compress( pAcc->GetPixelIndex( y, x ) );
+ Compress( pAcc->GetIndexFromData( pScanlineRead, x ) );
}
}
EndCompression();
@@ -1805,9 +1808,10 @@ void PSWriter::ImplBmp( Bitmap const * pBitmap, Bitmap const * pMaskBitmap, cons
{
for ( long y = 0; y < nHeight; y++ )
{
+ Scanline pScanlineRead = pAcc->GetScanline( y );
for ( long x = 0; x < nWidth; x++ )
{
- ImplWriteHexByte( pAcc->GetPixelIndex( y, x ) );
+ ImplWriteHexByte( pAcc->GetIndexFromData( pScanlineRead, x ) );
}
}
}
@@ -1857,9 +1861,10 @@ void PSWriter::ImplBmp( Bitmap const * pBitmap, Bitmap const * pMaskBitmap, cons
StartCompression();
for ( long y = 0; y < nHeight; y++ )
{
+ Scanline pScanlineRead = pAcc->GetScanline( y );
for ( long x = 0; x < nWidth; x++ )
{
- Compress( pAcc->GetPixelIndex( y, x ) );
+ Compress( pAcc->GetIndexFromData( pScanlineRead, x ) );
}
}
EndCompression();
@@ -1868,9 +1873,10 @@ void PSWriter::ImplBmp( Bitmap const * pBitmap, Bitmap const * pMaskBitmap, cons
{
for ( long y = 0; y < nHeight; y++ )
{
+ Scanline pScanlineRead = pAcc->GetScanline( y );
for ( long x = 0; x < nWidth; x++ )
{
- ImplWriteHexByte( pAcc->GetPixelIndex( y, x ) );
+ ImplWriteHexByte( pAcc->GetIndexFromData( pScanlineRead, x ) );
}
}
}
@@ -1904,9 +1910,10 @@ void PSWriter::ImplBmp( Bitmap const * pBitmap, Bitmap const * pMaskBitmap, cons
StartCompression();
for ( long y = 0; y < nHeight; y++ )
{
+ Scanline pScanlineRead = pAcc->GetScanline( y );
for ( long x = 0; x < nWidth; x++ )
{
- const BitmapColor aBitmapColor( pAcc->GetPixel( y, x ) );
+ const BitmapColor aBitmapColor( pAcc->GetPixelFromData( pScanlineRead, x ) );
Compress( aBitmapColor.GetRed() );
Compress( aBitmapColor.GetGreen() );
Compress( aBitmapColor.GetBlue() );
@@ -1918,9 +1925,10 @@ void PSWriter::ImplBmp( Bitmap const * pBitmap, Bitmap const * pMaskBitmap, cons
{
for ( long y = 0; y < nHeight; y++ )
{
+ Scanline pScanline = pAcc->GetScanline( y );
for ( long x = 0; x < nWidth; x++ )
{
- const BitmapColor aBitmapColor( pAcc->GetPixel( y, x ) );
+ const BitmapColor aBitmapColor( pAcc->GetPixelFromData( pScanline, x ) );
ImplWriteHexByte( aBitmapColor.GetRed() );
ImplWriteHexByte( aBitmapColor.GetGreen() );
ImplWriteHexByte( aBitmapColor.GetBlue() );
diff --git a/filter/source/graphicfilter/etiff/etiff.cxx b/filter/source/graphicfilter/etiff/etiff.cxx
index 6b21e39b90a7..07d0fca42cd1 100644
--- a/filter/source/graphicfilter/etiff/etiff.cxx
+++ b/filter/source/graphicfilter/etiff/etiff.cxx
@@ -356,9 +356,10 @@ void TIFFWriter::ImplWriteBody()
for ( y = 0; y < mnHeight; y++, mnCurAllPictHeight++ )
{
ImplCallback( 100 * mnCurAllPictHeight / mnSumOfAllPictHeight );
+ Scanline pScanline = mpAcc->GetScanline( y );
for ( x = 0; x < mnWidth; x++ )
{
- const BitmapColor& rColor = mpAcc->GetPixel( y, x );
+ const BitmapColor& rColor = mpAcc->GetPixelFromData( pScanline, x );
Compress( rColor.GetRed() );
Compress( rColor.GetGreen() );
Compress( rColor.GetBlue() );
@@ -372,9 +373,10 @@ void TIFFWriter::ImplWriteBody()
for ( y = 0; y < mnHeight; y++, mnCurAllPictHeight++ )
{
ImplCallback( 100 * mnCurAllPictHeight / mnSumOfAllPictHeight );
+ Scanline pScanline = mpAcc->GetScanline( y );
for ( x = 0; x < mnWidth; x++ )
{
- Compress( mpAcc->GetPixelIndex( y, x ) );
+ Compress( mpAcc->GetIndexFromData( pScanline, x ) );
}
}
}
@@ -385,12 +387,13 @@ void TIFFWriter::ImplWriteBody()
for ( nShift = 0, y = 0; y < mnHeight; y++, mnCurAllPictHeight++ )
{
ImplCallback( 100 * mnCurAllPictHeight / mnSumOfAllPictHeight );
+ Scanline pScanline = mpAcc->GetScanline( y );
for ( x = 0; x < mnWidth; x++, nShift++ )
{
if (!( nShift & 1 ))
- nTemp = ( mpAcc->GetPixelIndex( y, x ) << 4 );
+ nTemp = ( mpAcc->GetIndexFromData( pScanline, x ) << 4 );
else
- Compress( static_cast<sal_uInt8>( nTemp | ( mpAcc->GetPixelIndex( y, x ) & 0xf ) ) );
+ Compress( static_cast<sal_uInt8>( nTemp | ( mpAcc->GetIndexFromData( pScanline, x ) & 0xf ) ) );
}
if ( nShift & 1 )
Compress( nTemp );
@@ -404,10 +407,11 @@ void TIFFWriter::ImplWriteBody()
for ( y = 0; y < mnHeight; y++, mnCurAllPictHeight++ )
{
ImplCallback( 100 * mnCurAllPictHeight / mnSumOfAllPictHeight );
+ Scanline pScanline = mpAcc->GetScanline( y );
for ( x = 0; x < mnWidth; x++)
{
j <<= 1;
- j |= ( ( ~mpAcc->GetPixelIndex( y, x ) ) & 1 );
+ j |= ( ( ~mpAcc->GetIndexFromData( pScanline, x ) ) & 1 );
if ( j & 0x100 )
{
Compress( static_cast<sal_uInt8>(j) );
diff --git a/filter/source/graphicfilter/ipsd/ipsd.cxx b/filter/source/graphicfilter/ipsd/ipsd.cxx
index f8f53ccfaf1f..3d484621596e 100644
--- a/filter/source/graphicfilter/ipsd/ipsd.cxx
+++ b/filter/source/graphicfilter/ipsd/ipsd.cxx
@@ -673,11 +673,12 @@ bool PSDReader::ImplReadBody()
for ( nY = 0; nY < mpFileHeader->nRows; nY++ )
{
Scanline pScanline = mpWriteAcc->GetScanline( nY );
+ Scanline pScanlineRead = mpReadAcc->GetScanline( nY );
for ( nX = 0; nX < mpFileHeader->nColumns; nX++ )
{
sal_Int32 nDAT = pBlack[ nX + nY * mpFileHeader->nColumns ] * ( nBlackMax - 256 ) / 0x1ff;
- aBitmapColor = mpReadAcc->GetPixel( nY, nX );
+ aBitmapColor = mpReadAcc->GetPixelFromData( pScanlineRead, nX );
sal_uInt8 cR = static_cast<sal_uInt8>(MinMax( aBitmapColor.GetRed() - nDAT, 0L, 255L ));
sal_uInt8 cG = static_cast<sal_uInt8>(MinMax( aBitmapColor.GetGreen() - nDAT, 0L, 255L ));
sal_uInt8 cB = static_cast<sal_uInt8>(MinMax( aBitmapColor.GetBlue() - nDAT, 0L, 255L ));
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 04864986d674..ffd6cfda2ef0 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -1378,13 +1378,14 @@ void DffPropertyReader::ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, co
for (long y = 0; y < pWrite->Height(); ++y)
{
Scanline pScanline = pWrite->GetScanline(y);
+ Scanline pScanlineRead = pRead->GetScanline( y );
for (long x = 0; x < pWrite->Width(); ++x)
{
Color aReadColor;
if (pRead->HasPalette())
- aReadColor = pRead->GetPaletteColor(pRead->GetPixelIndex(y, x)).GetColor();
+ aReadColor = pRead->GetPaletteColor(pRead->GetIndexFromData(pScanlineRead, x)).GetColor();
else
- aReadColor = pRead->GetPixel(y, x).GetColor();
+ aReadColor = pRead->GetPixelFromData(pScanlineRead, x).GetColor();
if (aReadColor.GetColor() == 0)
pWrite->SetPixelOnData(pScanline, x, aCol2);
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 3e03e069c161..892576367cc2 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -5686,9 +5686,10 @@ void PPTPortionObj::ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, T
{
for( long nY = 0; nY < nHeight; nY++ )
{
+ Scanline pScanline = pAcc->GetScanline( nY );
for( long nX = 0; nX < nWidth; nX++ )
{
- const BitmapColor& rCol = pAcc->GetPaletteColor( pAcc->GetPixelIndex( nY, nX ) );
+ const BitmapColor& rCol = pAcc->GetPaletteColor( pAcc->GetIndexFromData( pScanline, nX ) );
nRt+=rCol.GetRed(); nGn+=rCol.GetGreen(); nBl+=rCol.GetBlue();
}
}
@@ -5697,9 +5698,10 @@ void PPTPortionObj::ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, T
{
for( long nY = 0; nY < nHeight; nY++ )
{
+ Scanline pScanline = pAcc->GetScanline( nY );
for( long nX = 0; nX < nWidth; nX++ )
{
- const BitmapColor aCol( pAcc->GetPixel( nY, nX ) );
+ const BitmapColor aCol( pAcc->GetPixelFromData( pScanline, nX ) );
nRt+=aCol.GetRed(); nGn+=aCol.GetGreen(); nBl+=aCol.GetBlue();
}
}
diff --git a/forms/source/component/imgprod.cxx b/forms/source/component/imgprod.cxx
index 44cb05d36715..40bfe13b78bb 100644
--- a/forms/source/component/imgprod.cxx
+++ b/forms/source/component/imgprod.cxx
@@ -437,13 +437,15 @@ void ImageProducer::ImplUpdateConsumer( const Graphic& rGraphic )
for( long nY = nStartY; nY <= nEndY; nY++ )
{
+ Scanline pScanlineMask = pMskAcc->GetScanline( nY );
+ Scanline pScanline = pBmpAcc->GetScanline( nY );
for( long nX = nStartX; nX <= nEndX; nX++ )
{
- if( pMskAcc->GetPixel( nY, nX ) == aWhite )
+ if( pMskAcc->GetPixelFromData( pScanlineMask, nX ) == aWhite )
*pTmp++ = sal::static_int_cast< sal_Int8 >(
mnTransIndex );
else
- *pTmp++ = pBmpAcc->GetPixel( nY, nX ).GetIndex();
+ *pTmp++ = pBmpAcc->GetPixelFromData( pScanline, nX ).GetIndex();
}
}
@@ -458,12 +460,14 @@ void ImageProducer::ImplUpdateConsumer( const Graphic& rGraphic )
for( long nY = nStartY; nY <= nEndY; nY++ )
{
+ Scanline pScanlineMask = pMskAcc->GetScanline( nY );
+ Scanline pScanline = pBmpAcc->GetScanline( nY );
for( long nX = nStartX; nX <= nEndX; nX++ )
{
- if( pMskAcc->GetPixel( nY, nX ) == aWhite )
+ if( pMskAcc->GetPixelFromData( pScanlineMask, nX ) == aWhite )
*pTmp++ = mnTransIndex;
else
- *pTmp++ = pBmpAcc->GetPixel( nY, nX ).GetIndex();
+ *pTmp++ = pBmpAcc->GetPixelFromData( pScanline, nX ).GetIndex();
}
}
@@ -480,15 +484,17 @@ void ImageProducer::ImplUpdateConsumer( const Graphic& rGraphic )
for( long nY = nStartY; nY <= nEndY; nY++ )
{
+ Scanline pScanlineMask = pMskAcc->GetScanline( nY );
+ Scanline pScanline = pBmpAcc->GetScanline( nY );
for( long nX = nStartX; nX <= nEndX; nX++, pTmp++ )
{
- const BitmapColor aCol( pBmpAcc->GetPixel( nY, nX ) );
+ const BitmapColor aCol( pBmpAcc->GetPixelFromData( pScanline, nX ) );
*pTmp = static_cast<sal_Int32>(aCol.GetRed()) << 24;
*pTmp |= static_cast<sal_Int32>(aCol.GetGreen()) << 16;
*pTmp |= static_cast<sal_Int32>(aCol.GetBlue()) << 8;
- if( pMskAcc->GetPixel( nY, nX ) != aWhite )
+ if( pMskAcc->GetPixelFromData( pScanlineMask, nX ) != aWhite )
*pTmp |= 0x000000ffUL;
}
}
diff --git a/include/vcl/bitmapaccess.hxx b/include/vcl/bitmapaccess.hxx
index 5ae64f8193cc..37eaef6dcda9 100644
--- a/include/vcl/bitmapaccess.hxx
+++ b/include/vcl/bitmapaccess.hxx
@@ -189,6 +189,11 @@ public:
return mFncGetPixel( pData, nX, maColorMask );
}
+ sal_uInt8 GetIndexFromData(const sal_uInt8* pData, long nX) const
+ {
+ return GetPixelFromData( pData, nX ).GetIndex();
+ }
+
void SetPixelOnData(sal_uInt8* pData, long nX, const BitmapColor& rBitmapColor)
{
assert(pData && "Access is not valid!");
diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx
index 93f9bb047cf9..1e51b864bb70 100644
--- a/sc/source/filter/excel/xeescher.cxx
+++ b/sc/source/filter/excel/xeescher.cxx
@@ -428,9 +428,10 @@ void XclExpImgData::Save( XclExpStream& rStrm )
for( sal_Int32 nY = nHeight - 1; nY >= 0; --nY )
{
+ Scanline pScanline = pAccess->GetScanline( nY );
for( sal_Int32 nX = 0; nX < nWidth; ++nX )
{
- const BitmapColor& rBmpColor = pAccess->GetPixel( nY, nX );
+ const BitmapColor& rBmpColor = pAccess->GetPixelFromData( pScanline, nX );
rStrm << rBmpColor.GetBlue() << rBmpColor.GetGreen() << rBmpColor.GetRed();
}
rStrm.WriteZeroBytes( nPadding );
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 9549076902e4..c54989eff192 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -1856,9 +1856,10 @@ bool checkPatternValues(std::vector<sal_uInt8>& rExpected, Bitmap& rBitmap)
Bitmap::ScopedReadAccess pAccess(rBitmap);
for (long y = 0; y < pAccess->Height(); ++y)
{
+ Scanline pScanline = pAccess->GetScanline( y );
for (long x = 0; x < pAccess->Width(); ++x)
{
- Color aColor = pAccess->GetPixel(y, x).GetColor();
+ Color aColor = pAccess->GetPixelFromData(pScanline, x).GetColor();
sal_uInt8 aValue = rExpected[y*8+x];
if (aValue == 1 && aColor != aFGColor)
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) );
}
diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx
index 28fbb9635725..9197c1f7eea4 100644
--- a/svx/source/svdraw/svdfmtf.cxx
+++ b/svx/source/svdraw/svdfmtf.cxx
@@ -1588,7 +1588,7 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaFloatTransparentAction const & rAct)
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 fOpOld(1.0 - (pOld->GetIndexFromData(pScanline, x) * fFactor));
const sal_uInt8 aCol(basegfx::fround((1.0 - (fOpOld * fOpNew)) * 255.0));
pOld->SetPixelOnData(pScanline, x, BitmapColor(aCol));
@@ -1608,8 +1608,8 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaFloatTransparentAction const & rAct)
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 double fOpOld(1.0 - (pOld->GetIndexFromData(pScanline, x) * fFactor));
+ const double fOpNew(1.0 - (pNew->GetIndexFromData(pScanline, x) * fFactor));
const sal_uInt8 aCol(basegfx::fround((1.0 - (fOpOld * fOpNew)) * 255.0));
pOld->SetPixelOnData(pScanline, x, BitmapColor(aCol));
diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx
index 0dae5e1992d8..f1d4458ef517 100644
--- a/svx/source/xoutdev/_xoutbmp.cxx
+++ b/svx/source/xoutdev/_xoutbmp.cxx
@@ -480,22 +480,25 @@ 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 );
+ Scanline pScanlineRead = pReadAcc->GetScanline( nY );
+ Scanline pScanlineRead1 = pReadAcc->GetScanline( nY1 );
+ Scanline pScanlineRead2 = pReadAcc->GetScanline( nY2 );
for( long nX = 0, nXDst = 1, nXTmp; nX < nWidth2; nX++, nXDst++ )
{
nXTmp = nX;
- nSum1 = -( nSum2 = lGray = pReadAcc->GetPixelIndex( nY, nXTmp++ ) );
- nSum2 += static_cast<long>(pReadAcc->GetPixelIndex( nY, nXTmp++ )) << 1;
- nSum1 += ( lGray = pReadAcc->GetPixelIndex( nY, nXTmp ) );
+ nSum1 = -( nSum2 = lGray = pReadAcc->GetIndexFromData( pScanlineRead, nXTmp++ ) );
+ nSum2 += static_cast<long>(pReadAcc->GetIndexFromData( pScanlineRead, nXTmp++ )) << 1;
+ nSum1 += ( lGray = pReadAcc->GetIndexFromData( pScanlineRead, nXTmp ) );
nSum2 += lGray;
- nSum1 += static_cast<long>(pReadAcc->GetPixelIndex( nY1, nXTmp )) << 1;
- nSum1 -= static_cast<long>(pReadAcc->GetPixelIndex( nY1, nXTmp -= 2 )) << 1;
+ nSum1 += static_cast<long>(pReadAcc->GetIndexFromData( pScanlineRead1, nXTmp )) << 1;
+ nSum1 -= static_cast<long>(pReadAcc->GetIndexFromData( pScanlineRead1, nXTmp -= 2 )) << 1;
- nSum1 += ( lGray = -static_cast<long>(pReadAcc->GetPixelIndex( nY2, nXTmp++ )) );
+ nSum1 += ( lGray = -static_cast<long>(pReadAcc->GetIndexFromData( pScanlineRead2, nXTmp++ )) );
nSum2 += lGray;
- nSum2 -= static_cast<long>(pReadAcc->GetPixelIndex( nY2, nXTmp++ )) << 1;
- nSum1 += ( lGray = static_cast<long>(pReadAcc->GetPixelIndex( nY2, nXTmp )) );
+ nSum2 -= static_cast<long>(pReadAcc->GetIndexFromData( pScanlineRead2, nXTmp++ )) << 1;
+ nSum1 += ( lGray = static_cast<long>(pReadAcc->GetIndexFromData( pScanlineRead2, nXTmp )) );
nSum2 -= lGray;
if( ( nSum1 * nSum1 + nSum2 * nSum2 ) < lThres2 )
@@ -583,7 +586,8 @@ tools::Polygon XOutBitmap::GetContour( const Bitmap& rBmp, const XOutFlags nFlag
// scan row from left to right
while( nY < nEndY1 )
{
- if( aBlack == pAcc->GetPixel( nY, nX ) )
+ Scanline pScanline = pAcc->GetScanline( nY );
+ if( aBlack == pAcc->GetPixelFromData( pScanline, nX ) )
{
pPoints1[ nPolyPos ] = Point( nX, nY );
nY = nStartY2;
@@ -591,7 +595,7 @@ tools::Polygon XOutBitmap::GetContour( const Bitmap& rBmp, const XOutFlags nFlag
// this loop always breaks eventually as there is at least one pixel
while( true )
{
- if( aBlack == pAcc->GetPixel( nY, nX ) )
+ if( aBlack == pAcc->GetPixelFromData( pScanline, nX ) )
{
pPoints2[ nPolyPos ] = Point( nX, nY );
break;
@@ -616,11 +620,12 @@ tools::Polygon XOutBitmap::GetContour( const Bitmap& rBmp, const XOutFlags nFlag
for ( nY = nStartY1; nY < nEndY1; nY++ )
{
nX = nStartX1;
+ Scanline pScanline = pAcc->GetScanline( nY );
// scan row from left to right
while( nX < nEndX1 )
{
- if( aBlack == pAcc->GetPixel( nY, nX ) )
+ if( aBlack == pAcc->GetPixelFromData( pScanline, nX ) )
{
pPoints1[ nPolyPos ] = Point( nX, nY );
nX = nStartX2;
@@ -628,7 +633,7 @@ tools::Polygon XOutBitmap::GetContour( const Bitmap& rBmp, const XOutFlags nFlag
// this loop always breaks eventually as there is at least one pixel
while( true )
{
- if( aBlack == pAcc->GetPixel( nY, nX ) )
+ if( aBlack == pAcc->GetPixelFromData( pScanline, nX ) )
{
pPoints2[ nPolyPos ] = Point( nX, nY );
break;
diff --git a/vcl/source/bitmap/BitmapProcessor.cxx b/vcl/source/bitmap/BitmapProcessor.cxx
index 470744fbab5c..378191ece8bd 100644
--- a/vcl/source/bitmap/BitmapProcessor.cxx
+++ b/vcl/source/bitmap/BitmapProcessor.cxx
@@ -28,11 +28,12 @@ BitmapEx BitmapProcessor::createLightImage(const BitmapEx& rBitmapEx)
for (long nY = 0; nY < aSize.Height(); ++nY)
{
Scanline pScanline = pWrite->GetScanline( nY );
+ Scanline pScanlineRead = pRead->GetScanline( nY );
for (long nX = 0; nX < aSize.Width(); ++nX)
{
BitmapColor aBmpColor = pRead->HasPalette() ?
- pRead->GetPaletteColor(pRead->GetPixelIndex(nY, nX)) :
- pRead->GetPixel(nY, nX);
+ pRead->GetPaletteColor(pRead->GetIndexFromData(pScanlineRead, nX)) :
+ pRead->GetPixelFromData(pScanlineRead, nX);
basegfx::BColor aBColor(Color(aBmpColor.Invert().GetColor()).getBColor());
aBColor = basegfx::utils::rgb2hsl(aBColor);
@@ -96,13 +97,14 @@ BitmapEx BitmapProcessor::createDisabledImage(const BitmapEx& rBitmapEx)
{
Scanline pScanAlpha = pGreyAlpha->GetScanline( nY );
Scanline pScanline = pGrey->GetScanline( nY );
+ Scanline pScanReadAlpha = pReadAlpha->GetScanline( nY );
for (long nX = 0; nX < aSize.Width(); ++nX)
{
const sal_uInt8 nLum(pRead->GetLuminance(nY, nX));
BitmapColor aGreyValue(nLum, nLum, nLum);
pGrey->SetPixelOnData(pScanline, nX, aGreyValue);
- const BitmapColor aBitmapAlphaValue(pReadAlpha->GetPixel(nY, nX));
+ const BitmapColor aBitmapAlphaValue(pReadAlpha->GetPixelFromData(pScanReadAlpha, nX));
aGreyAlphaValue.SetIndex(sal_uInt8(std::min(aBitmapAlphaValue.GetIndex() + 178ul, 255ul)));
pGreyAlpha->SetPixelOnData(pScanAlpha, nX, aGreyAlphaValue);
@@ -203,7 +205,7 @@ void BitmapProcessor::colorizeImage(BitmapEx const & rBitmapEx, Color aColor)
Scanline pScanline = pWriteAccess->GetScanline( nY );
for (nX = 0; nX < nW; ++nX)
{
- aBitmapColor = pWriteAccess->GetPixel(nY, nX);
+ aBitmapColor = pWriteAccess->GetPixelFromData(pScanline, nX);
aBitmapColor.SetRed(aMapR[aBitmapColor.GetRed()]);
aBitmapColor.SetGreen(aMapG[aBitmapColor.GetGreen()]);
aBitmapColor.SetBlue(aMapB[aBitmapColor.GetBlue()]);
diff --git a/vcl/source/bitmap/BitmapScaleConvolution.cxx b/vcl/source/bitmap/BitmapScaleConvolution.cxx
index fca8b2ed161c..cf5f22c9a9c4 100644
--- a/vcl/source/bitmap/BitmapScaleConvolution.cxx
+++ b/vcl/source/bitmap/BitmapScaleConvolution.cxx
@@ -116,6 +116,7 @@ bool ImplScaleConvolutionHor(Bitmap& rSource, Bitmap& rTarget, const double& rSc
for(long y(0); y < nHeight; y++)
{
Scanline pScanline = pWriteAcc->GetScanline( y );
+ Scanline pScanlineRead = pReadAcc->GetScanline( y );
for(long x(0); x < nNewWidth; x++)
{
const long aBaseIndex(x * aNumberOfContributions);
@@ -134,11 +135,11 @@ bool ImplScaleConvolutionHor(Bitmap& rSource, Bitmap& rTarget, const double& rSc
if(pReadAcc->HasPalette())
{
- aColor = pReadAcc->GetPaletteColor(pReadAcc->GetPixelIndex(y, pPixels[aIndex]));
+ aColor = pReadAcc->GetPaletteColor(pReadAcc->GetIndexFromData(pScanlineRead, pPixels[aIndex]));
}
else
{
- aColor = pReadAcc->GetPixel(y, pPixels[aIndex]);
+ aColor = pReadAcc->GetPixelFromData(pScanlineRead, pPixels[aIndex]);
}
aValueRed += aWeight * aColor.GetRed();
diff --git a/vcl/source/bitmap/BitmapSymmetryCheck.cxx b/vcl/source/bitmap/BitmapSymmetryCheck.cxx
index e5db09e463ca..9abb480864e2 100644
--- a/vcl/source/bitmap/BitmapSymmetryCheck.cxx
+++ b/vcl/source/bitmap/BitmapSymmetryCheck.cxx
@@ -35,17 +35,19 @@ bool BitmapSymmetryCheck::checkImpl(BitmapReadAccess const * pReadAccess)
for (long y = 0; y < nHeightHalf; ++y)
{
+ Scanline pScanlineRead = pReadAccess->GetScanline( y );
+ Scanline pScanlineRead2 = pReadAccess->GetScanline( nHeight - y - 1 );
for (long x = 0; x < nWidthHalf; ++x)
{
- if (pReadAccess->GetPixel(y, x) != pReadAccess->GetPixel(nHeight - y - 1, x))
+ if (pReadAccess->GetPixelFromData(pScanlineRead, x) != pReadAccess->GetPixelFromData(pScanlineRead2, x))
{
return false;
}
- if (pReadAccess->GetPixel(y, x) != pReadAccess->GetPixel(y, nWidth - x - 1))
+ if (pReadAccess->GetPixelFromData(pScanlineRead, x) != pReadAccess->GetPixelFromData(pScanlineRead, nWidth - x - 1))
{
return false;
}
- if (pReadAccess->GetPixel(y, x) != pReadAccess->GetPixel(nHeight - y - 1, nWidth - x - 1))
+ if (pReadAccess->GetPixelFromData(pScanlineRead, x) != pReadAccess->GetPixelFromData(pScanlineRead2, nWidth - x - 1))
{
return false;
}
@@ -65,9 +67,10 @@ bool BitmapSymmetryCheck::checkImpl(BitmapReadAccess const * pReadAccess)
if (bHeightEven)
{
+ Scanline pScanlineRead = pReadAccess->GetScanline( nHeightHalf );
for (long x = 0; x < nWidthHalf; ++x)
{
- if (pReadAccess->GetPixel(nHeightHalf, x) != pReadAccess->GetPixel(nHeightHalf, nWidth - x - 1))
+ if (pReadAccess->GetPixelFromData(pScanlineRead, x) != pReadAccess->GetPixelFromData(pScanlineRead, nWidth - x - 1))
{
return false;
}
diff --git a/vcl/source/bitmap/bitmapscalesuper.cxx b/vcl/source/bitmap/bitmapscalesuper.cxx
index 545e18903e84..7fae7a6a8dc0 100644
--- a/vcl/source/bitmap/bitmapscalesuper.cxx
+++ b/vcl/source/bitmap/bitmapscalesuper.cxx
@@ -465,9 +465,10 @@ void scalePalleteGeneral2(ScaleContext &rCtx, long nStartY, long nEndY)
long nSumRowB = 0;
long nTotalWeightX = 0;
+ Scanline pScanlineSrc = rCtx.mpSrc->GetScanline( nLineStart + i );
for(long j = 0; j <= nRowRange; j++)
{
- BitmapColor aCol0 = rCtx.mpSrc->GetPaletteColor ( rCtx.mpSrc->GetPixelIndex( nLineStart + i, nRowStart + j ) );
+ BitmapColor aCol0 = rCtx.mpSrc->GetPaletteColor ( rCtx.mpSrc->GetIndexFromData( pScanlineSrc, nRowStart + j ) );
if(nX == nEndX )
{
@@ -839,9 +840,10 @@ void scaleNonPalleteGeneral2(ScaleContext &rCtx, long nStartY, long nEndY)
long nSumRowB = 0;
long nTotalWeightX = 0;
+ Scanline pScanlineSrc = rCtx.mpSrc->GetScanline( nLineStart + i );
for(long j = 0; j <= nRowRange; j++)
{
- BitmapColor aCol0 = rCtx.mpSrc->GetPixel( nLineStart + i, nRowStart + j );
+ BitmapColor aCol0 = rCtx.mpSrc->GetPixelFromData( pScanlineSrc, nRowStart + j );
if(nX == nEndX )
{
diff --git a/vcl/source/filter/jpeg/JpegWriter.cxx b/vcl/source/filter/jpeg/JpegWriter.cxx
index d5636c53d2ec..f6787145eabf 100644
--- a/vcl/source/filter/jpeg/JpegWriter.cxx
+++ b/vcl/source/filter/jpeg/JpegWriter.cxx
@@ -147,9 +147,10 @@ void* JPEGWriter::GetScanline( long nY )
if( mpReadAccess->HasPalette() )
{
+ Scanline pScanlineRead = mpReadAccess->GetScanline( nY );
for( long nX = 0; nX < nWidth; nX++ )
{
- aColor = mpReadAccess->GetPaletteColor( mpReadAccess->GetPixelIndex( nY, nX ) );
+ aColor = mpReadAccess->GetPaletteColor( mpReadAccess->GetIndexFromData( pScanlineRead, nX ) );
*pTmp++ = aColor.GetRed();
if ( !mbGreys )
{
@@ -160,9 +161,10 @@ void* JPEGWriter::GetScanline( long nY )
}
else
{
+ Scanline pScanlineRead = mpReadAccess->GetScanline( nY );
for( long nX = 0; nX < nWidth; nX++ )
{
- aColor = mpReadAccess->GetPixel( nY, nX );
+ aColor = mpReadAccess->GetPixelFromData( pScanlineRead, nX );
*pTmp++ = aColor.GetRed();
if ( !mbGreys )
{
@@ -207,10 +209,11 @@ bool JPEGWriter::Write( const Graphic& rGraphic )
for ( long nY = 0; bIsGrey && ( nY < mpReadAccess->Height() ); nY++ )
{
BitmapColor aColor;
+ Scanline pScanlineRead = mpReadAccess->GetScanline( nY );
for( long nX = 0; bIsGrey && ( nX < nWidth ); nX++ )
{
- aColor = mpReadAccess->HasPalette() ? mpReadAccess->GetPaletteColor( mpReadAccess->GetPixelIndex( nY, nX ) )
- : mpReadAccess->GetPixel( nY, nX );
+ aColor = mpReadAccess->HasPalette() ? mpReadAccess->GetPaletteColor( mpReadAccess->GetIndexFromData( pScanlineRead, nX ) )
+ : mpReadAccess->GetPixelFromData( pScanlineRead, nX );
bIsGrey = ( aColor.GetRed() == aColor.GetGreen() ) && ( aColor.GetRed() == aColor.GetBlue() );
}
}
diff --git a/vcl/source/gdi/alpha.cxx b/vcl/source/gdi/alpha.cxx
index 49451eea22fa..59ca82c035ff 100644
--- a/vcl/source/gdi/alpha.cxx
+++ b/vcl/source/gdi/alpha.cxx
@@ -100,8 +100,9 @@ bool AlphaMask::Replace( const Bitmap& rMask, sal_uInt8 cReplaceTransparency )
for( long nY = 0; nY < nHeight; nY++ )
{
Scanline pScanline = pAcc->GetScanline(nY);
+ Scanline pScanlineMask = pMaskAcc->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
- if( pMaskAcc->GetPixel( nY, nX ) == aMaskWhite )
+ if( pMaskAcc->GetPixelFromData( pScanlineMask, nX ) == aMaskWhite )
pAcc->SetPixelOnData( pScanline, nX, aReplace );
}
}
@@ -138,7 +139,7 @@ void AlphaMask::Replace( sal_uInt8 cSearchTransparency, sal_uInt8 cReplaceTransp
Scanline pScanline = pAcc->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
{
- if( pAcc->GetPixel( nY, nX ).GetIndex() == cSearchTransparency )
+ if( pAcc->GetIndexFromData( pScanline, nX ) == cSearchTransparency )
pAcc->SetPixelOnData( pScanline, nX, aReplace );
}
}
diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx
index 445ea36954a3..cd28ea2c0a23 100644
--- a/vcl/source/gdi/bitmap.cxx
+++ b/vcl/source/gdi/bitmap.cxx
@@ -478,9 +478,12 @@ bool Bitmap::Invert()
const long nWidth = pAcc->Width();
const long nHeight = pAcc->Height();
- for( long nX = 0; nX < nWidth; nX++ )
- for( long nY = 0; nY < nHeight; nY++ )
- pAcc->SetPixel( nY, nX, pAcc->GetPixel( nY, nX ).Invert() );
+ for( long nY = 0; nY < nHeight; nY++ )
+ {
+ Scanline pScanline = pAcc->GetScanline(nY);
+ for( long nX = 0; nX < nWidth; nX++ )
+ pAcc->SetPixelOnData( pScanline, nX, pAcc->GetPixelFromData( pScanline, nX ).Invert() );
+ }
}
mxImpBmp->ImplInvalidateChecksum();
@@ -513,9 +516,9 @@ bool Bitmap::Mirror( BmpMirrorFlags nMirrorFlags )
Scanline pScanline = pAcc->GetScanline(nY);
for( long nX = 0, nOther = nWidth1; nX < nWidth_2; nX++, nOther-- )
{
- const BitmapColor aTemp( pAcc->GetPixel( nY, nX ) );
+ const BitmapColor aTemp( pAcc->GetPixelFromData( pScanline, nX ) );
- pAcc->SetPixelOnData( pScanline, nX, pAcc->GetPixel( nY, nOther ) );
+ pAcc->SetPixelOnData( pScanline, nX, pAcc->GetPixelFromData( pScanline, nOther ) );
pAcc->SetPixelOnData( pScanline, nOther, aTemp );
}
}
@@ -564,9 +567,9 @@ bool Bitmap::Mirror( BmpMirrorFlags nMirrorFlags )
Scanline pScanlineOther = pAcc->GetScanline(nOtherY);
for( long nX = 0, nOtherX = nWidth1; nX < nWidth; nX++, nOtherX-- )
{
- const BitmapColor aTemp( pAcc->GetPixel( nY, nX ) );
+ const BitmapColor aTemp( pAcc->GetPixelFromData( pScanline, nX ) );
- pAcc->SetPixelOnData( pScanline, nX, pAcc->GetPixel( nOtherY, nOtherX ) );
+ pAcc->SetPixelOnData( pScanline, nX, pAcc->GetPixelFromData( pScanlineOther, nOtherX ) );
pAcc->SetPixelOnData( pScanlineOther, nOtherX, aTemp );
}
}
@@ -577,8 +580,8 @@ bool Bitmap::Mirror( BmpMirrorFlags nMirrorFlags )
Scanline pScanline = pAcc->GetScanline(nHeight_2);
for( long nX = 0, nOtherX = nWidth1, nWidth_2 = nWidth >> 1; nX < nWidth_2; nX++, nOtherX-- )
{
- const BitmapColor aTemp( pAcc->GetPixel( nHeight_2, nX ) );
- pAcc->SetPixelOnData( pScanline, nX, pAcc->GetPixel( nHeight_2, nOtherX ) );
+ const BitmapColor aTemp( pAcc->GetPixelFromData( pScanline, nX ) );
+ pAcc->SetPixelOnData( pScanline, nX, pAcc->GetPixelFromData( pScanline, nOtherX ) );
pAcc->SetPixelOnData( pScanline, nOtherX, aTemp );
}
}
@@ -764,8 +767,9 @@ bool Bitmap::Crop( const tools::Rectangle& rRectPixel )
for( long nY = 0, nY2 = nOldY; nY < nNewHeight; nY++, nY2++ )
{
Scanline pScanline = pWriteAcc->GetScanline(nY);
+ Scanline pScanlineRead = pReadAcc->GetScanline(nY2);
for( long nX = 0, nX2 = nOldX; nX < nNewWidth; nX++, nX2++ )
- pWriteAcc->SetPixelOnData( pScanline, nX, pReadAcc->GetPixel( nY2, nX2 ) );
+ pWriteAcc->SetPixelOnData( pScanline, nX, pReadAcc->GetPixelFromData( pScanlineRead, nX2 ) );
}
pWriteAcc.reset();
@@ -881,8 +885,9 @@ bool Bitmap::CopyPixel( const tools::Rectangle& rRectDst,
for( long nSrcY = aRectSrc.Top(); nSrcY < nSrcEndY; nSrcY++, nDstY++ )
{
Scanline pScanline = pWriteAcc->GetScanline(nDstY);
+ Scanline pScanlineRead = pReadAcc->GetScanline(nSrcY);
for( long nSrcX = aRectSrc.Left(), nDstX = aRectDst.Left(); nSrcX < nSrcEndX; nSrcX++, nDstX++ )
- pWriteAcc->SetPixelOnData( pScanline, nDstX, BitmapColor( pMap[ pReadAcc->GetPixelIndex( nSrcY, nSrcX ) ] ));
+ pWriteAcc->SetPixelOnData( pScanline, nDstX, BitmapColor( pMap[ pReadAcc->GetIndexFromData( pScanlineRead, nSrcX ) ] ));
}
}
else if( pReadAcc->HasPalette() )
@@ -890,16 +895,18 @@ bool Bitmap::CopyPixel( const tools::Rectangle& rRectDst,
for( long nSrcY = aRectSrc.Top(); nSrcY < nSrcEndY; nSrcY++, nDstY++ )
{
Scanline pScanline = pWriteAcc->GetScanline(nDstY);
+ Scanline pScanlineRead = pReadAcc->GetScanline(nSrcY);
for( long nSrcX = aRectSrc.Left(), nDstX = aRectDst.Left(); nSrcX < nSrcEndX; nSrcX++, nDstX++ )
- pWriteAcc->SetPixelOnData( pScanline, nDstX, pReadAcc->GetPaletteColor( pReadAcc->GetPixelIndex( nSrcY, nSrcX ) ) );
+ pWriteAcc->SetPixelOnData( pScanline, nDstX, pReadAcc->GetPaletteColor( pReadAcc->GetIndexFromData( pScanlineRead, nSrcX ) ) );
}
}
else
for( long nSrcY = aRectSrc.Top(); nSrcY < nSrcEndY; nSrcY++, nDstY++ )
{
Scanline pScanline = pWriteAcc->GetScanline(nDstY);
+ Scanline pScanlineRead = pReadAcc->GetScanline(nSrcY);
for( long nSrcX = aRectSrc.Left(), nDstX = aRectDst.Left(); nSrcX < nSrcEndX; nSrcX++, nDstX++ )
- pWriteAcc->SetPixelOnData( pScanline, nDstX, pReadAcc->GetPixel( nSrcY, nSrcX ) );
+ pWriteAcc->SetPixelOnData( pScanline, nDstX, pReadAcc->GetPixelFromData( pScanlineRead, nSrcX ) );
}
pWriteAcc.reset();
@@ -938,8 +945,9 @@ bool Bitmap::CopyPixel( const tools::Rectangle& rRectDst,
for( long nY = nSrcY, nYN = nDstY; nY <= nSrcEndY1; nY++, nYN++ )
{
Scanline pScanline = pWriteAcc->GetScanline(nYN);
+ Scanline pScanlineSrc = pWriteAcc->GetScanline(nY);
for( long nX = nSrcX, nXN = nDstX; nX <= nSrcEndX1; nX++, nXN++ )
- pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixel( nY, nX ) );
+ pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixelFromData( pScanlineSrc, nX ) );
}
}
else if( ( nDstX <= nSrcX ) && ( nDstY >= nSrcY ) )
@@ -947,8 +955,9 @@ bool Bitmap::CopyPixel( const tools::Rectangle& rRectDst,
for( long nY = nSrcEndY1, nYN = nDstEndY1; nY >= nSrcY; nY--, nYN-- )
{
Scanline pScanline = pWriteAcc->GetScanline(nYN);
+ Scanline pScanlineSrc = pWriteAcc->GetScanline(nY);
for( long nX = nSrcX, nXN = nDstX; nX <= nSrcEndX1; nX++, nXN++ )
- pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixel( nY, nX ) );
+ pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixelFromData( pScanlineSrc, nX ) );
}
}
else if( ( nDstX >= nSrcX ) && ( nDstY <= nSrcY ) )
@@ -956,8 +965,9 @@ bool Bitmap::CopyPixel( const tools::Rectangle& rRectDst,
for( long nY = nSrcY, nYN = nDstY; nY <= nSrcEndY1; nY++, nYN++ )
{
Scanline pScanline = pWriteAcc->GetScanline(nYN);
+ Scanline pScanlineSrc = pWriteAcc->GetScanline(nY);
for( long nX = nSrcEndX1, nXN = nDstEndX1; nX >= nSrcX; nX--, nXN-- )
- pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixel( nY, nX ) );
+ pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixelFromData( pScanlineSrc, nX ) );
}
}
else
@@ -965,8 +975,9 @@ bool Bitmap::CopyPixel( const tools::Rectangle& rRectDst,
for( long nY = nSrcEndY1, nYN = nDstEndY1; nY >= nSrcY; nY--, nYN-- )
{
Scanline pScanline = pWriteAcc->GetScanline(nYN);
+ Scanline pScanlineSrc = pWriteAcc->GetScanline(nY);
for( long nX = nSrcEndX1, nXN = nDstEndX1; nX >= nSrcX; nX--, nXN-- )
- pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixel( nY, nX ) );
+ pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixelFromData( pScanlineSrc, nX ) );
}
}
@@ -1020,8 +1031,9 @@ bool Bitmap::CopyPixel_AlphaOptimized( const tools::Rectangle& rRectDst, const t
for( long nSrcY = aRectSrc.Top(); nSrcY < nSrcEndY; nSrcY++, nDstY++)
{
Scanline pScanline = pWriteAcc->GetScanline(nDstY);
+ Scanline pScanlineRead = pReadAcc->GetScanline(nSrcY);
for( long nSrcX = aRectSrc.Left(), nDstX = aRectDst.Left(); nSrcX < nSrcEndX; nSrcX++, nDstX++ )
- pWriteAcc->SetPixelOnData( pScanline, nDstX, pReadAcc->GetPixel( nSrcY, nSrcX ) );
+ pWriteAcc->SetPixelOnData( pScanline, nDstX, pReadAcc->GetPixelFromData( pScanlineRead, nSrcX ) );
}
pWriteAcc.reset();
@@ -1060,8 +1072,9 @@ bool Bitmap::CopyPixel_AlphaOptimized( const tools::Rectangle& rRectDst, const t
for( long nY = nSrcY, nYN = nDstY; nY <= nSrcEndY1; nY++, nYN++ )
{
Scanline pScanline = pWriteAcc->GetScanline(nYN);
+ Scanline pScanlineSrc = pWriteAcc->GetScanline(nY);
for( long nX = nSrcX, nXN = nDstX; nX <= nSrcEndX1; nX++, nXN++ )
- pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixel( nY, nX ) );
+ pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixelFromData( pScanlineSrc, nX ) );
}
}
else if( ( nDstX <= nSrcX ) && ( nDstY >= nSrcY ) )
@@ -1069,8 +1082,9 @@ bool Bitmap::CopyPixel_AlphaOptimized( const tools::Rectangle& rRectDst, const t
for( long nY = nSrcEndY1, nYN = nDstEndY1; nY >= nSrcY; nY--, nYN-- )
{
Scanline pScanline = pWriteAcc->GetScanline(nYN);
+ Scanline pScanlineSrc = pWriteAcc->GetScanline(nY);
for( long nX = nSrcX, nXN = nDstX; nX <= nSrcEndX1; nX++, nXN++ )
- pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixel( nY, nX ) );
+ pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixelFromData( pScanlineSrc, nX ) );
}
}
else if( ( nDstX >= nSrcX ) && ( nDstY <= nSrcY ) )
@@ -1078,8 +1092,9 @@ bool Bitmap::CopyPixel_AlphaOptimized( const tools::Rectangle& rRectDst, const t
for( long nY = nSrcY, nYN = nDstY; nY <= nSrcEndY1; nY++, nYN++ )
{
Scanline pScanline = pWriteAcc->GetScanline(nYN);
+ Scanline pScanlineSrc = pWriteAcc->GetScanline(nY);
for( long nX = nSrcEndX1, nXN = nDstEndX1; nX >= nSrcX; nX--, nXN-- )
- pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixel( nY, nX ) );
+ pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixelFromData( pScanlineSrc, nX ) );
}
}
else
@@ -1087,8 +1102,9 @@ bool Bitmap::CopyPixel_AlphaOptimized( const tools::Rectangle& rRectDst, const t
for( long nY = nSrcEndY1, nYN = nDstEndY1; nY >= nSrcY; nY--, nYN-- )
{
Scanline pScanline = pWriteAcc->GetScanline(nYN);
+ Scanline pScanlineSrc = pWriteAcc->GetScanline(nY);
for( long nX = nSrcEndX1, nXN = nDstEndX1; nX >= nSrcX; nX--, nXN-- )
- pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixel( nY, nX ) );
+ pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixelFromData( pScanlineSrc, nX ) );
}
}
@@ -1291,9 +1307,10 @@ Bitmap Bitmap::CreateMask( const Color& rTransColor, sal_uInt8 nTol ) const
for (long nY = 0; nY < nHeight; ++nY)
{
Scanline pScanline = pWriteAcc->GetScanline( nY );
+ Scanline pScanlineRead = pReadAcc->GetScanline( nY );
for (long nX = 0; nX < nWidth; ++nX)
{
- if( aTest == pReadAcc->GetPixel( nY, nX ) )
+ if( aTest == pReadAcc->GetPixelFromData( pScanlineRead, nX ) )
pWriteAcc->SetPixelOnData( pScanline, nX, aWhite );
else
pWriteAcc->SetPixelOnData( pScanline, nX, aBlack );
@@ -1317,9 +1334,10 @@ Bitmap Bitmap::CreateMask( const Color& rTransColor, sal_uInt8 nTol ) const
for( long nY = 0; nY < nHeight; nY++ )
{
Scanline pScanline = pWriteAcc->GetScanline( nY );
+ Scanline pScanlineRead = pReadAcc->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
{
- aCol = pReadAcc->GetPaletteColor( pReadAcc->GetPixelIndex( nY, nX ) );
+ aCol = pReadAcc->GetPaletteColor( pReadAcc->GetIndexFromData( pScanlineRead, nX ) );
nR = aCol.GetRed();
nG = aCol.GetGreen();
nB = aCol.GetBlue();
@@ -1340,9 +1358,10 @@ Bitmap Bitmap::CreateMask( const Color& rTransColor, sal_uInt8 nTol ) const
for( long nY = 0; nY < nHeight; nY++ )
{
Scanline pScanline = pWriteAcc->GetScanline( nY );
+ Scanline pScanlineRead = pReadAcc->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
{
- aCol = pReadAcc->GetPixel( nY, nX );
+ aCol = pReadAcc->GetPixelFromData( pScanlineRead, nX );
nR = aCol.GetRed();
nG = aCol.GetGreen();
nB = aCol.GetBlue();
@@ -1406,10 +1425,11 @@ vcl::Region Bitmap::CreateRegion( const Color& rColor, const tools::Rectangle& r
//aSubRect.Top() = aSubRect.Bottom() = nY;
std::vector< long > aNewLine;
long nX(nLeft);
+ Scanline pScanlineRead = pReadAcc->GetScanline(nY);
for( ; nX <= nRight; )
{
- while( ( nX <= nRight ) && ( aMatch != pReadAcc->GetPixel( nY, nX ) ) )
+ while( ( nX <= nRight ) && ( aMatch != pReadAcc->GetPixelFromData( pScanlineRead, nX ) ) )
nX++;
if( nX <= nRight )
@@ -1417,7 +1437,7 @@ vcl::Region Bitmap::CreateRegion( const Color& rColor, const tools::Rectangle& r
aNewLine.push_back(nX);
//aSubRect.Left() = nX;
- while( ( nX <= nRight ) && ( aMatch == pReadAcc->GetPixel( nY, nX ) ) )
+ while( ( nX <= nRight ) && ( aMatch == pReadAcc->GetPixelFromData( pScanlineRead, nX ) ) )
nX++;
//aSubRect.Right() = nX - 1;
@@ -1522,8 +1542,11 @@ bool Bitmap::Replace( const Bitmap& rMask, const Color& rReplaceColor )
std::fill( pFlags.get(), pFlags.get()+nMaxColors, false );
for( long nY = 0; nY < nHeight; nY++ )
+ {
+ Scanline pScanline = pAcc->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
- pFlags[ pAcc->GetPixelIndex( nY, nX ) ] = true;
+ pFlags[ pAcc->GetIndexFromData( pScanline, nX ) ] = true;
+ }
for( sal_uInt16 i = 0; i < nMaxColors; i++ )
{
@@ -1543,8 +1566,9 @@ bool Bitmap::Replace( const Bitmap& rMask, const Color& rReplaceColor )
for( long nY = 0; nY < nHeight; nY++ )
{
Scanline pScanline = pAcc->GetScanline( nY );
+ Scanline pScanlineMask = pMaskAcc->GetScanline( nY );
for( long nX = 0; nX < nWidth; nX++ )
- if( pMaskAcc->GetPixel( nY, nX ) == aMaskWhite )
+ if( pMaskAcc->GetPixelFromData( pScanlineMask, nX ) == aMaskWhite )
pAcc->SetPixelOnData( pScanline, nX, aReplace );
}
@@ -1571,10 +1595,11 @@ bool Bitmap::Replace( const AlphaMask& rAlpha, const Color& rMergeColor )
for( long nY = 0; nY < nHeight; nY++ )
{
Scanline pScanline = pNewAcc->GetScanline( nY );
+ Scanline pScanlineAlpha = pAlphaAcc->GetScanline( nY );
for( long nX = 0; nX < nWidth; nX++ )
{
aCol = pAcc->GetColor( nY, nX );
- pNewAcc->SetPixelOnData( pScanline, nX, aCol.Merge( rMergeColor, 255 - pAlphaAcc->GetPixelIndex( nY, nX ) ) );
+ pNewAcc->SetPixelOnData( pScanline, nX, aCol.Merge( rMergeColor, 255 - pAlphaAcc->GetIndexFromData( pScanlineAlpha, nX ) ) );
}
}
@@ -1655,7 +1680,7 @@ bool Bitmap::Replace( const Color& rSearchColor, const Color& rReplaceColor, sal
Scanline pScanline = pAcc->GetScanline( nY );
for( long nX = 0, nWidth = pAcc->Width(); nX < nWidth; nX++ )
{
- aCol = pAcc->GetPixel( nY, nX );
+ aCol = pAcc->GetPixelFromData( pScanline, nX );
if( nMinR <= aCol.GetRed() && nMaxR >= aCol.GetRed() &&
nMinG <= aCol.GetGreen() && nMaxG >= aCol.GetGreen() &&
@@ -1755,7 +1780,7 @@ bool Bitmap::Replace( const Color* pSearchColors, const Color* pReplaceColors,
Scanline pScanline = pAcc->GetScanline( nY );
for( long nX = 0, nWidth = pAcc->Width(); nX < nWidth; nX++ )
{
- aCol = pAcc->GetPixel( nY, nX );
+ aCol = pAcc->GetPixelFromData( pScanline, nX );
for( sal_uLong i = 0; i < nColorCount; i++ )
{
@@ -1818,9 +1843,10 @@ bool Bitmap::CombineSimple( const Bitmap& rMask, BmpCombine eCombine )
for( long nY = 0; nY < nHeight; nY++ )
{
Scanline pScanline = pAcc->GetScanline( nY );
+ Scanline pScanlineMask = pMaskAcc->GetScanline( nY );
for( long nX = 0; nX < nWidth; nX++ )
{
- if( pMaskAcc->GetPixel( nY, nX ) != aMaskBlack && pAcc->GetPixel( nY, nX ) != aBlack )
+ if( pMaskAcc->GetPixelFromData( pScanlineMask, nX ) != aMaskBlack && pAcc->GetPixelFromData( pScanline, nX ) != aBlack )
pAcc->SetPixelOnData( pScanline, nX, aWhite );
else
pAcc->SetPixelOnData( pScanline, nX, aBlack );
@@ -1834,9 +1860,10 @@ bool Bitmap::CombineSimple( const Bitmap& rMask, BmpCombine eCombine )
for( long nY = 0; nY < nHeight; nY++ )
{
Scanline pScanline = pAcc->GetScanline( nY );
+ Scanline pScanlineMask = pMaskAcc->GetScanline( nY );
for( long nX = 0; nX < nWidth; nX++ )
{
- if( pMaskAcc->GetPixel( nY, nX ) != aMaskBlack || pAcc->GetPixel( nY, nX ) != aBlack )
+ if( pMaskAcc->GetPixelFromData( pScanlineMask, nX ) != aMaskBlack || pAcc->GetPixelFromData( pScanline, nX ) != aBlack )
pAcc->SetPixelOnData( pScanline, nX, aWhite );
else
pAcc->SetPixelOnData( pScanline, nX, aBlack );
@@ -1875,10 +1902,11 @@ bool Bitmap::Blend( const AlphaMask& rAlpha, const Color& rBackgroundColor )
for( long nY = 0; nY < nHeight; ++nY )
{
Scanline pScanline = pAcc->GetScanline( nY );
+ Scanline pScanlineAlpha = pAlphaAcc->GetScanline( nY );
for( long nX = 0; nX < nWidth; ++nX )
pAcc->SetPixelOnData( pScanline, nX,
- pAcc->GetPixel( nY, nX ).Merge( rBackgroundColor,
- 255 - pAlphaAcc->GetPixelIndex( nY, nX ) ) );
+ pAcc->GetPixelFromData( pScanline, nX ).Merge( rBackgroundColor,
+ 255 - pAlphaAcc->GetIndexFromData( pScanlineAlpha, nX ) ) );
}
bRet = true;
diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index ee6dbb946e02..72f640a6b9c4 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -322,9 +322,10 @@ bool Bitmap::ImplMakeMono( sal_uInt8 cThreshold )
for( long nY = 0; nY < nHeight; nY++ )
{
Scanline pScanline = pWriteAcc->GetScanline(nY);
+ Scanline pScanlineRead = pReadAcc->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
{
- const sal_uInt8 cIndex = pReadAcc->GetPixelIndex( nY, nX );
+ const sal_uInt8 cIndex = pReadAcc->GetIndexFromData( pScanlineRead, nX );
if( pReadAcc->GetPaletteColor( cIndex ).GetLuminance() >=
cThreshold )
{
@@ -340,9 +341,10 @@ bool Bitmap::ImplMakeMono( sal_uInt8 cThreshold )
for( long nY = 0; nY < nHeight; nY++ )
{
Scanline pScanline = pWriteAcc->GetScanline(nY);
+ Scanline pScanlineRead = pReadAcc->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
{
- if( pReadAcc->GetPixel( nY, nX ).GetLuminance() >=
+ if( pReadAcc->GetPixelFromData( pScanlineRead, nX ).GetLuminance() >=
cThreshold )
{
pWriteAcc->SetPixelOnData( pScanline, nX, aWhite );
@@ -405,9 +407,10 @@ bool Bitmap::ImplMakeGreyscales( sal_uInt16 nGreys )
for( long nY = 0; nY < nHeight; nY++ )
{
Scanline pScanline = pWriteAcc->GetScanline(nY);
+ Scanline pScanlineRead = pReadAcc->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
{
- const sal_uInt8 cIndex = pReadAcc->GetPixelIndex( nY, nX );
+ const sal_uInt8 cIndex = pReadAcc->GetIndexFromData( pScanlineRead, nX );
pWriteAcc->SetPixelOnData( pScanline, nX,
BitmapColor(pReadAcc->GetPaletteColor( cIndex ).GetLuminance() >> nShift) );
}
@@ -458,8 +461,9 @@ bool Bitmap::ImplMakeGreyscales( sal_uInt16 nGreys )
for( long nY = 0; nY < nHeight; nY++ )
{
Scanline pScanline = pWriteAcc->GetScanline(nY);
+ Scanline pScanlineRead = pReadAcc->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
- pWriteAcc->SetPixelOnData( pScanline, nX, BitmapColor(pReadAcc->GetPixel( nY, nX ).GetLuminance() >> nShift) );
+ pWriteAcc->SetPixelOnData( pScanline, nX, BitmapColor(pReadAcc->GetPixelFromData( pScanlineRead, nX ).GetLuminance() >> nShift) );
}
}
@@ -527,9 +531,10 @@ bool Bitmap::ImplConvertUp(sal_uInt16 nBitCount, Color const * pExtColor)
for (long nY = 0; nY < nHeight; nY++)
{
Scanline pScanline = pWriteAcc->GetScanline(nY);
+ Scanline pScanlineRead = pReadAcc->GetScanline(nY);
for (long nX = 0; nX < nWidth; nX++)
{
- pWriteAcc->SetPixelOnData(pScanline, nX, pReadAcc->GetPixel(nY, nX));
+ pWriteAcc->SetPixelOnData(pScanline, nX, pReadAcc->GetPixelFromData(pScanlineRead, nX));
}
}
}
@@ -540,9 +545,10 @@ bool Bitmap::ImplConvertUp(sal_uInt16 nBitCount, Color const * pExtColor)
for (long nY = 0; nY < nHeight; nY++)
{
Scanline pScanline = pWriteAcc->GetScanline(nY);
+ Scanline pScanlineRead = pReadAcc->GetScanline(nY);
for (long nX = 0; nX < nWidth; nX++)
{
- pWriteAcc->SetPixelOnData(pScanline, nX, pReadAcc->GetPaletteColor(pReadAcc->GetPixelIndex(nY, nX)));
+ pWriteAcc->SetPixelOnData(pScanline, nX, pReadAcc->GetPaletteColor(pReadAcc->GetIndexFromData(pScanlineRead, nX)));
}
}
}
@@ -551,9 +557,10 @@ bool Bitmap::ImplConvertUp(sal_uInt16 nBitCount, Color const * pExtColor)
for (long nY = 0; nY < nHeight; nY++)
{
Scanline pScanline = pWriteAcc->GetScanline(nY);
+ Scanline pScanlineRead = pReadAcc->GetScanline(nY);
for (long nX = 0; nX < nWidth; nX++)
{
- pWriteAcc->SetPixelOnData(pScanline, nX, pReadAcc->GetPixel(nY, nX));
+ pWriteAcc->SetPixelOnData(pScanline, nX, pReadAcc->GetPixelFromData(pScanlineRead, nX));
}
}
}
@@ -627,12 +634,13 @@ bool Bitmap::ImplConvertDown(sal_uInt16 nBitCount, Color const * pExtColor)
for (long nY = 0; nY < std::min(nHeight, 2L); nY++, nYTmp++)
{
pQLine2 = !nY ? aErrQuad1.data() : aErrQuad2.data();
+ Scanline pScanlineRead = pReadAcc->GetScanline(nYTmp);
for (long nX = 0; nX < nWidth; nX++)
{
if (pReadAcc->HasPalette())
- pQLine2[nX] = pReadAcc->GetPaletteColor(pReadAcc->GetPixelIndex(nYTmp, nX));
+ pQLine2[nX] = pReadAcc->GetPaletteColor(pReadAcc->GetIndexFromData(pScanlineRead, nX));
else
- pQLine2[nX] = pReadAcc->GetPixel(nYTmp, nX);
+ pQLine2[nX] = pReadAcc->GetPixelFromData(pScanlineRead, nX);
}
}
@@ -672,12 +680,13 @@ bool Bitmap::ImplConvertDown(sal_uInt16 nBitCount, Color const * pExtColor)
if (nYTmp < nHeight)
{
+ Scanline pScanlineRead = pReadAcc->GetScanline(nYTmp);
for (nX = 0; nX < nWidth; nX++)
{
if (pReadAcc->HasPalette())
- pQLine2[nX] = pReadAcc->GetPaletteColor(pReadAcc->GetPixelIndex(nYTmp, nX));
+ pQLine2[nX] = pReadAcc->GetPaletteColor(pReadAcc->GetIndexFromData(pScanlineRead, nX));
else
- pQLine2[nX] = pReadAcc->GetPixel(nYTmp, nX);
+ pQLine2[nX] = pReadAcc->GetPixelFromData(pScanlineRead, nX);
}
}
}
@@ -742,9 +751,10 @@ bool Bitmap::ImplConvertGhosted()
for( long nY = 0; nY < nHeight; nY++ )
{
Scanline pScanline = pW->GetScanline(nY);
+ Scanline pScanlineRead = pR->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
{
- const BitmapColor aOld( pR->GetPixel( nY, nX ) );
+ const BitmapColor aOld( pR->GetPixelFromData( pScanlineRead, nX ) );
pW->SetPixelOnData( pScanline, nX, BitmapColor( ( aOld.GetRed() >> 1 ) | 0x80,
( aOld.GetGreen() >> 1 ) | 0x80,
( aOld.GetBlue() >> 1 ) | 0x80 ) );
@@ -993,9 +1003,10 @@ bool Bitmap::ImplScaleFast( const double& rScaleX, const double& rScaleY )
{
long nMapY = pLutY[ nActY ];
Scanline pScanline = pWriteAcc->GetScanline(nActY);
+ Scanline pScanlineRead = pReadAcc->GetScanline(nMapY);
for( long nX = 0; nX < nNewWidth; nX++ )
- pWriteAcc->SetPixelOnData( pScanline, nX, pReadAcc->GetPixel( nMapY , pLutX[ nX ] ) );
+ pWriteAcc->SetPixelOnData( pScanline, nX, pReadAcc->GetPixelFromData( pScanlineRead , pLutX[ nX ] ) );
while( ( nActY < nNewHeight1 ) && ( pLutY[ nActY + 1 ] == nMapY ) )
{
@@ -1057,16 +1068,17 @@ bool Bitmap::ImplScaleInterpolate( const double& rScaleX, const double& rScaleY
for( long nY = 0; nY < nHeight; nY++ )
{
+ Scanline pScanlineRead = pReadAcc->GetScanline(nY);
if( 1 == nWidth )
{
BitmapColor aCol0;
if( pReadAcc->HasPalette() )
{
- aCol0 = pReadAcc->GetPaletteColor( pReadAcc->GetPixelIndex( nY, 0 ) );
+ aCol0 = pReadAcc->GetPaletteColor( pReadAcc->GetIndexFromData( pScanlineRead, 0 ) );
}
else
{
- aCol0 = pReadAcc->GetPixel( nY, 0 );
+ aCol0 = pReadAcc->GetPixelFromData( pScanlineRead, 0 );
}
Scanline pScanline = pWriteAcc->GetScanline(nY);
@@ -1085,13 +1097,13 @@ bool Bitmap::ImplScaleInterpolate( const double& rScaleX, const double& rScaleY
BitmapColor aCol0, aCol1;
if( pReadAcc->HasPalette() )
{
- aCol0 = pReadAcc->GetPaletteColor( pReadAcc->GetPixelIndex( nY, nTemp++ ) );
- aCol1 = pReadAcc->GetPaletteColor( pReadAcc->GetPixelIndex( nY, nTemp ) );
+ aCol0 = pReadAcc->GetPaletteColor( pReadAcc->GetIndexFromData( pScanlineRead, nTemp++ ) );
+ aCol1 = pReadAcc->GetPaletteColor( pReadAcc->GetIndexFromData( pScanlineRead, nTemp ) );
}
else
{
- aCol0 = pReadAcc->GetPixel( nY, nTemp++ );
- aCol1 = pReadAcc->GetPixel( nY, nTemp );
+ aCol0 = pReadAcc->GetPixelFromData( pScanlineRead, nTemp++ );
+ aCol1 = pReadAcc->GetPixelFromData( pScanlineRead, nTemp );
}
nTemp = pLutFrac[ nX ];
@@ -1244,9 +1256,10 @@ bool Bitmap::ImplDitherMatrix()
for( sal_uLong nY = 0; nY < nHeight; nY++ )
{
Scanline pScanline = pWriteAcc->GetScanline(nY);
+ Scanline pScanlineRead = pReadAcc->GetScanline(nY);
for( sal_uLong nX = 0, nModY = ( nY & 0x0FUL ) << 4; nX < nWidth; nX++ )
{
- const BitmapColor aCol( pReadAcc->GetPaletteColor( pReadAcc->GetPixelIndex( nY, nX ) ) );
+ const BitmapColor aCol( pReadAcc->GetPaletteColor( pReadAcc->GetIndexFromData( pScanlineRead, nX ) ) );
const sal_uLong nD = nVCLDitherLut[ nModY + ( nX & 0x0FUL ) ];
const sal_uLong nR = ( nVCLLut[ aCol.GetRed() ] + nD ) >> 16;
const sal_uLong nG = ( nVCLLut[ aCol.GetGreen() ] + nD ) >> 16;
@@ -1262,9 +1275,10 @@ bool Bitmap::ImplDitherMatrix()
for( sal_uLong nY = 0; nY < nHeight; nY++ )
{
Scanline pScanline = pWriteAcc->GetScanline(nY);
+ Scanline pScanlineRead = pReadAcc->GetScanline(nY);
for( sal_uLong nX = 0, nModY = ( nY & 0x0FUL ) << 4; nX < nWidth; nX++ )
{
- const BitmapColor aCol( pReadAcc->GetPixel( nY, nX ) );
+ const BitmapColor aCol( pReadAcc->GetPixelFromData( pScanlineRead, nX ) );
const sal_uLong nD = nVCLDitherLut[ nModY + ( nX & 0x0FUL ) ];
const sal_uLong nR = ( nVCLLut[ aCol.GetRed() ] + nD ) >> 16;
const sal_uLong nG = ( nVCLLut[ aCol.GetGreen() ] + nD ) >> 16;
@@ -1329,9 +1343,10 @@ bool Bitmap::ImplDitherFloyd()
if( bPal )
{
+ Scanline pScanlineRead = pReadAcc->GetScanline(0);
for( long nZ = 0; nZ < nWidth; nZ++ )
{
- aColor = pReadAcc->GetPaletteColor( pReadAcc->GetPixelIndex( 0, nZ ) );
+ aColor = pReadAcc->GetPaletteColor( pReadAcc->GetIndexFromData( pScanlineRead, nZ ) );
*pTmp++ = static_cast<long>(aColor.GetBlue()) << 12;
*pTmp++ = static_cast<long>(aColor.GetGreen()) << 12;
@@ -1340,9 +1355,10 @@ bool Bitmap::ImplDitherFloyd()
}
else
{
+ Scanline pScanlineRead = pReadAcc->GetScanline(0);
for( long nZ = 0; nZ < nWidth; nZ++ )
{
- aColor = pReadAcc->GetPixel( 0, nZ );
+ aColor = pReadAcc->GetPixelFromData( pScanlineRead, nZ );
*pTmp++ = static_cast<long>(aColor.GetBlue()) << 12;
*pTmp++ = static_cast<long>(aColor.GetGreen()) << 12;
@@ -1360,9 +1376,10 @@ bool Bitmap::ImplDitherFloyd()
{
if( bPal )
{
+ Scanline pScanlineRead = pReadAcc->GetScanline(nY);
for( long nZ = 0; nZ < nWidth; nZ++ )
{
- aColor = pReadAcc->GetPaletteColor( pReadAcc->GetPixelIndex( nY, nZ ) );
+ aColor = pReadAcc->GetPaletteColor( pReadAcc->GetIndexFromData( pScanlineRead, nZ ) );
*pTmp++ = static_cast<long>(aColor.GetBlue()) << 12;
*pTmp++ = static_cast<long>(aColor.GetGreen()) << 12;
@@ -1371,9 +1388,10 @@ bool Bitmap::ImplDitherFloyd()
}
else
{
+ Scanline pScanlineRead = pReadAcc->GetScanline(nY);
for( long nZ = 0; nZ < nWidth; nZ++ )
{
- aColor = pReadAcc->GetPixel( nY, nZ );
+ aColor = pReadAcc->GetPixelFromData( pScanlineRead, nZ );
*pTmp++ = static_cast<long>(aColor.GetBlue()) << 12;
*pTmp++ = static_cast<long>(aColor.GetGreen()) << 12;
@@ -1458,8 +1476,9 @@ bool Bitmap::ImplDitherFloyd16()
for( long nY = 0; nY < std::min( nHeight, 2L ); nY++, nYTmp++ )
{
pQLine2 = !nY ? pErrQuad1.get() : pErrQuad2.get();
+ Scanline pScanlineRead = pReadAcc->GetScanline(nYTmp);
for( long nX = 0; nX < nWidth; nX++ )
- pQLine2[ nX ] = pReadAcc->GetPixel( nYTmp, nX );
+ pQLine2[ nX ] = pReadAcc->GetPixelFromData( pScanlineRead, nX );
}
assert(pQLine2 || nHeight == 0);
@@ -1502,8 +1521,11 @@ bool Bitmap::ImplDitherFloyd16()
pQLine2 = bQ1 ? pErrQuad2.get() : pErrQuad1.get();
if( nYTmp < nHeight )
+ {
+ Scanline pScanlineRead = pReadAcc->GetScanline(nYTmp);
for( nX = 0; nX < nWidth; nX++ )
- pQLine2[ nX ] = pReadAcc->GetPixel( nYTmp, nX );
+ pQLine2[ nX ] = pReadAcc->GetPixelFromData( pScanlineRead, nX );
+ }
}
bRet = true;
@@ -1580,8 +1602,12 @@ bool Bitmap::ImplReduceSimple( sal_uInt16 nColorCount )
for( long nY = 0; nY < nHeight; nY++ )
{
Scanline pScanline = pWAcc->GetScanline(nY);
+ Scanline pScanlineRead = pRAcc->GetScanline(nY);
for( long nX =0; nX < nWidth; nX++ )
- pWAcc->SetPixelOnData( pScanline, nX, BitmapColor(static_cast<sal_uInt8>(aOct.GetBestPaletteIndex( pRAcc->GetPaletteColor( pRAcc->GetPixelIndex( nY, nX ) )))) );
+ {
+ auto c = pRAcc->GetPaletteColor( pRAcc->GetIndexFromData( pScanlineRead, nX ) );
+ pWAcc->SetPixelOnData( pScanline, nX, BitmapColor(static_cast<sal_uInt8>(aOct.GetBestPaletteIndex( c ))) );
+ }
}
}
else
@@ -1589,8 +1615,12 @@ bool Bitmap::ImplReduceSimple( sal_uInt16 nColorCount )
for( long nY = 0; nY < nHeight; nY++ )
{
Scanline pScanline = pWAcc->GetScanline(nY);
+ Scanline pScanlineRead = pRAcc->GetScanline(nY);
for( long nX =0; nX < nWidth; nX++ )
- pWAcc->SetPixelOnData( pScanline, nX, BitmapColor(static_cast<sal_uInt8>(aOct.GetBestPaletteIndex( pRAcc->GetPixel( nY, nX ) ))) );
+ {
+ auto c = pRAcc->GetPixelFromData( pScanlineRead, nX );
+ pWAcc->SetPixelOnData( pScanline, nX, BitmapColor(static_cast<sal_uInt8>(aOct.GetBestPaletteIndex( c ))) );
+ }
}
}
@@ -1679,9 +1709,10 @@ bool Bitmap::ImplReducePopular( sal_uInt16 nColCount )
{
for( long nY = 0; nY < nHeight; nY++ )
{
+ Scanline pScanlineRead = pRAcc->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
{
- const BitmapColor& rCol = pRAcc->GetPaletteColor( pRAcc->GetPixelIndex( nY, nX ) );
+ const BitmapColor& rCol = pRAcc->GetPaletteColor( pRAcc->GetIndexFromData( pScanlineRead, nX ) );
pCountTable[ ( ( static_cast<sal_uInt32>(rCol.GetRed()) >> nRightShiftBits ) << nLeftShiftBits2 ) |
( ( static_cast<sal_uInt32>(rCol.GetGreen()) >> nRightShiftBits ) << nLeftShiftBits1 ) |
( static_cast<sal_uInt32>(rCol.GetBlue()) >> nRightShiftBits ) ].mnCount++;
@@ -1692,9 +1723,10 @@ bool Bitmap::ImplReducePopular( sal_uInt16 nColCount )
{
for( long nY = 0; nY < nHeight; nY++ )
{
+ Scanline pScanlineRead = pRAcc->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
{
- const BitmapColor aCol( pRAcc->GetPixel( nY, nX ) );
+ const BitmapColor aCol( pRAcc->GetPixelFromData( pScanlineRead, nX ) );
pCountTable[ ( ( static_cast<sal_uInt32>(aCol.GetRed()) >> nRightShiftBits ) << nLeftShiftBits2 ) |
( ( static_cast<sal_uInt32>(aCol.GetGreen()) >> nRightShiftBits ) << nLeftShiftBits1 ) |
( static_cast<sal_uInt32>(aCol.GetBlue()) >> nRightShiftBits ) ].mnCount++;
@@ -1732,9 +1764,10 @@ bool Bitmap::ImplReducePopular( sal_uInt16 nColCount )
for( long nY = 0; nY < nHeight; nY++ )
{
Scanline pScanline = pWAcc->GetScanline(nY);
+ Scanline pScanlineRead = pRAcc->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
{
- const BitmapColor& rCol = pRAcc->GetPaletteColor( pRAcc->GetPixelIndex( nY, nX ) );
+ const BitmapColor& rCol = pRAcc->GetPaletteColor( pRAcc->GetIndexFromData( pScanlineRead, nX ) );
aDstCol.SetIndex( pIndexMap[ ( ( static_cast<sal_uInt32>(rCol.GetRed()) >> nRightShiftBits ) << nLeftShiftBits2 ) |
( ( static_cast<sal_uInt32>(rCol.GetGreen()) >> nRightShiftBits ) << nLeftShiftBits1 ) |
( static_cast<sal_uInt32>(rCol.GetBlue()) >> nRightShiftBits ) ] );
@@ -1747,9 +1780,10 @@ bool Bitmap::ImplReducePopular( sal_uInt16 nColCount )
for( long nY = 0; nY < nHeight; nY++ )
{
Scanline pScanline = pWAcc->GetScanline(nY);
+ Scanline pScanlineRead = pRAcc->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
{
- const BitmapColor aCol( pRAcc->GetPixel( nY, nX ) );
+ const BitmapColor aCol( pRAcc->GetPixelFromData( pScanlineRead, nX ) );
aDstCol.SetIndex( pIndexMap[ ( ( static_cast<sal_uInt32>(aCol.GetRed()) >> nRightShiftBits ) << nLeftShiftBits2 ) |
( ( static_cast<sal_uInt32>(aCol.GetGreen()) >> nRightShiftBits ) << nLeftShiftBits1 ) |
( static_cast<sal_uInt32>(aCol.GetBlue()) >> nRightShiftBits ) ] );
@@ -1816,9 +1850,10 @@ bool Bitmap::ImplReduceMedian( sal_uInt16 nColCount )
{
for( long nY = 0; nY < nHeight; nY++ )
{
+ Scanline pScanlineRead = pRAcc->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
{
- const BitmapColor& rCol = pRAcc->GetPaletteColor( pRAcc->GetPixelIndex( nY, nX ) );
+ const BitmapColor& rCol = pRAcc->GetPaletteColor( pRAcc->GetIndexFromData( pScanlineRead, nX ) );
pColBuf[ RGB15( rCol.GetRed() >> 3, rCol.GetGreen() >> 3, rCol.GetBlue() >> 3 ) ]++;
}
}
@@ -1827,9 +1862,10 @@ bool Bitmap::ImplReduceMedian( sal_uInt16 nColCount )
{
for( long nY = 0; nY < nHeight; nY++ )
{
+ Scanline pScanlineRead = pRAcc->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
{
- const BitmapColor aCol( pRAcc->GetPixel( nY, nX ) );
+ const BitmapColor aCol( pRAcc->GetPixelFromData( pScanlineRead, nX ) );
pColBuf[ RGB15( aCol.GetRed() >> 3, aCol.GetGreen() >> 3, aCol.GetBlue() >> 3 ) ]++;
}
}
@@ -2140,7 +2176,7 @@ bool Bitmap::Adjust( short nLuminancePercent, short nContrastPercent,
Scanline pScanline = pAcc->GetScanline(nY);
for( long nX = 0; nX < nW; nX++ )
{
- aCol = pAcc->GetPixel( nY, nX );
+ aCol = pAcc->GetPixelFromData( pScanline, nX );
aCol.SetRed( cMapR[ aCol.GetRed() ] );
aCol.SetGreen( cMapG[ aCol.GetGreen() ] );
aCol.SetBlue( cMapB[ aCol.GetBlue() ] );
diff --git a/vcl/source/gdi/bitmap4.cxx b/vcl/source/gdi/bitmap4.cxx
index 2e97c9cefc48..f71f48f31bbf 100644
--- a/vcl/source/gdi/bitmap4.cxx
+++ b/vcl/source/gdi/bitmap4.cxx
@@ -731,7 +731,7 @@ bool Bitmap::ImplSolarize( const BmpFilterParam* pFilterParam )
Scanline pScanline = pWriteAcc->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
{
- aCol = pWriteAcc->GetPixel( nY, nX );
+ aCol = pWriteAcc->GetPixelFromData( pScanline, nX );
if( aCol.GetLuminance() >= cThreshold )
pWriteAcc->SetPixelOnData( pScanline, nX, aCol.Invert() );
@@ -787,9 +787,10 @@ bool Bitmap::ImplSepia( const BmpFilterParam* pFilterParam )
for( long nY = 0; nY < nHeight ; nY++ )
{
Scanline pScanline = pWriteAcc->GetScanline(nY);
+ Scanline pScanlineRead = pReadAcc->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
{
- aCol.SetIndex( pIndexMap[ pReadAcc->GetPixel( nY, nX ).GetIndex() ] );
+ aCol.SetIndex( pIndexMap[ pReadAcc->GetIndexFromData( pScanlineRead, nX ) ] );
pWriteAcc->SetPixelOnData( pScanline, nX, aCol );
}
}
@@ -799,9 +800,10 @@ bool Bitmap::ImplSepia( const BmpFilterParam* pFilterParam )
for( long nY = 0; nY < nHeight ; nY++ )
{
Scanline pScanline = pWriteAcc->GetScanline(nY);
+ Scanline pScanlineRead = pReadAcc->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
{
- aCol.SetIndex( pReadAcc->GetPixel( nY, nX ).GetLuminance() );
+ aCol.SetIndex( pReadAcc->GetPixelFromData( pScanlineRead, nX ).GetLuminance() );
pWriteAcc->SetPixelOnData( pScanline, nX, aCol );
}
}
@@ -896,9 +898,10 @@ bool Bitmap::ImplMosaic( const BmpFilterParam* pFilterParam )
{
for( nY = nY1, nSumR = nSumG = nSumB = 0; nY <= nY2; nY++ )
{
+ Scanline pScanlineRead = pReadAcc->GetScanline(nY);
for( nX = nX1; nX <= nX2; nX++ )
{
- aCol = pReadAcc->GetPixel( nY, nX );
+ aCol = pReadAcc->GetPixelFromData( pScanlineRead, nX );
nSumR += aCol.GetRed();
nSumG += aCol.GetGreen();
nSumB += aCol.GetBlue();
@@ -932,9 +935,10 @@ bool Bitmap::ImplMosaic( const BmpFilterParam* pFilterParam )
{
for( nY = nY1, nSumR = nSumG = nSumB = 0; nY <= nY2; nY++ )
{
+ Scanline pScanlineRead = pReadAcc->GetScanline(nY);
for( nX = nX1; nX <= nX2; nX++ )
{
- const BitmapColor& rCol = pReadAcc->GetPaletteColor( pReadAcc->GetPixelIndex( nY, nX ) );
+ const BitmapColor& rCol = pReadAcc->GetPaletteColor( pReadAcc->GetIndexFromData( pScanlineRead, nX ) );
nSumR += rCol.GetRed();
nSumG += rCol.GetGreen();
nSumB += rCol.GetBlue();
@@ -1048,8 +1052,11 @@ bool Bitmap::ImplPopArt()
// get pixel count for each palette entry
for( long nY = 0; nY < nHeight ; nY++ )
+ {
+ Scanline pScanline = pWriteAcc->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
- pPopArtTable[ pWriteAcc->GetPixel( nY, nX ).GetIndex() ].mnCount++;
+ pPopArtTable[ pWriteAcc->GetIndexFromData( pScanline, nX ) ].mnCount++;
+ }
// sort table
qsort( pPopArtTable, nEntryCount, sizeof( PopArtEntry ), ImplPopArtCmpFnc );
@@ -1240,9 +1247,10 @@ bool Bitmap::ImplSeparableUnsharpenFilter(const double radius) {
BitmapColor aColor, aColorBlur;
// For all pixels in original image subtract pixels values from blurred image
- for( long x = 0; x < nWidth; x++ )
+ for( long y = 0; y < nHeight; y++ )
{
- for( long y = 0; y < nHeight; y++ )
+ Scanline pScanline = pWriteAcc->GetScanline(y);
+ for( long x = 0; x < nWidth; x++ )
{
aColorBlur = pReadAccBlur->GetColor( y , x );
aColor = pReadAcc->GetColor( y , x );
@@ -1252,7 +1260,7 @@ bool Bitmap::ImplSeparableUnsharpenFilter(const double radius) {
static_cast<sal_uInt8>(MinMax( aColor.GetGreen() + (aColor.GetGreen() - aColorBlur.GetGreen()) * aAmount, 0, 255 )),
static_cast<sal_uInt8>(MinMax( aColor.GetBlue() + (aColor.GetBlue() - aColorBlur.GetBlue()) * aAmount, 0, 255 )) );
- pWriteAcc->SetPixel( y, x, aResultColor );
+ pWriteAcc->SetPixelOnData( pScanline, x, aResultColor );
}
}
diff --git a/vcl/source/gdi/bmpacc.cxx b/vcl/source/gdi/bmpacc.cxx
index ad6b8ead20f2..74be5e1202b6 100644
--- a/vcl/source/gdi/bmpacc.cxx
+++ b/vcl/source/gdi/bmpacc.cxx
@@ -377,8 +377,9 @@ void BitmapWriteAccess::CopyScanline( long nY, const BitmapReadAccess& rReadAcc
{
// TODO: use fastbmp infrastructure
Scanline pScanline = GetScanline( nY );
+ Scanline pScanlineRead = rReadAcc.GetScanline(nY);
for( long nX = 0, nWidth = std::min( mpBuffer->mnWidth, rReadAcc.Width() ); nX < nWidth; nX++ )
- SetPixelOnData( pScanline, nX, rReadAcc.GetPixel( nY, nX ) );
+ SetPixelOnData( pScanline, nX, rReadAcc.GetPixelFromData( pScanlineRead, nX ) );
}
}
diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx
index 4393e2c63053..ba41e6132a58 100644
--- a/vcl/source/gdi/dibtools.cxx
+++ b/vcl/source/gdi/dibtools.cxx
@@ -1128,14 +1128,15 @@ bool ImplWriteRLE( SvStream& rOStm, BitmapReadAccess const & rAcc, bool bRLE4 )
{
sal_uInt8* pTmp = pBuf.get();
nX = nBufCount = 0;
+ Scanline pScanline = rAcc.GetScanline( nY );
while( nX < nWidth )
{
nCount = 1;
- cPix = rAcc.GetPixelIndex( nY, nX++ );
+ cPix = rAcc.GetIndexFromData( pScanline, nX++ );
while( ( nX < nWidth ) && ( nCount < 255 )
- && ( cPix == rAcc.GetPixelIndex( nY, nX ) ) )
+ && ( cPix == rAcc.GetIndexFromData( pScanline, nX ) ) )
{
nX++;
nCount++;
@@ -1154,7 +1155,7 @@ bool ImplWriteRLE( SvStream& rOStm, BitmapReadAccess const & rAcc, bool bRLE4 )
bFound = false;
while( ( nX < nWidth ) && ( nCount < 256 )
- && ( cPix = rAcc.GetPixelIndex( nY, nX ) ) != cLast )
+ && ( cPix = rAcc.GetIndexFromData( pScanline, nX ) ) != cLast )
{
nX++; nCount++;
cLast = cPix;
@@ -1173,10 +1174,10 @@ bool ImplWriteRLE( SvStream& rOStm, BitmapReadAccess const & rAcc, bool bRLE4 )
{
for ( sal_uLong i = 0; i < nCount; i++, pTmp++ )
{
- *pTmp = rAcc.GetPixelIndex( nY, nSaveIndex++ ) << 4;
+ *pTmp = rAcc.GetIndexFromData( pScanline, nSaveIndex++ ) << 4;
if ( ++i < nCount )
- *pTmp |= rAcc.GetPixelIndex( nY, nSaveIndex++ );
+ *pTmp |= rAcc.GetIndexFromData( pScanline, nSaveIndex++ );
}
nCount = ( nCount + 1 ) >> 1;
@@ -1184,7 +1185,7 @@ bool ImplWriteRLE( SvStream& rOStm, BitmapReadAccess const & rAcc, bool bRLE4 )
else
{
for( sal_uLong i = 0; i < nCount; i++ )
- *pTmp++ = rAcc.GetPixelIndex( nY, nSaveIndex++ );
+ *pTmp++ = rAcc.GetIndexFromData( pScanline, nSaveIndex++ );
}
if ( nCount & 1 )
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list