summaryrefslogtreecommitdiff
path: root/vcl/source
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 /vcl/source
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 'vcl/source')
-rw-r--r--vcl/source/bitmap/BitmapProcessor.cxx18
-rw-r--r--vcl/source/bitmap/BitmapScaleConvolution.cxx3
-rw-r--r--vcl/source/bitmap/bitmapscalesuper.cxx30
-rw-r--r--vcl/source/gdi/alpha.cxx8
-rw-r--r--vcl/source/gdi/bitmap.cxx180
-rw-r--r--vcl/source/gdi/bitmap3.cxx96
-rw-r--r--vcl/source/gdi/bitmap4.cxx46
-rw-r--r--vcl/source/gdi/bitmapex.cxx48
-rw-r--r--vcl/source/gdi/bmpacc.cxx5
-rw-r--r--vcl/source/gdi/bmpacc3.cxx3
-rw-r--r--vcl/source/gdi/dibtools.cxx6
-rw-r--r--vcl/source/helper/canvastools.cxx22
-rw-r--r--vcl/source/outdev/bitmap.cxx30
-rw-r--r--vcl/source/outdev/transparent.cxx6
14 files changed, 331 insertions, 170 deletions
diff --git a/vcl/source/bitmap/BitmapProcessor.cxx b/vcl/source/bitmap/BitmapProcessor.cxx
index 590af367a6d6..470744fbab5c 100644
--- a/vcl/source/bitmap/BitmapProcessor.cxx
+++ b/vcl/source/bitmap/BitmapProcessor.cxx
@@ -27,6 +27,7 @@ BitmapEx BitmapProcessor::createLightImage(const BitmapEx& rBitmapEx)
{
for (long nY = 0; nY < aSize.Height(); ++nY)
{
+ Scanline pScanline = pWrite->GetScanline( nY );
for (long nX = 0; nX < aSize.Width(); ++nX)
{
BitmapColor aBmpColor = pRead->HasPalette() ?
@@ -50,7 +51,7 @@ BitmapEx BitmapProcessor::createLightImage(const BitmapEx& rBitmapEx)
aBmpColor.SetGreen((aBColor.getGreen() * 255.0) + 0.5);
aBmpColor.SetBlue((aBColor.getBlue() * 255.0) + 0.5);
- pWrite->SetPixel(nY, nX, aBmpColor);
+ pWrite->SetPixelOnData(pScanline, nX, aBmpColor);
}
}
}
@@ -93,16 +94,18 @@ BitmapEx BitmapProcessor::createDisabledImage(const BitmapEx& rBitmapEx)
for (long nY = 0; nY < aSize.Height(); ++nY)
{
+ Scanline pScanAlpha = pGreyAlpha->GetScanline( nY );
+ Scanline pScanline = pGrey->GetScanline( nY );
for (long nX = 0; nX < aSize.Width(); ++nX)
{
const sal_uInt8 nLum(pRead->GetLuminance(nY, nX));
BitmapColor aGreyValue(nLum, nLum, nLum);
- pGrey->SetPixel(nY, nX, aGreyValue);
+ pGrey->SetPixelOnData(pScanline, nX, aGreyValue);
const BitmapColor aBitmapAlphaValue(pReadAlpha->GetPixel(nY, nX));
aGreyAlphaValue.SetIndex(sal_uInt8(std::min(aBitmapAlphaValue.GetIndex() + 178ul, 255ul)));
- pGreyAlpha->SetPixel(nY, nX, aGreyAlphaValue);
+ pGreyAlpha->SetPixelOnData(pScanAlpha, nX, aGreyAlphaValue);
}
}
}
@@ -117,14 +120,16 @@ BitmapEx BitmapProcessor::createDisabledImage(const BitmapEx& rBitmapEx)
for (long nY = 0; nY < aSize.Height(); ++nY)
{
+ Scanline pScanAlpha = pGreyAlpha->GetScanline( nY );
+ Scanline pScanline = pGrey->GetScanline( nY );
for (long nX = 0; nX < aSize.Width(); ++nX)
{
const sal_uInt8 nLum(pRead->GetLuminance(nY, nX));
BitmapColor aGreyValue(nLum, nLum, nLum);
- pGrey->SetPixel(nY, nX, aGreyValue);
+ pGrey->SetPixelOnData(pScanline, nX, aGreyValue);
aGreyAlphaValue.SetIndex(128);
- pGreyAlpha->SetPixel(nY, nX, aGreyAlphaValue);
+ pGreyAlpha->SetPixelOnData(pScanAlpha, nX, aGreyAlphaValue);
}
}
}
@@ -195,13 +200,14 @@ void BitmapProcessor::colorizeImage(BitmapEx const & rBitmapEx, Color aColor)
{
for (nY = 0; nY < nH; ++nY)
{
+ Scanline pScanline = pWriteAccess->GetScanline( nY );
for (nX = 0; nX < nW; ++nX)
{
aBitmapColor = pWriteAccess->GetPixel(nY, nX);
aBitmapColor.SetRed(aMapR[aBitmapColor.GetRed()]);
aBitmapColor.SetGreen(aMapG[aBitmapColor.GetGreen()]);
aBitmapColor.SetBlue(aMapB[aBitmapColor.GetBlue()]);
- pWriteAccess->SetPixel(nY, nX, aBitmapColor);
+ pWriteAccess->SetPixelOnData(pScanline, nX, aBitmapColor);
}
}
}
diff --git a/vcl/source/bitmap/BitmapScaleConvolution.cxx b/vcl/source/bitmap/BitmapScaleConvolution.cxx
index 5ecdc39da1cd..fca8b2ed161c 100644
--- a/vcl/source/bitmap/BitmapScaleConvolution.cxx
+++ b/vcl/source/bitmap/BitmapScaleConvolution.cxx
@@ -115,6 +115,7 @@ bool ImplScaleConvolutionHor(Bitmap& rSource, Bitmap& rTarget, const double& rSc
{
for(long y(0); y < nHeight; y++)
{
+ Scanline pScanline = pWriteAcc->GetScanline( y );
for(long x(0); x < nNewWidth; x++)
{
const long aBaseIndex(x * aNumberOfContributions);
@@ -150,7 +151,7 @@ bool ImplScaleConvolutionHor(Bitmap& rSource, Bitmap& rTarget, const double& rSc
static_cast< sal_uInt8 >(MinMax(static_cast< sal_Int32 >(aValueGreen / aSum), 0, 255)),
static_cast< sal_uInt8 >(MinMax(static_cast< sal_Int32 >(aValueBlue / aSum), 0, 255)));
- pWriteAcc->SetPixel(y, x, aResultColor);
+ pWriteAcc->SetPixelOnData(pScanline, x, aResultColor);
}
}
diff --git a/vcl/source/bitmap/bitmapscalesuper.cxx b/vcl/source/bitmap/bitmapscalesuper.cxx
index 1dc238353c81..545e18903e84 100644
--- a/vcl/source/bitmap/bitmapscalesuper.cxx
+++ b/vcl/source/bitmap/bitmapscalesuper.cxx
@@ -109,6 +109,7 @@ void scalePallete8bit(ScaleContext &rCtx, long nStartY, long nEndY)
long nTempFY = rCtx.mpMapFY[ nY ];
Scanline pLine0 = rCtx.mpSrc->GetScanline( nTempY );
Scanline pLine1 = rCtx.mpSrc->GetScanline( ++nTempY );
+ Scanline pScanDest = rCtx.mpDest->GetScanline( nY );
for(long nX = nStartX, nXDst = 0; nX <= nEndX; nX++ )
{
@@ -131,7 +132,7 @@ void scalePallete8bit(ScaleContext &rCtx, long nStartY, long nEndY)
BitmapColor aColRes( MAP( cR0, cR1, nTempFY ),
MAP( cG0, cG1, nTempFY ),
MAP( cB0, cB1, nTempFY ) );
- rCtx.mpDest->SetPixel( nY, nXDst++, aColRes );
+ rCtx.mpDest->SetPixelOnData( pScanDest, nXDst++, aColRes );
}
}
}
@@ -144,6 +145,7 @@ void scalePalleteGeneral(ScaleContext &rCtx, long nStartY, long nEndY)
{
long nTempY = rCtx.mpMapIY[ nY ];
long nTempFY = rCtx.mpMapFY[ nY ];
+ Scanline pScanline = rCtx.mpDest->GetScanline( nY );
for( long nX = nStartX, nXDst = 0; nX <= nEndX; nX++ )
{
@@ -165,7 +167,7 @@ void scalePalleteGeneral(ScaleContext &rCtx, long nStartY, long nEndY)
BitmapColor aColRes( MAP( cR0, cR1, nTempFY ),
MAP( cG0, cG1, nTempFY ),
MAP( cB0, cB1, nTempFY ) );
- rCtx.mpDest->SetPixel( nY, nXDst++, aColRes );
+ rCtx.mpDest->SetPixelOnData( pScanline, nXDst++, aColRes );
}
}
}
@@ -180,6 +182,7 @@ void scale24bitBGR(ScaleContext &rCtx, long nStartY, long nEndY)
long nTempFY = rCtx.mpMapFY[ nY ];
Scanline pLine0 = rCtx.mpSrc->GetScanline( nTempY );
Scanline pLine1 = rCtx.mpSrc->GetScanline( ++nTempY );
+ Scanline pScanDest = rCtx.mpDest->GetScanline( nY );
for( long nX = nStartX, nXDst = 0; nX <= nEndX; nX++ )
{
@@ -204,7 +207,7 @@ void scale24bitBGR(ScaleContext &rCtx, long nStartY, long nEndY)
BitmapColor aColRes( MAP( cR0, cR1, nTempFY ),
MAP( cG0, cG1, nTempFY ),
MAP( cB0, cB1, nTempFY ) );
- rCtx.mpDest->SetPixel( nY, nXDst++, aColRes );
+ rCtx.mpDest->SetPixelOnData( pScanDest, nXDst++, aColRes );
}
}
}
@@ -219,6 +222,7 @@ void scale24bitRGB(ScaleContext &rCtx, long nStartY, long nEndY)
long nTempFY = rCtx.mpMapFY[ nY ];
Scanline pLine0 = rCtx.mpSrc->GetScanline( nTempY );
Scanline pLine1 = rCtx.mpSrc->GetScanline( ++nTempY );
+ Scanline pScanDest = rCtx.mpDest->GetScanline( nY );
for( long nX = nStartX, nXDst = 0; nX <= nEndX; nX++ )
{
@@ -243,7 +247,7 @@ void scale24bitRGB(ScaleContext &rCtx, long nStartY, long nEndY)
BitmapColor aColRes( MAP( cR0, cR1, nTempFY ),
MAP( cG0, cG1, nTempFY ),
MAP( cB0, cB1, nTempFY ) );
- rCtx.mpDest->SetPixel( nY, nXDst++, aColRes );
+ rCtx.mpDest->SetPixelOnData( pScanDest, nXDst++, aColRes );
}
}
}
@@ -256,6 +260,7 @@ void scaleNonPalleteGeneral(ScaleContext &rCtx, long nStartY, long nEndY)
{
long nTempY = rCtx.mpMapIY[ nY ];
long nTempFY = rCtx.mpMapFY[ nY ];
+ Scanline pScanDest = rCtx.mpDest->GetScanline( nY );
for( long nX = nStartX, nXDst = 0; nX <= nEndX; nX++ )
{
@@ -277,7 +282,7 @@ void scaleNonPalleteGeneral(ScaleContext &rCtx, long nStartY, long nEndY)
BitmapColor aColRes( MAP( cR0, cR1, nTempFY ),
MAP( cG0, cG1, nTempFY ),
MAP( cB0, cB1, nTempFY ) );
- rCtx.mpDest->SetPixel( nY, nXDst++, aColRes );
+ rCtx.mpDest->SetPixelOnData( pScanDest, nXDst++, aColRes );
}
}
}
@@ -304,6 +309,7 @@ void scalePallete8bit2(ScaleContext &rCtx, long nStartY, long nEndY)
nLineRange = ( rCtx.mpMapIY[ nBottom ] == rCtx.mpMapIY[ nTop ] ) ? 1 :( rCtx.mpMapIY[ nBottom ] - rCtx.mpMapIY[ nTop ] );
}
+ Scanline pScanDest = rCtx.mpDest->GetScanline( nY );
for( long nX = nStartX , nXDst = 0; nX <= nEndX; nX++ )
{
long nLeft = rCtx.mbHMirr ? ( nX + 1 ) : nX;
@@ -402,7 +408,7 @@ void scalePallete8bit2(ScaleContext &rCtx, long nStartY, long nEndY)
}
BitmapColor aColRes(static_cast<sal_uInt8>(nSumR), static_cast<sal_uInt8>(nSumG), static_cast<sal_uInt8>(nSumB));
- rCtx.mpDest->SetPixel( nY, nXDst++, aColRes );
+ rCtx.mpDest->SetPixelOnData( pScanDest, nXDst++, aColRes );
}
}
}
@@ -429,6 +435,7 @@ void scalePalleteGeneral2(ScaleContext &rCtx, long nStartY, long nEndY)
nLineRange = ( rCtx.mpMapIY[ nBottom ] == rCtx.mpMapIY[ nTop ] ) ? 1 :( rCtx.mpMapIY[ nBottom ] - rCtx.mpMapIY[ nTop ] );
}
+ Scanline pScanDest = rCtx.mpDest->GetScanline( nY );
for( long nX = nStartX , nXDst = 0; nX <= nEndX; nX++ )
{
long nLeft = rCtx.mbHMirr ? ( nX + 1 ) : nX;
@@ -529,7 +536,7 @@ void scalePalleteGeneral2(ScaleContext &rCtx, long nStartY, long nEndY)
}
BitmapColor aColRes(static_cast<sal_uInt8>(nSumR), static_cast<sal_uInt8>(nSumG), static_cast<sal_uInt8>(nSumB));
- rCtx.mpDest->SetPixel( nY, nXDst++, aColRes );
+ rCtx.mpDest->SetPixelOnData( pScanDest, nXDst++, aColRes );
}
}
}
@@ -557,6 +564,7 @@ void scale24bitBGR2(ScaleContext &rCtx, long nStartY, long nEndY)
nLineRange = ( rCtx.mpMapIY[ nBottom ] == rCtx.mpMapIY[ nTop ] ) ? 1 :( rCtx.mpMapIY[ nBottom ] - rCtx.mpMapIY[ nTop ] );
}
+ Scanline pScanDest = rCtx.mpDest->GetScanline( nY );
for( long nX = nStartX , nXDst = 0; nX <= nEndX; nX++ )
{
long nLeft = rCtx.mbHMirr ? ( nX + 1 ) : nX;
@@ -652,7 +660,7 @@ void scale24bitBGR2(ScaleContext &rCtx, long nStartY, long nEndY)
nSumB /= nTotalWeightY;
}
BitmapColor aColRes(static_cast<sal_uInt8>(nSumR), static_cast<sal_uInt8>(nSumG), static_cast<sal_uInt8>(nSumB));
- rCtx.mpDest->SetPixel( nY, nXDst++, aColRes );
+ rCtx.mpDest->SetPixelOnData( pScanDest, nXDst++, aColRes );
}
}
}
@@ -679,6 +687,7 @@ void scale24bitRGB2(ScaleContext &rCtx, long nStartY, long nEndY)
nLineRange = ( rCtx.mpMapIY[ nBottom ] == rCtx.mpMapIY[ nTop ] ) ? 1 :( rCtx.mpMapIY[ nBottom ] - rCtx.mpMapIY[ nTop ] );
}
+ Scanline pScanDest = rCtx.mpDest->GetScanline( nY );
for( long nX = nStartX , nXDst = 0; nX <= nEndX; nX++ )
{
long nLeft = rCtx.mbHMirr ? ( nX + 1 ) : nX;
@@ -773,7 +782,7 @@ void scale24bitRGB2(ScaleContext &rCtx, long nStartY, long nEndY)
nSumB /= nTotalWeightY;
}
BitmapColor aColRes(static_cast<sal_uInt8>(nSumR), static_cast<sal_uInt8>(nSumG), static_cast<sal_uInt8>(nSumB));
- rCtx.mpDest->SetPixel( nY, nXDst++, aColRes );
+ rCtx.mpDest->SetPixelOnData( pScanDest, nXDst++, aColRes );
}
}
}
@@ -800,6 +809,7 @@ void scaleNonPalleteGeneral2(ScaleContext &rCtx, long nStartY, long nEndY)
nLineRange = ( rCtx.mpMapIY[ nBottom ] == rCtx.mpMapIY[ nTop ] ) ? 1 :( rCtx.mpMapIY[ nBottom ] - rCtx.mpMapIY[ nTop ] );
}
+ Scanline pScanDest = rCtx.mpDest->GetScanline( nY );
for( long nX = nStartX , nXDst = 0; nX <= nEndX; nX++ )
{
long nLeft = rCtx.mbHMirr ? ( nX + 1 ) : nX;
@@ -899,7 +909,7 @@ void scaleNonPalleteGeneral2(ScaleContext &rCtx, long nStartY, long nEndY)
}
BitmapColor aColRes(static_cast<sal_uInt8>(nSumR), static_cast<sal_uInt8>(nSumG), static_cast<sal_uInt8>(nSumB));
- rCtx.mpDest->SetPixel( nY, nXDst++, aColRes );
+ rCtx.mpDest->SetPixelOnData( pScanDest, nXDst++, aColRes );
}
}
}
diff --git a/vcl/source/gdi/alpha.cxx b/vcl/source/gdi/alpha.cxx
index e9bcdf24660d..49451eea22fa 100644
--- a/vcl/source/gdi/alpha.cxx
+++ b/vcl/source/gdi/alpha.cxx
@@ -98,9 +98,12 @@ bool AlphaMask::Replace( const Bitmap& rMask, sal_uInt8 cReplaceTransparency )
const BitmapColor aMaskWhite( pMaskAcc->GetBestMatchingColor( Color( COL_WHITE ) ) );
for( long nY = 0; nY < nHeight; nY++ )
+ {
+ Scanline pScanline = pAcc->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
if( pMaskAcc->GetPixel( nY, nX ) == aMaskWhite )
- pAcc->SetPixel( nY, nX, aReplace );
+ pAcc->SetPixelOnData( pScanline, nX, aReplace );
+ }
}
return false;
}
@@ -132,10 +135,11 @@ void AlphaMask::Replace( sal_uInt8 cSearchTransparency, sal_uInt8 cReplaceTransp
for( long nY = 0; nY < nHeight; nY++ )
{
+ Scanline pScanline = pAcc->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
{
if( pAcc->GetPixel( nY, nX ).GetIndex() == cSearchTransparency )
- pAcc->SetPixel( nY, nX, aReplace );
+ pAcc->SetPixelOnData( pScanline, nX, aReplace );
}
}
}
diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx
index 5638025e1f58..445ea36954a3 100644
--- a/vcl/source/gdi/bitmap.cxx
+++ b/vcl/source/gdi/bitmap.cxx
@@ -510,12 +510,13 @@ bool Bitmap::Mirror( BmpMirrorFlags nMirrorFlags )
for( long nY = 0; nY < nHeight; nY++ )
{
+ Scanline pScanline = pAcc->GetScanline(nY);
for( long nX = 0, nOther = nWidth1; nX < nWidth_2; nX++, nOther-- )
{
const BitmapColor aTemp( pAcc->GetPixel( nY, nX ) );
- pAcc->SetPixel( nY, nX, pAcc->GetPixel( nY, nOther ) );
- pAcc->SetPixel( nY, nOther, aTemp );
+ pAcc->SetPixelOnData( pScanline, nX, pAcc->GetPixel( nY, nOther ) );
+ pAcc->SetPixelOnData( pScanline, nOther, aTemp );
}
}
@@ -559,23 +560,26 @@ bool Bitmap::Mirror( BmpMirrorFlags nMirrorFlags )
for( long nY = 0, nOtherY = nHeight - 1; nY < nHeight_2; nY++, nOtherY-- )
{
+ Scanline pScanline = pAcc->GetScanline(nY);
+ Scanline pScanlineOther = pAcc->GetScanline(nOtherY);
for( long nX = 0, nOtherX = nWidth1; nX < nWidth; nX++, nOtherX-- )
{
const BitmapColor aTemp( pAcc->GetPixel( nY, nX ) );
- pAcc->SetPixel( nY, nX, pAcc->GetPixel( nOtherY, nOtherX ) );
- pAcc->SetPixel( nOtherY, nOtherX, aTemp );
+ pAcc->SetPixelOnData( pScanline, nX, pAcc->GetPixel( nOtherY, nOtherX ) );
+ pAcc->SetPixelOnData( pScanlineOther, nOtherX, aTemp );
}
}
// if necessary, also mirror the middle line horizontally
if( nHeight & 1 )
{
+ 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->SetPixel( nHeight_2, nX, pAcc->GetPixel( nHeight_2, nOtherX ) );
- pAcc->SetPixel( nHeight_2, nOtherX, aTemp );
+ pAcc->SetPixelOnData( pScanline, nX, pAcc->GetPixel( nHeight_2, nOtherX ) );
+ pAcc->SetPixelOnData( pScanline, nOtherX, aTemp );
}
}
@@ -627,14 +631,20 @@ bool Bitmap::Rotate( long nAngle10, const Color& rFillColor )
if( 900 == nAngle10 )
{
for( long nY = 0, nOtherX = nWidth1; nY < nNewHeight; nY++, nOtherX-- )
+ {
+ Scanline pScanline = pWriteAcc->GetScanline(nY);
for( long nX = 0, nOtherY = 0; nX < nNewWidth; nX++ )
- pWriteAcc->SetPixel( nY, nX, pReadAcc->GetPixel( nOtherY++, nOtherX ) );
+ pWriteAcc->SetPixelOnData( pScanline, nX, pReadAcc->GetPixel( nOtherY++, nOtherX ) );
+ }
}
else if( 2700 == nAngle10 )
{
for( long nY = 0, nOtherX = 0; nY < nNewHeight; nY++, nOtherX++ )
+ {
+ Scanline pScanline = pWriteAcc->GetScanline(nY);
for( long nX = 0, nOtherY = nHeight1; nX < nNewWidth; nX++ )
- pWriteAcc->SetPixel( nY, nX, pReadAcc->GetPixel( nOtherY--, nOtherX ) );
+ pWriteAcc->SetPixelOnData( pScanline, nX, pReadAcc->GetPixel( nOtherY--, nOtherX ) );
+ }
}
pWriteAcc.reset();
@@ -694,6 +704,7 @@ bool Bitmap::Rotate( long nAngle10, const Color& rFillColor )
{
long nSinY = pSinY[ nY ];
long nCosY = pCosY[ nY ];
+ Scanline pScanline = pWriteAcc->GetScanline(nY);
for( nX = 0; nX < nNewWidth; nX++ )
{
@@ -701,9 +712,9 @@ bool Bitmap::Rotate( long nAngle10, const Color& rFillColor )
nRotY = ( pSinX[ nX ] + nCosY ) >> 6;
if ( ( nRotX > -1 ) && ( nRotX < nWidth ) && ( nRotY > -1 ) && ( nRotY < nHeight ) )
- pWriteAcc->SetPixel( nY, nX, pReadAcc->GetPixel( nRotY, nRotX ) );
+ pWriteAcc->SetPixelOnData( pScanline, nX, pReadAcc->GetPixel( nRotY, nRotX ) );
else
- pWriteAcc->SetPixel( nY, nX, aFillColor );
+ pWriteAcc->SetPixelOnData( pScanline, nX, aFillColor );
}
}
@@ -751,8 +762,11 @@ bool Bitmap::Crop( const tools::Rectangle& rRectPixel )
const long nNewHeight = aNewRect.GetHeight();
for( long nY = 0, nY2 = nOldY; nY < nNewHeight; nY++, nY2++ )
+ {
+ Scanline pScanline = pWriteAcc->GetScanline(nY);
for( long nX = 0, nX2 = nOldX; nX < nNewWidth; nX++, nX2++ )
- pWriteAcc->SetPixel( nY, nX, pReadAcc->GetPixel( nY2, nX2 ) );
+ pWriteAcc->SetPixelOnData( pScanline, nX, pReadAcc->GetPixel( nY2, nX2 ) );
+ }
pWriteAcc.reset();
bRet = true;
@@ -865,19 +879,28 @@ bool Bitmap::CopyPixel( const tools::Rectangle& rRectDst,
pMap[ i ] = static_cast<sal_uInt8>(pWriteAcc->GetBestPaletteIndex( pReadAcc->GetPaletteColor( i ) ));
for( long nSrcY = aRectSrc.Top(); nSrcY < nSrcEndY; nSrcY++, nDstY++ )
+ {
+ Scanline pScanline = pWriteAcc->GetScanline(nDstY);
for( long nSrcX = aRectSrc.Left(), nDstX = aRectDst.Left(); nSrcX < nSrcEndX; nSrcX++, nDstX++ )
- pWriteAcc->SetPixelIndex( nDstY, nDstX, pMap[ pReadAcc->GetPixelIndex( nSrcY, nSrcX ) ] );
+ pWriteAcc->SetPixelOnData( pScanline, nDstX, BitmapColor( pMap[ pReadAcc->GetPixelIndex( nSrcY, nSrcX ) ] ));
+ }
}
else if( pReadAcc->HasPalette() )
{
for( long nSrcY = aRectSrc.Top(); nSrcY < nSrcEndY; nSrcY++, nDstY++ )
+ {
+ Scanline pScanline = pWriteAcc->GetScanline(nDstY);
for( long nSrcX = aRectSrc.Left(), nDstX = aRectDst.Left(); nSrcX < nSrcEndX; nSrcX++, nDstX++ )
- pWriteAcc->SetPixel( nDstY, nDstX, pReadAcc->GetPaletteColor( pReadAcc->GetPixelIndex( nSrcY, nSrcX ) ) );
+ pWriteAcc->SetPixelOnData( pScanline, nDstX, pReadAcc->GetPaletteColor( pReadAcc->GetPixelIndex( nSrcY, nSrcX ) ) );
+ }
}
else
for( long nSrcY = aRectSrc.Top(); nSrcY < nSrcEndY; nSrcY++, nDstY++ )
+ {
+ Scanline pScanline = pWriteAcc->GetScanline(nDstY);
for( long nSrcX = aRectSrc.Left(), nDstX = aRectDst.Left(); nSrcX < nSrcEndX; nSrcX++, nDstX++ )
- pWriteAcc->SetPixel( nDstY, nDstX, pReadAcc->GetPixel( nSrcY, nSrcX ) );
+ pWriteAcc->SetPixelOnData( pScanline, nDstX, pReadAcc->GetPixel( nSrcY, nSrcX ) );
+ }
pWriteAcc.reset();
bRet = ( nWidth > 0 ) && ( nHeight > 0 );
@@ -913,26 +936,38 @@ bool Bitmap::CopyPixel( const tools::Rectangle& rRectDst,
if( ( nDstX <= nSrcX ) && ( nDstY <= nSrcY ) )
{
for( long nY = nSrcY, nYN = nDstY; nY <= nSrcEndY1; nY++, nYN++ )
+ {
+ Scanline pScanline = pWriteAcc->GetScanline(nYN);
for( long nX = nSrcX, nXN = nDstX; nX <= nSrcEndX1; nX++, nXN++ )
- pWriteAcc->SetPixel( nYN, nXN, pWriteAcc->GetPixel( nY, nX ) );
+ pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixel( nY, nX ) );
+ }
}
else if( ( nDstX <= nSrcX ) && ( nDstY >= nSrcY ) )
{
for( long nY = nSrcEndY1, nYN = nDstEndY1; nY >= nSrcY; nY--, nYN-- )
+ {
+ Scanline pScanline = pWriteAcc->GetScanline(nYN);
for( long nX = nSrcX, nXN = nDstX; nX <= nSrcEndX1; nX++, nXN++ )
- pWriteAcc->SetPixel( nYN, nXN, pWriteAcc->GetPixel( nY, nX ) );
+ pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixel( nY, nX ) );
+ }
}
else if( ( nDstX >= nSrcX ) && ( nDstY <= nSrcY ) )
{
for( long nY = nSrcY, nYN = nDstY; nY <= nSrcEndY1; nY++, nYN++ )
+ {
+ Scanline pScanline = pWriteAcc->GetScanline(nYN);
for( long nX = nSrcEndX1, nXN = nDstEndX1; nX >= nSrcX; nX--, nXN-- )
- pWriteAcc->SetPixel( nYN, nXN, pWriteAcc->GetPixel( nY, nX ) );
+ pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixel( nY, nX ) );
+ }
}
else
{
for( long nY = nSrcEndY1, nYN = nDstEndY1; nY >= nSrcY; nY--, nYN-- )
+ {
+ Scanline pScanline = pWriteAcc->GetScanline(nYN);
for( long nX = nSrcEndX1, nXN = nDstEndX1; nX >= nSrcX; nX--, nXN-- )
- pWriteAcc->SetPixel( nYN, nXN, pWriteAcc->GetPixel( nY, nX ) );
+ pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixel( nY, nX ) );
+ }
}
pWriteAcc.reset();
@@ -982,9 +1017,12 @@ bool Bitmap::CopyPixel_AlphaOptimized( const tools::Rectangle& rRectDst, const t
const long nSrcEndY = aRectSrc.Top() + nHeight;
long nDstY = aRectDst.Top();
- for( long nSrcY = aRectSrc.Top(); nSrcY < nSrcEndY; nSrcY++, nDstY++ )
+ for( long nSrcY = aRectSrc.Top(); nSrcY < nSrcEndY; nSrcY++, nDstY++)
+ {
+ Scanline pScanline = pWriteAcc->GetScanline(nDstY);
for( long nSrcX = aRectSrc.Left(), nDstX = aRectDst.Left(); nSrcX < nSrcEndX; nSrcX++, nDstX++ )
- pWriteAcc->SetPixel( nDstY, nDstX, pReadAcc->GetPixel( nSrcY, nSrcX ) );
+ pWriteAcc->SetPixelOnData( pScanline, nDstX, pReadAcc->GetPixel( nSrcY, nSrcX ) );
+ }
pWriteAcc.reset();
bRet = ( nWidth > 0 ) && ( nHeight > 0 );
@@ -1020,26 +1058,38 @@ bool Bitmap::CopyPixel_AlphaOptimized( const tools::Rectangle& rRectDst, const t
if( ( nDstX <= nSrcX ) && ( nDstY <= nSrcY ) )
{
for( long nY = nSrcY, nYN = nDstY; nY <= nSrcEndY1; nY++, nYN++ )
+ {
+ Scanline pScanline = pWriteAcc->GetScanline(nYN);
for( long nX = nSrcX, nXN = nDstX; nX <= nSrcEndX1; nX++, nXN++ )
- pWriteAcc->SetPixel( nYN, nXN, pWriteAcc->GetPixel( nY, nX ) );
+ pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixel( nY, nX ) );
+ }
}
else if( ( nDstX <= nSrcX ) && ( nDstY >= nSrcY ) )
{
for( long nY = nSrcEndY1, nYN = nDstEndY1; nY >= nSrcY; nY--, nYN-- )
+ {
+ Scanline pScanline = pWriteAcc->GetScanline(nYN);
for( long nX = nSrcX, nXN = nDstX; nX <= nSrcEndX1; nX++, nXN++ )
- pWriteAcc->SetPixel( nYN, nXN, pWriteAcc->GetPixel( nY, nX ) );
+ pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixel( nY, nX ) );
+ }
}
else if( ( nDstX >= nSrcX ) && ( nDstY <= nSrcY ) )
{
for( long nY = nSrcY, nYN = nDstY; nY <= nSrcEndY1; nY++, nYN++ )
+ {
+ Scanline pScanline = pWriteAcc->GetScanline(nYN);
for( long nX = nSrcEndX1, nXN = nDstEndX1; nX >= nSrcX; nX--, nXN-- )
- pWriteAcc->SetPixel( nYN, nXN, pWriteAcc->GetPixel( nY, nX ) );
+ pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixel( nY, nX ) );
+ }
}
else
{
for( long nY = nSrcEndY1, nYN = nDstEndY1; nY >= nSrcY; nY--, nYN-- )
+ {
+ Scanline pScanline = pWriteAcc->GetScanline(nYN);
for( long nX = nSrcEndX1, nXN = nDstEndX1; nX >= nSrcX; nX--, nXN-- )
- pWriteAcc->SetPixel( nYN, nXN, pWriteAcc->GetPixel( nY, nX ) );
+ pWriteAcc->SetPixelOnData( pScanline, nXN, pWriteAcc->GetPixel( nY, nX ) );
+ }
}
pWriteAcc.reset();
@@ -1089,14 +1139,20 @@ bool Bitmap::Expand( sal_uLong nDX, sal_uLong nDY, const Color* pInitColor )
pWriteAcc->CopyScanline( nY, *pReadAcc );
if( pInitColor && nDX )
+ {
+ Scanline pScanline = pWriteAcc->GetScanline(nY);
for( nX = nNewX; nX < nNewWidth; nX++ )
- pWriteAcc->SetPixel( nY, nX, aColor );
+ pWriteAcc->SetPixelOnData( pScanline, nX, aColor );
+ }
}
if( pInitColor && nDY )
for( nY = nNewY; nY < nNewHeight; nY++ )
+ {
+ Scanline pScanline = pWriteAcc->GetScanline(nY);
for( nX = 0; nX < nNewWidth; nX++ )
- pWriteAcc->SetPixel( nY, nX, aColor );
+ pWriteAcc->SetPixelOnData( pScanline, nX, aColor );
+ }
pWriteAcc.reset();
bRet = true;
@@ -1167,12 +1223,13 @@ Bitmap Bitmap::CreateMask( const Color& rTransColor, sal_uInt8 nTol ) const
for (long nY = 0; nY < nHeight; ++nY)
{
Scanline pSrc = pReadAcc->GetScanline( nY );
+ Scanline pDst = pWriteAcc->GetScanline( nY );
for (long nX = 0, nShift = nShiftInit; nX < nWidth; nX++, nShift ^= 4)
{
if( cTest == ( ( pSrc[ nX >> 1 ] >> nShift ) & 0x0f ) )
- pWriteAcc->SetPixel( nY, nX, aWhite );
+ pWriteAcc->SetPixelOnData( pDst, nX, aWhite );
else
- pWriteAcc->SetPixel( nY, nX, aBlack );
+ pWriteAcc->SetPixelOnData( pDst, nX, aBlack );
}
}
}
@@ -1204,12 +1261,13 @@ Bitmap Bitmap::CreateMask( const Color& rTransColor, sal_uInt8 nTol ) const
for (long nY = 0; nY < nHeight; ++nY)
{
Scanline pSrc = pReadAcc->GetScanline( nY );
+ Scanline pDst = pWriteAcc->GetScanline( nY );
for (long nX = 0; nX < nWidth; ++nX)
{
if( cTest == pSrc[ nX ] )
- pWriteAcc->SetPixel( nY, nX, aWhite );
+ pWriteAcc->SetPixelOnData( pDst, nX, aWhite );
else
- pWriteAcc->SetPixel( nY, nX, aBlack );
+ pWriteAcc->SetPixelOnData( pDst, nX, aBlack );
}
}
}
@@ -1232,12 +1290,13 @@ Bitmap Bitmap::CreateMask( const Color& rTransColor, sal_uInt8 nTol ) const
// not optimized
for (long nY = 0; nY < nHeight; ++nY)
{
+ Scanline pScanline = pWriteAcc->GetScanline( nY );
for (long nX = 0; nX < nWidth; ++nX)
{
if( aTest == pReadAcc->GetPixel( nY, nX ) )
- pWriteAcc->SetPixel( nY, nX, aWhite );
+ pWriteAcc->SetPixelOnData( pScanline, nX, aWhite );
else
- pWriteAcc->SetPixel( nY, nX, aBlack );
+ pWriteAcc->SetPixelOnData( pScanline, nX, aBlack );
}
}
}
@@ -1257,6 +1316,7 @@ Bitmap Bitmap::CreateMask( const Color& rTransColor, sal_uInt8 nTol ) const
{
for( long nY = 0; nY < nHeight; nY++ )
{
+ Scanline pScanline = pWriteAcc->GetScanline( nY );
for( long nX = 0; nX < nWidth; nX++ )
{
aCol = pReadAcc->GetPaletteColor( pReadAcc->GetPixelIndex( nY, nX ) );
@@ -1268,10 +1328,10 @@ Bitmap Bitmap::CreateMask( const Color& rTransColor, sal_uInt8 nTol ) const
nMinG <= nG && nMaxG >= nG &&
nMinB <= nB && nMaxB >= nB )
{
- pWriteAcc->SetPixel( nY, nX, aWhite );
+ pWriteAcc->SetPixelOnData( pScanline, nX, aWhite );
}
else
- pWriteAcc->SetPixel( nY, nX, aBlack );
+ pWriteAcc->SetPixelOnData( pScanline, nX, aBlack );
}
}
}
@@ -1279,6 +1339,7 @@ Bitmap Bitmap::CreateMask( const Color& rTransColor, sal_uInt8 nTol ) const
{
for( long nY = 0; nY < nHeight; nY++ )
{
+ Scanline pScanline = pWriteAcc->GetScanline( nY );
for( long nX = 0; nX < nWidth; nX++ )
{
aCol = pReadAcc->GetPixel( nY, nX );
@@ -1290,10 +1351,10 @@ Bitmap Bitmap::CreateMask( const Color& rTransColor, sal_uInt8 nTol ) const
nMinG <= nG && nMaxG >= nG &&
nMinB <= nB && nMaxB >= nB )
{
- pWriteAcc->SetPixel( nY, nX, aWhite );
+ pWriteAcc->SetPixelOnData( pScanline, nX, aWhite );
}
else
- pWriteAcc->SetPixel( nY, nX, aBlack );
+ pWriteAcc->SetPixelOnData( pScanline, nX, aBlack );
}
}
}
@@ -1480,9 +1541,12 @@ bool Bitmap::Replace( const Bitmap& rMask, const Color& rReplaceColor )
aReplace = rReplaceColor;
for( long nY = 0; nY < nHeight; nY++ )
+ {
+ Scanline pScanline = pAcc->GetScanline( nY );
for( long nX = 0; nX < nWidth; nX++ )
if( pMaskAcc->GetPixel( nY, nX ) == aMaskWhite )
- pAcc->SetPixel( nY, nX, aReplace );
+ pAcc->SetPixelOnData( pScanline, nX, aReplace );
+ }
bRet = true;
}
@@ -1506,10 +1570,11 @@ bool Bitmap::Replace( const AlphaMask& rAlpha, const Color& rMergeColor )
for( long nY = 0; nY < nHeight; nY++ )
{
+ Scanline pScanline = pNewAcc->GetScanline( nY );
for( long nX = 0; nX < nWidth; nX++ )
{
aCol = pAcc->GetColor( nY, nX );
- pNewAcc->SetPixel( nY, nX, aCol.Merge( rMergeColor, 255 - pAlphaAcc->GetPixelIndex( nY, nX ) ) );
+ pNewAcc->SetPixelOnData( pScanline, nX, aCol.Merge( rMergeColor, 255 - pAlphaAcc->GetPixelIndex( nY, nX ) ) );
}
}
@@ -1587,6 +1652,7 @@ bool Bitmap::Replace( const Color& rSearchColor, const Color& rReplaceColor, sal
for( long nY = 0, nHeight = pAcc->Height(); nY < nHeight; nY++ )
{
+ Scanline pScanline = pAcc->GetScanline( nY );
for( long nX = 0, nWidth = pAcc->Width(); nX < nWidth; nX++ )
{
aCol = pAcc->GetPixel( nY, nX );
@@ -1595,7 +1661,7 @@ bool Bitmap::Replace( const Color& rSearchColor, const Color& rReplaceColor, sal
nMinG <= aCol.GetGreen() && nMaxG >= aCol.GetGreen() &&
nMinB <= aCol.GetBlue() && nMaxB >= aCol.GetBlue() )
{
- pAcc->SetPixel( nY, nX, aReplace );
+ pAcc->SetPixelOnData( pScanline, nX, aReplace );
}
}
}
@@ -1686,6 +1752,7 @@ bool Bitmap::Replace( const Color* pSearchColors, const Color* pReplaceColors,
for( long nY = 0, nHeight = pAcc->Height(); nY < nHeight; nY++ )
{
+ Scanline pScanline = pAcc->GetScanline( nY );
for( long nX = 0, nWidth = pAcc->Width(); nX < nWidth; nX++ )
{
aCol = pAcc->GetPixel( nY, nX );
@@ -1696,7 +1763,7 @@ bool Bitmap::Replace( const Color* pSearchColors, const Color* pReplaceColors,
pMinG[ i ] <= aCol.GetGreen() && pMaxG[ i ] >= aCol.GetGreen() &&
pMinB[ i ] <= aCol.GetBlue() && pMaxB[ i ] >= aCol.GetBlue() )
{
- pAcc->SetPixel( nY, nX, pReplaces[ i ] );
+ pAcc->SetPixelOnData( pScanline, nX, pReplaces[ i ] );
break;
}
}
@@ -1748,24 +1815,32 @@ bool Bitmap::CombineSimple( const Bitmap& rMask, BmpCombine eCombine )
{
case BmpCombine::And:
{
- for( long nY = 0; nY < nHeight; nY++ ) for( long nX = 0; nX < nWidth; nX++ )
+ for( long nY = 0; nY < nHeight; nY++ )
{
- if( pMaskAcc->GetPixel( nY, nX ) != aMaskBlack && pAcc->GetPixel( nY, nX ) != aBlack )
- pAcc->SetPixel( nY, nX, aWhite );
- else
- pAcc->SetPixel( nY, nX, aBlack );
+ Scanline pScanline = pAcc->GetScanline( nY );
+ for( long nX = 0; nX < nWidth; nX++ )
+ {
+ if( pMaskAcc->GetPixel( nY, nX ) != aMaskBlack && pAcc->GetPixel( nY, nX ) != aBlack )
+ pAcc->SetPixelOnData( pScanline, nX, aWhite );
+ else
+ pAcc->SetPixelOnData( pScanline, nX, aBlack );
+ }
}
}
break;
case BmpCombine::Or:
{
- for( long nY = 0; nY < nHeight; nY++ ) for( long nX = 0; nX < nWidth; nX++ )
+ for( long nY = 0; nY < nHeight; nY++ )
{
- if( pMaskAcc->GetPixel( nY, nX ) != aMaskBlack || pAcc->GetPixel( nY, nX ) != aBlack )
- pAcc->SetPixel( nY, nX, aWhite );
- else
- pAcc->SetPixel( nY, nX, aBlack );
+ Scanline pScanline = pAcc->GetScanline( nY );
+ for( long nX = 0; nX < nWidth; nX++ )
+ {
+ if( pMaskAcc->GetPixel( nY, nX ) != aMaskBlack || pAcc->GetPixel( nY, nX ) != aBlack )
+ pAcc->SetPixelOnData( pScanline, nX, aWhite );
+ else
+ pAcc->SetPixelOnData( pScanline, nX, aBlack );
+ }
}
}
break;
@@ -1798,10 +1873,13 @@ bool Bitmap::Blend( const AlphaMask& rAlpha, const Color& rBackgroundColor )
const long nHeight = std::min( pAlphaAcc->Height(), pAcc->Height() );
for( long nY = 0; nY < nHeight; ++nY )
+ {
+ Scanline pScanline = pAcc->GetScanline( nY );
for( long nX = 0; nX < nWidth; ++nX )
- pAcc->SetPixel( nY, nX,
+ pAcc->SetPixelOnData( pScanline, nX,
pAcc->GetPixel( nY, nX ).Merge( rBackgroundColor,
255 - pAlphaAcc->GetPixelIndex( nY, nX ) ) );
+ }
bRet = true;
}
diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index efa498667c0c..ee6dbb946e02 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -321,16 +321,17 @@ bool Bitmap::ImplMakeMono( sal_uInt8 cThreshold )
{
for( long nY = 0; nY < nHeight; nY++ )
{
+ Scanline pScanline = pWriteAcc->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
{
const sal_uInt8 cIndex = pReadAcc->GetPixelIndex( nY, nX );
if( pReadAcc->GetPaletteColor( cIndex ).GetLuminance() >=
cThreshold )
{
- pWriteAcc->SetPixel( nY, nX, aWhite );
+ pWriteAcc->SetPixelOnData( pScanline, nX, aWhite );
}
else
- pWriteAcc->SetPixel( nY, nX, aBlack );
+ pWriteAcc->SetPixelOnData( pScanline, nX, aBlack );
}
}
}
@@ -338,15 +339,16 @@ bool Bitmap::ImplMakeMono( sal_uInt8 cThreshold )
{
for( long nY = 0; nY < nHeight; nY++ )
{
+ Scanline pScanline = pWriteAcc->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
{
if( pReadAcc->GetPixel( nY, nX ).GetLuminance() >=
cThreshold )
{
- pWriteAcc->SetPixel( nY, nX, aWhite );
+ pWriteAcc->SetPixelOnData( pScanline, nX, aWhite );
}
else
- pWriteAcc->SetPixel( nY, nX, aBlack );
+ pWriteAcc->SetPixelOnData( pScanline, nX, aBlack );
}
}
}
@@ -402,11 +404,12 @@ bool Bitmap::ImplMakeGreyscales( sal_uInt16 nGreys )
{
for( long nY = 0; nY < nHeight; nY++ )
{
+ Scanline pScanline = pWriteAcc->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
{
const sal_uInt8 cIndex = pReadAcc->GetPixelIndex( nY, nX );
- pWriteAcc->SetPixelIndex( nY, nX,
- (pReadAcc->GetPaletteColor( cIndex ).GetLuminance() >> nShift) );
+ pWriteAcc->SetPixelOnData( pScanline, nX,
+ BitmapColor(pReadAcc->GetPaletteColor( cIndex ).GetLuminance() >> nShift) );
}
}
}
@@ -453,8 +456,11 @@ bool Bitmap::ImplMakeGreyscales( sal_uInt16 nGreys )
else
{
for( long nY = 0; nY < nHeight; nY++ )
+ {
+ Scanline pScanline = pWriteAcc->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
- pWriteAcc->SetPixelIndex( nY, nX, pReadAcc->GetPixel( nY, nX ).GetLuminance() >> nShift );
+ pWriteAcc->SetPixelOnData( pScanline, nX, BitmapColor(pReadAcc->GetPixel( nY, nX ).GetLuminance() >> nShift) );
+ }
}
pWriteAcc.reset();
@@ -520,9 +526,10 @@ bool Bitmap::ImplConvertUp(sal_uInt16 nBitCount, Color const * pExtColor)
for (long nY = 0; nY < nHeight; nY++)
{
+ Scanline pScanline = pWriteAcc->GetScanline(nY);
for (long nX = 0; nX < nWidth; nX++)
{
- pWriteAcc->SetPixel(nY, nX, pReadAcc->GetPixel(nY, nX));
+ pWriteAcc->SetPixelOnData(pScanline, nX, pReadAcc->GetPixel(nY, nX));
}
}
}
@@ -532,9 +539,10 @@ bool Bitmap::ImplConvertUp(sal_uInt16 nBitCount, Color const * pExtColor)
{
for (long nY = 0; nY < nHeight; nY++)
{
+ Scanline pScanline = pWriteAcc->GetScanline(nY);
for (long nX = 0; nX < nWidth; nX++)
{
- pWriteAcc->SetPixel(nY, nX, pReadAcc->GetPaletteColor(pReadAcc->GetPixelIndex(nY, nX)));
+ pWriteAcc->SetPixelOnData(pScanline, nX, pReadAcc->GetPaletteColor(pReadAcc->GetPixelIndex(nY, nX)));
}
}
}
@@ -542,9 +550,10 @@ bool Bitmap::ImplConvertUp(sal_uInt16 nBitCount, Color const * pExtColor)
{
for (long nY = 0; nY < nHeight; nY++)
{
+ Scanline pScanline = pWriteAcc->GetScanline(nY);
for (long nX = 0; nX < nWidth; nX++)
{
- pWriteAcc->SetPixel(nY, nX, pReadAcc->GetPixel(nY, nX));
+ pWriteAcc->SetPixelOnData(pScanline, nX, pReadAcc->GetPixel(nY, nX));
}
}
}
@@ -633,7 +642,8 @@ bool Bitmap::ImplConvertDown(sal_uInt16 nBitCount, Color const * pExtColor)
{
// first pixel in the line
cIndex = static_cast<sal_uInt8>(aColorMap.GetBestPaletteIndex(pQLine1[0].ImplGetColor()));
- pWriteAcc->SetPixelIndex(nY, 0, cIndex);
+ Scanline pScanline = pWriteAcc->GetScanline(nY);
+ pWriteAcc->SetPixelOnData(pScanline, 0, BitmapColor(cIndex));
long nX;
for (nX = 1; nX < nWidth1; nX++)
@@ -645,14 +655,14 @@ bool Bitmap::ImplConvertDown(sal_uInt16 nBitCount, Color const * pExtColor)
pQLine2[nX--].ImplAddColorError1(aErrQuad);
pQLine2[nX--].ImplAddColorError5(aErrQuad);
pQLine2[nX++].ImplAddColorError3(aErrQuad);
- pWriteAcc->SetPixelIndex(nY, nX, cIndex);
+ pWriteAcc->SetPixelOnData(pScanline, nX, BitmapColor(cIndex));
}
// Last RowPixel
if (nX < nWidth)
{
cIndex = static_cast<sal_uInt8>(aColorMap.GetBestPaletteIndex(pQLine1[nWidth1].ImplGetColor()));
- pWriteAcc->SetPixelIndex(nY, nX, cIndex);
+ pWriteAcc->SetPixelOnData(pScanline, nX, BitmapColor(cIndex));
}
// Refill/copy row buffer
@@ -731,12 +741,13 @@ bool Bitmap::ImplConvertGhosted()
for( long nY = 0; nY < nHeight; nY++ )
{
+ Scanline pScanline = pW->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
{
const BitmapColor aOld( pR->GetPixel( nY, nX ) );
- pW->SetPixel( nY, nX, BitmapColor( ( aOld.GetRed() >> 1 ) | 0x80,
- ( aOld.GetGreen() >> 1 ) | 0x80,
- ( aOld.GetBlue() >> 1 ) | 0x80 ) );
+ pW->SetPixelOnData( pScanline, nX, BitmapColor( ( aOld.GetRed() >> 1 ) | 0x80,
+ ( aOld.GetGreen() >> 1 ) | 0x80,
+ ( aOld.GetBlue() >> 1 ) | 0x80 ) );
}
}
@@ -981,9 +992,10 @@ bool Bitmap::ImplScaleFast( const double& rScaleX, const double& rScaleY )
while( nActY < nNewHeight )
{
long nMapY = pLutY[ nActY ];
+ Scanline pScanline = pWriteAcc->GetScanline(nActY);
for( long nX = 0; nX < nNewWidth; nX++ )
- pWriteAcc->SetPixel( nActY, nX, pReadAcc->GetPixel( nMapY , pLutX[ nX ] ) );
+ pWriteAcc->SetPixelOnData( pScanline, nX, pReadAcc->GetPixel( nMapY , pLutX[ nX ] ) );
while( ( nActY < nNewHeight1 ) && ( pLutY[ nActY + 1 ] == nMapY ) )
{
@@ -1057,13 +1069,15 @@ bool Bitmap::ImplScaleInterpolate( const double& rScaleX, const double& rScaleY
aCol0 = pReadAcc->GetPixel( nY, 0 );
}
+ Scanline pScanline = pWriteAcc->GetScanline(nY);
for( long nX = 0; nX < nNewWidth; nX++ )
{
- pWriteAcc->SetPixel( nY, nX, aCol0 );
+ pWriteAcc->SetPixelOnData( pScanline, nX, aCol0 );
}
}
else
{
+ Scanline pScanline = pWriteAcc->GetScanline(nY);
for( long nX = 0; nX < nNewWidth; nX++ )
{
long nTemp = pLutInt[ nX ];
@@ -1093,7 +1107,7 @@ bool Bitmap::ImplScaleInterpolate( const double& rScaleX, const double& rScaleY
aCol0.SetGreen( static_cast<sal_uInt8>( ( lXG1 * nTemp + ( lXG0 << 10 ) ) >> 10 ) );
aCol0.SetBlue( static_cast<sal_uInt8>( ( lXB1 * nTemp + ( lXB0 << 10 ) ) >> 10 ) );
- pWriteAcc->SetPixel( nY, nX, aCol0 );
+ pWriteAcc->SetPixelOnData( pScanline, nX, aCol0 );
}
}
}
@@ -1229,6 +1243,7 @@ bool Bitmap::ImplDitherMatrix()
{
for( sal_uLong nY = 0; nY < nHeight; nY++ )
{
+ Scanline pScanline = pWriteAcc->GetScanline(nY);
for( sal_uLong nX = 0, nModY = ( nY & 0x0FUL ) << 4; nX < nWidth; nX++ )
{
const BitmapColor aCol( pReadAcc->GetPaletteColor( pReadAcc->GetPixelIndex( nY, nX ) ) );
@@ -1238,7 +1253,7 @@ bool Bitmap::ImplDitherMatrix()
const sal_uLong nB = ( nVCLLut[ aCol.GetBlue() ] + nD ) >> 16;
aIndex.SetIndex( static_cast<sal_uInt8>( nVCLRLut[ nR ] + nVCLGLut[ nG ] + nVCLBLut[ nB ] ) );
- pWriteAcc->SetPixel( nY, nX, aIndex );
+ pWriteAcc->SetPixelOnData( pScanline, nX, aIndex );
}
}
}
@@ -1246,6 +1261,7 @@ bool Bitmap::ImplDitherMatrix()
{
for( sal_uLong nY = 0; nY < nHeight; nY++ )
{
+ Scanline pScanline = pWriteAcc->GetScanline(nY);
for( sal_uLong nX = 0, nModY = ( nY & 0x0FUL ) << 4; nX < nWidth; nX++ )
{
const BitmapColor aCol( pReadAcc->GetPixel( nY, nX ) );
@@ -1255,7 +1271,7 @@ bool Bitmap::ImplDitherMatrix()
const sal_uLong nB = ( nVCLLut[ aCol.GetBlue() ] + nD ) >> 16;
aIndex.SetIndex( static_cast<sal_uInt8>( nVCLRLut[ nR ] + nVCLGLut[ nG ] + nVCLBLut[ nB ] ) );
- pWriteAcc->SetPixel( nY, nX, aIndex );
+ pWriteAcc->SetPixelOnData( pScanline, nX, aIndex );
}
}
}
@@ -1373,7 +1389,8 @@ bool Bitmap::ImplDitherFloyd()
CALC_TABLES7;
nX -= 5;
CALC_TABLES5;
- pWriteAcc->SetPixelIndex( nYAcc, 0, static_cast<sal_uInt8>(nVCLBLut[ nBC ] + nVCLGLut[nGC ] + nVCLRLut[nRC ]) );
+ Scanline pScanline = pWriteAcc->GetScanline(nYAcc);
+ pWriteAcc->SetPixelOnData( pScanline, 0, BitmapColor(static_cast<sal_uInt8>(nVCLBLut[ nBC ] + nVCLGLut[nGC ] + nVCLRLut[nRC ])) );
// Get middle Pixels using a loop
long nXAcc;
@@ -1384,7 +1401,7 @@ bool Bitmap::ImplDitherFloyd()
nX -= 8;
CALC_TABLES3;
CALC_TABLES5;
- pWriteAcc->SetPixelIndex( nYAcc, nXAcc, static_cast<sal_uInt8>(nVCLBLut[ nBC ] + nVCLGLut[nGC ] + nVCLRLut[nRC ]) );
+ pWriteAcc->SetPixelOnData( pScanline, nXAcc, BitmapColor(static_cast<sal_uInt8>(nVCLBLut[ nBC ] + nVCLGLut[nGC ] + nVCLRLut[nRC ])) );
}
// Treat last Pixel separately
@@ -1392,7 +1409,7 @@ bool Bitmap::ImplDitherFloyd()
nX -= 5;
CALC_TABLES3;
CALC_TABLES5;
- pWriteAcc->SetPixelIndex( nYAcc, nWidth1, static_cast<sal_uInt8>(nVCLBLut[ nBC ] + nVCLGLut[nGC ] + nVCLRLut[nRC ]) );
+ pWriteAcc->SetPixelOnData( pScanline, nWidth1, BitmapColor(static_cast<sal_uInt8>(nVCLBLut[ nBC ] + nVCLGLut[nGC ] + nVCLRLut[nRC ])) );
}
bRet = true;
@@ -1454,7 +1471,8 @@ bool Bitmap::ImplDitherFloyd16()
aBestCol.SetRed( ( aBestCol.GetRed() & 248 ) | 7 );
aBestCol.SetGreen( ( aBestCol.GetGreen() & 248 ) | 7 );
aBestCol.SetBlue( ( aBestCol.GetBlue() & 248 ) | 7 );
- pWriteAcc->SetPixel( nY, 0, aBestCol );
+ Scanline pScanline = pWriteAcc->GetScanline(nY);
+ pWriteAcc->SetPixelOnData( pScanline, 0, aBestCol );
long nX;
for( nX = 1; nX < nWidth1; nX++ )
@@ -1468,7 +1486,7 @@ bool Bitmap::ImplDitherFloyd16()
pQLine2[ nX-- ].ImplAddColorError1( aErrQuad );
pQLine2[ nX-- ].ImplAddColorError5( aErrQuad );
pQLine2[ nX++ ].ImplAddColorError3( aErrQuad );
- pWriteAcc->SetPixel( nY, nX, aBestCol );
+ pWriteAcc->SetPixelOnData( pScanline, nX, aBestCol );
}
// Last RowPixel
@@ -1476,7 +1494,7 @@ bool Bitmap::ImplDitherFloyd16()
aBestCol.SetRed( ( aBestCol.GetRed() & 248 ) | 7 );
aBestCol.SetGreen( ( aBestCol.GetGreen() & 248 ) | 7 );
aBestCol.SetBlue( ( aBestCol.GetBlue() & 248 ) | 7 );
- pWriteAcc->SetPixel( nY, nX, aBestCol );
+ pWriteAcc->SetPixelOnData( pScanline, nX, aBestCol );
// Refill/copy row buffer
pQLine1 = pQLine2;
@@ -1560,14 +1578,20 @@ bool Bitmap::ImplReduceSimple( sal_uInt16 nColorCount )
if( pRAcc->HasPalette() )
{
for( long nY = 0; nY < nHeight; nY++ )
+ {
+ Scanline pScanline = pWAcc->GetScanline(nY);
for( long nX =0; nX < nWidth; nX++ )
- pWAcc->SetPixelIndex( nY, nX, static_cast<sal_uInt8>(aOct.GetBestPaletteIndex( pRAcc->GetPaletteColor( pRAcc->GetPixelIndex( nY, nX ) ))) );
+ pWAcc->SetPixelOnData( pScanline, nX, BitmapColor(static_cast<sal_uInt8>(aOct.GetBestPaletteIndex( pRAcc->GetPaletteColor( pRAcc->GetPixelIndex( nY, nX ) )))) );
+ }
}
else
{
for( long nY = 0; nY < nHeight; nY++ )
+ {
+ Scanline pScanline = pWAcc->GetScanline(nY);
for( long nX =0; nX < nWidth; nX++ )
- pWAcc->SetPixelIndex( nY, nX, static_cast<sal_uInt8>(aOct.GetBestPaletteIndex( pRAcc->GetPixel( nY, nX ) )) );
+ pWAcc->SetPixelOnData( pScanline, nX, BitmapColor(static_cast<sal_uInt8>(aOct.GetBestPaletteIndex( pRAcc->GetPixel( nY, nX ) ))) );
+ }
}
pWAcc.reset();
@@ -1707,13 +1731,14 @@ bool Bitmap::ImplReducePopular( sal_uInt16 nColCount )
{
for( long nY = 0; nY < nHeight; nY++ )
{
+ Scanline pScanline = pWAcc->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
{
const BitmapColor& rCol = pRAcc->GetPaletteColor( pRAcc->GetPixelIndex( nY, 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 ) ] );
- pWAcc->SetPixel( nY, nX, aDstCol );
+ pWAcc->SetPixelOnData( pScanline, nX, aDstCol );
}
}
}
@@ -1721,13 +1746,14 @@ bool Bitmap::ImplReducePopular( sal_uInt16 nColCount )
{
for( long nY = 0; nY < nHeight; nY++ )
{
+ Scanline pScanline = pWAcc->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
{
const BitmapColor aCol( pRAcc->GetPixel( nY, 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 ) ] );
- pWAcc->SetPixel( nY, nX, aDstCol );
+ pWAcc->SetPixelOnData( pScanline, nX, aDstCol );
}
}
}
@@ -1818,8 +1844,11 @@ bool Bitmap::ImplReduceMedian( sal_uInt16 nColCount )
InverseColorMap aMap( aPal );
pWAcc->SetPalette( aPal );
for( long nY = 0; nY < nHeight; nY++ )
+ {
+ Scanline pScanline = pWAcc->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
- pWAcc->SetPixelIndex( nY, nX, static_cast<sal_uInt8>( aMap.GetBestPaletteIndex( pRAcc->GetColor( nY, nX ) )) );
+ pWAcc->SetPixelOnData( pScanline, nX, BitmapColor(static_cast<sal_uInt8>( aMap.GetBestPaletteIndex( pRAcc->GetColor( nY, nX ) ))) );
+ }
rtl_freeMemory( pColBuf );
pWAcc.reset();
@@ -2108,13 +2137,14 @@ bool Bitmap::Adjust( short nLuminancePercent, short nContrastPercent,
{
for( long nY = 0; nY < nH; nY++ )
{
+ Scanline pScanline = pAcc->GetScanline(nY);
for( long nX = 0; nX < nW; nX++ )
{
aCol = pAcc->GetPixel( nY, nX );
aCol.SetRed( cMapR[ aCol.GetRed() ] );
aCol.SetGreen( cMapG[ aCol.GetGreen() ] );
aCol.SetBlue( cMapB[ aCol.GetBlue() ] );
- pAcc->SetPixel( nY, nX, aCol );
+ pAcc->SetPixelOnData( pScanline, nX, aCol );
}
}
}
diff --git a/vcl/source/gdi/bitmap4.cxx b/vcl/source/gdi/bitmap4.cxx
index e8677625618d..2e97c9cefc48 100644
--- a/vcl/source/gdi/bitmap4.cxx
+++ b/vcl/source/gdi/bitmap4.cxx
@@ -194,6 +194,7 @@ bool Bitmap::ImplConvolute3( const long* pMatrix )
// do convolution
for( nY = 0; nY < nHeight; )
{
+ Scanline pScanline = pWriteAcc->GetScanline(nY);
for( nX = 0; nX < nWidth; nX++ )
{
// first row
@@ -236,9 +237,9 @@ bool Bitmap::ImplConvolute3( const long* pMatrix )
nSumB += pTmp[ pColor->GetBlue() ];
// calculate destination color
- pWriteAcc->SetPixel( nY, nX, BitmapColor( static_cast<sal_uInt8>(MinMax( nSumR / nDivisor, 0, 255 )),
- static_cast<sal_uInt8>(MinMax( nSumG / nDivisor, 0, 255 )),
- static_cast<sal_uInt8>(MinMax( nSumB / nDivisor, 0, 255 )) ) );
+ pWriteAcc->SetPixelOnData( pScanline, nX, BitmapColor( static_cast<sal_uInt8>(MinMax( nSumR / nDivisor, 0, 255 )),
+ static_cast<sal_uInt8>(MinMax( nSumG / nDivisor, 0, 255 )),
+ static_cast<sal_uInt8>(MinMax( nSumB / nDivisor, 0, 255 )) ) );
}
if( ++nY < nHeight )
@@ -350,6 +351,7 @@ bool Bitmap::ImplMedianFilter()
// do median filtering
for( nY = 0; nY < nHeight; )
{
+ Scanline pScanline = pWriteAcc->GetScanline(nY);
for( nX = 0; nX < nWidth; nX++ )
{
nR1 = ( pColor = pRowTmp1 + nX )->GetRed();
@@ -398,7 +400,7 @@ bool Bitmap::ImplMedianFilter()
MNMX3( nB9, nB2, nB3 );
// set destination color
- pWriteAcc->SetPixel( nY, nX, BitmapColor( static_cast<sal_uInt8>(nR2), static_cast<sal_uInt8>(nG2), static_cast<sal_uInt8>(nB2) ) );
+ pWriteAcc->SetPixelOnData( pScanline, nX, BitmapColor( static_cast<sal_uInt8>(nR2), static_cast<sal_uInt8>(nG2), static_cast<sal_uInt8>(nB2) ) );
}
if( ++nY < nHeight )
@@ -511,6 +513,7 @@ bool Bitmap::ImplSobelGrey()
nGrey32 = pReadAcc->GetPixel( pVMap[ nY + 2 ], pHMap[ 1 ] ).GetIndex();
nGrey33 = pReadAcc->GetPixel( pVMap[ nY + 2 ], pHMap[ 2 ] ).GetIndex();
+ Scanline pScanline = pWriteAcc->GetScanline(nY);
for( nX = 0; nX < nWidth; nX++ )
{
nSum1 = nSum2 = 0;
@@ -544,7 +547,7 @@ bool Bitmap::ImplSobelGrey()
nSum1 = static_cast<long>(sqrt( static_cast<double>( nSum1 * nSum1 + nSum2 * nSum2 ) ));
aGrey.SetIndex( ~static_cast<sal_uInt8>(SAL_BOUND( nSum1, 0, 255 )) );
- pWriteAcc->SetPixel( nY, nX, aGrey );
+ pWriteAcc->SetPixelOnData( pScanline, nX, aGrey );
if( nX < ( nWidth - 1 ) )
{
@@ -641,6 +644,7 @@ bool Bitmap::ImplEmbossGrey( const BmpFilterParam* pFilterParam )
nGrey32 = pReadAcc->GetPixel( pVMap[ nY + 2 ], pHMap[ 1 ] ).GetIndex();
nGrey33 = pReadAcc->GetPixel( pVMap[ nY + 2 ], pHMap[ 2 ] ).GetIndex();
+ Scanline pScanline = pWriteAcc->GetScanline(nY);
for( nX = 0; nX < nWidth; nX++ )
{
nNx = nGrey11 + nGrey21 + nGrey31 - nGrey13 - nGrey23 - nGrey33;
@@ -656,7 +660,7 @@ bool Bitmap::ImplEmbossGrey( const BmpFilterParam* pFilterParam )
aGrey.SetIndex( static_cast<sal_uInt8>(SAL_BOUND( fGrey, 0, 255 )) );
}
- pWriteAcc->SetPixel( nY, nX, aGrey );
+ pWriteAcc->SetPixelOnData( pScanline, nX, aGrey );
if( nX < ( nWidth - 1 ) )
{
@@ -724,12 +728,13 @@ bool Bitmap::ImplSolarize( const BmpFilterParam* pFilterParam )
for( long nY = 0; nY < nHeight ; nY++ )
{
+ Scanline pScanline = pWriteAcc->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
{
aCol = pWriteAcc->GetPixel( nY, nX );
if( aCol.GetLuminance() >= cThreshold )
- pWriteAcc->SetPixel( nY, nX, aCol.Invert() );
+ pWriteAcc->SetPixelOnData( pScanline, nX, aCol.Invert() );
}
}
}
@@ -774,18 +779,18 @@ bool Bitmap::ImplSepia( const BmpFilterParam* pFilterParam )
if( pReadAcc->HasPalette() )
{
+ const sal_uInt16 nPalCount = pReadAcc->GetPaletteEntryCount();
+ std::unique_ptr<sal_uInt8[]> pIndexMap( new sal_uInt8[ nPalCount ] );
+ for( sal_uInt16 i = 0; i < nPalCount; i++ )
+ pIndexMap[ i ] = pReadAcc->GetPaletteColor( i ).GetLuminance();
+
for( long nY = 0; nY < nHeight ; nY++ )
{
- const sal_uInt16 nPalCount = pReadAcc->GetPaletteEntryCount();
- std::unique_ptr<sal_uInt8[]> pIndexMap( new sal_uInt8[ nPalCount ] );
-
- for( sal_uInt16 i = 0; i < nPalCount; i++ )
- pIndexMap[ i ] = pReadAcc->GetPaletteColor( i ).GetLuminance();
-
+ Scanline pScanline = pWriteAcc->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
{
aCol.SetIndex( pIndexMap[ pReadAcc->GetPixel( nY, nX ).GetIndex() ] );
- pWriteAcc->SetPixel( nY, nX, aCol );
+ pWriteAcc->SetPixelOnData( pScanline, nX, aCol );
}
}
}
@@ -793,10 +798,11 @@ bool Bitmap::ImplSepia( const BmpFilterParam* pFilterParam )
{
for( long nY = 0; nY < nHeight ; nY++ )
{
+ Scanline pScanline = pWriteAcc->GetScanline(nY);
for( long nX = 0; nX < nWidth; nX++ )
{
aCol.SetIndex( pReadAcc->GetPixel( nY, nX ).GetLuminance() );
- pWriteAcc->SetPixel( nY, nX, aCol );
+ pWriteAcc->SetPixelOnData( pScanline, nX, aCol );
}
}
}
@@ -904,8 +910,11 @@ bool Bitmap::ImplMosaic( const BmpFilterParam* pFilterParam )
aCol.SetBlue( static_cast<sal_uInt8>( nSumB * fArea_1 ) );
for( nY = nY1; nY <= nY2; nY++ )
+ {
+ Scanline pScanline = pWriteAcc->GetScanline(nY);
for( nX = nX1; nX <= nX2; nX++ )
- pWriteAcc->SetPixel( nY, nX, aCol );
+ pWriteAcc->SetPixelOnData( pScanline, nX, aCol );
+ }
nX1 += nTileWidth; nX2 += nTileWidth;
@@ -937,8 +946,11 @@ bool Bitmap::ImplMosaic( const BmpFilterParam* pFilterParam )
aCol.SetBlue( static_cast<sal_uInt8>( nSumB * fArea_1 ) );
for( nY = nY1; nY <= nY2; nY++ )
+ {
+ Scanline pScanline = pWriteAcc->GetScanline(nY);
for( nX = nX1; nX <= nX2; nX++ )
- pWriteAcc->SetPixel( nY, nX, aCol );
+ pWriteAcc->SetPixelOnData( pScanline, nX, aCol );
+ }
nX1 += nTileWidth; nX2 += nTileWidth;
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index e9f7eee83cbd..30e12324509e 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -837,14 +837,15 @@ namespace
for(long y(0); y < aDestinationSizePixel.getHeight(); y++)
{
+ Scanline pScanline = xWrite->GetScanline( y );
for(long x(0); x < aDestinationSizePixel.getWidth(); x++)
{
const basegfx::B2DPoint aSourceCoor(rTransform * basegfx::B2DPoint(x, y));
if(bSmooth)
{
- xWrite->SetPixel(
- y,
+ xWrite->SetPixelOnData(
+ pScanline,
x,
xRead->GetInterpolatedColorWithFallback(
aSourceCoor.getY(),
@@ -855,8 +856,8 @@ namespace
{
// this version does the correct <= 0.0 checks, so no need
// to do the static_cast< sal_Int32 > self and make an error
- xWrite->SetPixel(
- y,
+ xWrite->SetPixelOnData(
+ pScanline,
x,
xRead->GetColorWithFallback(
aSourceCoor.getY(),
@@ -1099,6 +1100,7 @@ BitmapEx BitmapEx::ModifyBitmapEx(const basegfx::BColorModifierStack& rBColorMod
{
for(sal_uInt32 y(0); y < static_cast<sal_uInt32>(xContent->Height()); y++)
{
+ Scanline pScanline = xContent->GetScanline( y );
for(sal_uInt32 x(0); x < static_cast<sal_uInt32>(xContent->Width()); x++)
{
const BitmapColor aBMCol(xContent->GetColor(y, x));
@@ -1108,7 +1110,7 @@ BitmapEx BitmapEx::ModifyBitmapEx(const basegfx::BColorModifierStack& rBColorMod
static_cast<double>(aBMCol.GetBlue()) * fConvertColor);
const basegfx::BColor aBDest(rModifier->getModifiedColor(aBSource));
- xContent->SetPixel(y, x, BitmapColor(Color(aBDest)));
+ xContent->SetPixelOnData(pScanline, x, BitmapColor(Color(aBDest)));
}
}
}
@@ -1210,10 +1212,12 @@ BitmapEx createBlendFrame(
{
long x(0);
long y(0);
+ Scanline pScanContent = pContent->GetScanline( 0 );
+ Scanline pScanAlpha = pContent->GetScanline( 0 );
// x == 0, y == 0, top-left corner
- pContent->SetPixel(0, 0, aColorTopLeft);
- pAlpha->SetPixelIndex(0, 0, nAlpha);
+ pContent->SetPixelOnData(pScanContent, 0, aColorTopLeft);
+ pAlpha->SetPixelOnData(pScanAlpha, 0, BitmapColor(nAlpha));
// y == 0, top line left to right
for(x = 1; x < nW - 1; x++)
@@ -1221,26 +1225,28 @@ BitmapEx createBlendFrame(
Color aMix(aColorTopLeft);
aMix.Merge(aColorTopRight, 255 - sal_uInt8((x * 255) / nW));
- pContent->SetPixel(0, x, aMix);
- pAlpha->SetPixelIndex(0, x, nAlpha);
+ pContent->SetPixelOnData(pScanContent, x, aMix);
+ pAlpha->SetPixelOnData(pScanAlpha, x, BitmapColor(nAlpha));
}
// x == nW - 1, y == 0, top-right corner
// #i123690# Caution! When nW is 1, x == nW is possible (!)
if(x < nW)
{
- pContent->SetPixel(0, x, aColorTopRight);
- pAlpha->SetPixelIndex(0, x, nAlpha);
+ pContent->SetPixelOnData(pScanContent, x, aColorTopRight);
+ pAlpha->SetPixelOnData(pScanAlpha, x, BitmapColor(nAlpha));
}
// x == 0 and nW - 1, left and right line top-down
for(y = 1; y < nH - 1; y++)
{
+ pScanContent = pContent->GetScanline( y );
+ pScanAlpha = pContent->GetScanline( y );
Color aMixA(aColorTopLeft);
aMixA.Merge(aColorBottomLeft, 255 - sal_uInt8((y * 255) / nH));
- pContent->SetPixel(y, 0, aMixA);
- pAlpha->SetPixelIndex(y, 0, nAlpha);
+ pContent->SetPixelOnData(pScanContent, 0, aMixA);
+ pAlpha->SetPixelOnData(pScanAlpha, 0, BitmapColor(nAlpha));
// #i123690# Caution! When nW is 1, x == nW is possible (!)
if(x < nW)
@@ -1248,8 +1254,8 @@ BitmapEx createBlendFrame(
Color aMixB(aColorTopRight);
aMixB.Merge(aColorBottomRight, 255 - sal_uInt8((y * 255) / nH));
- pContent->SetPixel(y, x, aMixB);
- pAlpha->SetPixelIndex(y, x, nAlpha);
+ pContent->SetPixelOnData(pScanContent, x, aMixB);
+ pAlpha->SetPixelOnData(pScanAlpha, x, BitmapColor(nAlpha));
}
}
@@ -1257,8 +1263,8 @@ BitmapEx createBlendFrame(
if(y < nH)
{
// x == 0, y == nH - 1, bottom-left corner
- pContent->SetPixel(y, 0, aColorBottomLeft);
- pAlpha->SetPixelIndex(y, 0, nAlpha);
+ pContent->SetPixelOnData(pScanContent, 0, aColorBottomLeft);
+ pAlpha->SetPixelOnData(pScanAlpha, 0, BitmapColor(nAlpha));
// y == nH - 1, bottom line left to right
for(x = 1; x < nW - 1; x++)
@@ -1266,16 +1272,16 @@ BitmapEx createBlendFrame(
Color aMix(aColorBottomLeft);
aMix.Merge(aColorBottomRight, 255 - sal_uInt8(((x - 0)* 255) / nW));
- pContent->SetPixel(y, x, aMix);
- pAlpha->SetPixelIndex(y, x, nAlpha);
+ pContent->SetPixelOnData(pScanContent, x, aMix);
+ pAlpha->SetPixelOnData(pScanAlpha, x, BitmapColor(nAlpha));
}
// x == nW - 1, y == nH - 1, bottom-right corner
// #i123690# Caution! When nW is 1, x == nW is possible (!)
if(x < nW)
{
- pContent->SetPixel(y, x, aColorBottomRight);
- pAlpha->SetPixelIndex(y, x, nAlpha);
+ pContent->SetPixelOnData(pScanContent, x, aColorBottomRight);
+ pAlpha->SetPixelOnData(pScanAlpha, x, BitmapColor(nAlpha));
}
}
diff --git a/vcl/source/gdi/bmpacc.cxx b/vcl/source/gdi/bmpacc.cxx
index 858e9b2f542f..ad6b8ead20f2 100644
--- a/vcl/source/gdi/bmpacc.cxx
+++ b/vcl/source/gdi/bmpacc.cxx
@@ -374,9 +374,12 @@ void BitmapWriteAccess::CopyScanline( long nY, const BitmapReadAccess& rReadAcc
memcpy(GetScanline(nY), rReadAcc.GetScanline(nY), rReadAcc.GetScanlineSize());
}
else
+ {
// TODO: use fastbmp infrastructure
+ Scanline pScanline = GetScanline( nY );
for( long nX = 0, nWidth = std::min( mpBuffer->mnWidth, rReadAcc.Width() ); nX < nWidth; nX++ )
- SetPixel( nY, nX, rReadAcc.GetPixel( nY, nX ) );
+ SetPixelOnData( pScanline, nX, rReadAcc.GetPixel( nY, nX ) );
+ }
}
void BitmapWriteAccess::CopyScanline( long nY, ConstScanline aSrcScanline,
diff --git a/vcl/source/gdi/bmpacc3.cxx b/vcl/source/gdi/bmpacc3.cxx
index f8aeb5c99bf9..6196fd7e6435 100644
--- a/vcl/source/gdi/bmpacc3.cxx
+++ b/vcl/source/gdi/bmpacc3.cxx
@@ -248,9 +248,10 @@ void BitmapWriteAccess::FillRect( const tools::Rectangle& rRect )
for (long nY = nStartY; nY <= nEndY; nY++)
{
+ Scanline pScanline = GetScanline( nY );
for (long nX = nStartX; nX <= nEndX; nX++)
{
- SetPixel(nY, nX, rFillColor);
+ SetPixelOnData(pScanline, nX, rFillColor);
}
}
}
diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx
index bebee1458e9e..4393e2c63053 100644
--- a/vcl/source/gdi/dibtools.cxx
+++ b/vcl/source/gdi/dibtools.cxx
@@ -323,7 +323,7 @@ bool ImplReadDIBPalette(SvStream& rIStm, BitmapPalette& rPal, bool bQuad)
namespace
{
- sal_uInt8 SanitizePaletteIndex(sal_uInt8 nIndex, BitmapPalette& rPalette, bool bForceToMonoWhileReading)
+ BitmapColor SanitizePaletteIndex(sal_uInt8 nIndex, BitmapPalette& rPalette, bool bForceToMonoWhileReading)
{
const sal_uInt16 nPaletteEntryCount = rPalette.GetEntryCount();
if (nPaletteEntryCount && nIndex >= nPaletteEntryCount)
@@ -337,10 +337,10 @@ namespace
if (nPaletteEntryCount && bForceToMonoWhileReading)
{
- return static_cast<sal_uInt8>(rPalette[nIndex].GetLuminance() >= 255);
+ return BitmapColor(static_cast<sal_uInt8>(rPalette[nIndex].GetLuminance() >= 255));
}
- return nIndex;
+ return BitmapColor(nIndex);
}
BitmapColor SanitizeColor(const BitmapColor &rColor, bool bForceToMonoWhileReading)
diff --git a/vcl/source/helper/canvastools.cxx b/vcl/source/helper/canvastools.cxx
index 9a56f52219da..ba653f00ba35 100644
--- a/vcl/source/helper/canvastools.cxx
+++ b/vcl/source/helper/canvastools.cxx
@@ -113,8 +113,10 @@ namespace vcl
if( !equalsLayout(aCurrLayout, rLayout) )
return false; // re-read bmp from the start
+ Scanline pScanline = rWriteAcc->GetScanline( aRect.Y1 );
if( rAlphaAcc.get() )
{
+ Scanline pScanlineAlpha = rAlphaAcc->GetScanline( aRect.Y1 );
// read ARGB color
aARGBColors = rLayout.ColorSpace->convertIntegerToARGB(aPixelData);
@@ -123,12 +125,12 @@ namespace vcl
for( sal_Int32 x=0; x<nWidth; ++x )
{
const rendering::ARGBColor& rColor=aARGBColors[x];
- rWriteAcc->SetPixelIndex( aRect.Y1, x,
- static_cast<sal_uInt8>(rWriteAcc->GetBestPaletteIndex(
+ rWriteAcc->SetPixelOnData( pScanline, x,
+ BitmapColor(static_cast<sal_uInt8>(rWriteAcc->GetBestPaletteIndex(
BitmapColor( toByteColor(rColor.Red),
toByteColor(rColor.Green),
- toByteColor(rColor.Blue)))) );
- rAlphaAcc->SetPixel( aRect.Y1, x,
+ toByteColor(rColor.Blue))))) );
+ rAlphaAcc->SetPixelOnData( pScanlineAlpha, x,
BitmapColor( 255 - toByteColor(rColor.Alpha) ));
}
}
@@ -137,11 +139,11 @@ namespace vcl
for( sal_Int32 x=0; x<nWidth; ++x )
{
const rendering::ARGBColor& rColor=aARGBColors[x];
- rWriteAcc->SetPixel( aRect.Y1, x,
+ rWriteAcc->SetPixelOnData( pScanline, x,
BitmapColor( toByteColor(rColor.Red),
toByteColor(rColor.Green),
toByteColor(rColor.Blue) ));
- rAlphaAcc->SetPixel( aRect.Y1, x,
+ rAlphaAcc->SetPixelOnData( pScanlineAlpha, x,
BitmapColor( 255 - toByteColor(rColor.Alpha) ));
}
}
@@ -155,11 +157,11 @@ namespace vcl
for( sal_Int32 x=0; x<nWidth; ++x )
{
const rendering::RGBColor& rColor=aRGBColors[x];
- rWriteAcc->SetPixelIndex( aRect.Y1, x,
- static_cast<sal_uInt8>(rWriteAcc->GetBestPaletteIndex(
+ rWriteAcc->SetPixelOnData( pScanline, x,
+ BitmapColor(static_cast<sal_uInt8>(rWriteAcc->GetBestPaletteIndex(
BitmapColor( toByteColor(rColor.Red),
toByteColor(rColor.Green),
- toByteColor(rColor.Blue)))) );
+ toByteColor(rColor.Blue))))) );
}
}
else
@@ -167,7 +169,7 @@ namespace vcl
for( sal_Int32 x=0; x<nWidth; ++x )
{
const rendering::RGBColor& rColor=aRGBColors[x];
- rWriteAcc->SetPixel( aRect.Y1, x,
+ rWriteAcc->SetPixelOnData( pScanline, x,
BitmapColor( toByteColor(rColor.Red),
toByteColor(rColor.Green),
toByteColor(rColor.Blue) ));
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index 92c603487396..654a6df2ef6f 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -1430,6 +1430,8 @@ Bitmap OutputDevice::BlendBitmapWithAlpha(
const long nModY = ( nOutY & 0x0FL ) << 4;
int nOutX;
+ Scanline pScanline = pW->GetScanline(nY);
+ Scanline pScanlineAlpha = pAlphaW->GetScanline(nY);
for( nX = 0, nOutX = nOffX; nX < nDstWidth; nX++, nOutX++ )
{
const long nMapX = pMapX[ nX ];
@@ -1440,12 +1442,12 @@ Bitmap OutputDevice::BlendBitmapWithAlpha(
aIndex.SetIndex( static_cast<sal_uInt8>( nVCLRLut[ ( nVCLLut[ aDstCol.GetRed() ] + nD ) >> 16 ] +
nVCLGLut[ ( nVCLLut[ aDstCol.GetGreen() ] + nD ) >> 16 ] +
nVCLBLut[ ( nVCLLut[ aDstCol.GetBlue() ] + nD ) >> 16 ] ) );
- pW->SetPixel( nY, nX, aIndex );
+ pW->SetPixelOnData( pScanline, nX, aIndex );
aIndex.SetIndex( static_cast<sal_uInt8>( nVCLRLut[ ( nVCLLut[ 255-nResAlpha ] + nD ) >> 16 ] +
nVCLGLut[ ( nVCLLut[ 255-nResAlpha ] + nD ) >> 16 ] +
nVCLBLut[ ( nVCLLut[ 255-nResAlpha ] + nD ) >> 16 ] ) );
- pAlphaW->SetPixel( nY, nX, aIndex );
+ pAlphaW->SetPixelOnData( pScanlineAlpha, nX, aIndex );
}
}
}
@@ -1461,14 +1463,16 @@ Bitmap OutputDevice::BlendBitmapWithAlpha(
for( nY = 0; nY < nDstHeight; nY++ )
{
const long nMapY = pMapY[ nY ];
+ Scanline pScanlineB = pB->GetScanline(nY);
+ Scanline pScanlineAlpha = pAlphaW->GetScanline(nY);
for( nX = 0; nX < nDstWidth; nX++ )
{
const long nMapX = pMapX[ nX ];
aDstCol = AlphaBlend( nX, nY, nMapX, nMapY, pP, pA, pB.get(), pAlphaW.get(), nResAlpha );
- pB->SetPixel(nY, nX, pB->GetBestMatchingColor(aDstCol));
- pAlphaW->SetPixel(nY, nX, pB->GetBestMatchingColor(Color(255L-nResAlpha, 255L-nResAlpha, 255L-nResAlpha)));
+ pB->SetPixelOnData(pScanlineB, nX, pB->GetBestMatchingColor(aDstCol));
+ pAlphaW->SetPixelOnData(pScanlineAlpha, nX, pB->GetBestMatchingColor(Color(255L-nResAlpha, 255L-nResAlpha, 255L-nResAlpha)));
}
}
}
@@ -1523,6 +1527,7 @@ Bitmap OutputDevice::BlendBitmap(
const long nModY = ( nOutY & 0x0FL ) << 4;
int nOutX;
+ Scanline pScanline = pW->GetScanline(nY);
for( nX = 0, nOutX = nOffX; nX < nDstWidth; nX++, nOutX++ )
{
long nMapX = pMapX[ nX ];
@@ -1537,7 +1542,7 @@ Bitmap OutputDevice::BlendBitmap(
aIndex.SetIndex( static_cast<sal_uInt8>( nVCLRLut[ ( nVCLLut[ aDstCol.GetRed() ] + nD ) >> 16 ] +
nVCLGLut[ ( nVCLLut[ aDstCol.GetGreen() ] + nD ) >> 16 ] +
nVCLBLut[ ( nVCLLut[ aDstCol.GetBlue() ] + nD ) >> 16 ] ) );
- pW->SetPixel( nY, nX, aIndex );
+ pW->SetPixelOnData( pScanline, nX, aIndex );
}
}
}
@@ -1575,8 +1580,9 @@ Bitmap OutputDevice::BlendBitmap(
{
nMapY = aBmpRect.Bottom() - nMapY;
}
- Scanline pPScan = pP->GetScanline( nMapY );
- Scanline pAScan = pA->GetScanline( nMapY );
+ Scanline pPScan = pP->GetScanline( nMapY );
+ Scanline pAScan = pA->GetScanline( nMapY );
+ Scanline pBScan = pB->GetScanline( nY );
for( nX = 0; nX < nDstWidth; nX++ )
{
@@ -1587,8 +1593,8 @@ Bitmap OutputDevice::BlendBitmap(
nMapX = aBmpRect.Right() - nMapX;
}
aDstCol = pB->GetPixel( nY, nX );
- pB->SetPixel( nY, nX, aDstCol.Merge( pP->GetPaletteColor( pPScan[ nMapX ] ),
- pAScan[ nMapX ] ) );
+ pB->SetPixelOnData( pBScan, nX, aDstCol.Merge( pP->GetPaletteColor( pPScan[ nMapX ] ),
+ pAScan[ nMapX ] ) );
}
}
}
@@ -1605,8 +1611,8 @@ Bitmap OutputDevice::BlendBitmap(
{
nMapY = aBmpRect.Bottom() - nMapY;
}
- Scanline pAScan = pA->GetScanline( nMapY );
-
+ Scanline pAScan = pA->GetScanline( nMapY );
+ Scanline pBScan = pB->GetScanline(nY);
for( nX = 0; nX < nDstWidth; nX++ )
{
long nMapX = pMapX[ nX ];
@@ -1616,7 +1622,7 @@ Bitmap OutputDevice::BlendBitmap(
nMapX = aBmpRect.Right() - nMapX;
}
aDstCol = pB->GetPixel( nY, nX );
- pB->SetPixel( nY, nX, aDstCol.Merge( pP->GetColor( nMapY, nMapX ),
+ pB->SetPixelOnData( pBScan, nX, aDstCol.Merge( pP->GetColor( nMapY, nMapX ),
pAScan[ nMapX ] ) );
}
}
diff --git a/vcl/source/outdev/transparent.cxx b/vcl/source/outdev/transparent.cxx
index e57a9f62a824..04779af7617d 100644
--- a/vcl/source/outdev/transparent.cxx
+++ b/vcl/source/outdev/transparent.cxx
@@ -525,11 +525,12 @@ void OutputDevice::EmulateDrawTransparent ( const tools::PolyPolygon& rPolyPoly,
{
for( nY = 0; nY < nHeight; nY++ )
{
+ Scanline pScanline = pW->GetScanline(nY);
for( nX = 0; nX < nWidth; nX++ )
{
if( pR->GetPixel( nY, nX ) == aBlack )
{
- pW->SetPixel( nY, nX, pMap[ pW->GetPixel( nY, nX ).GetIndex() ] );
+ pW->SetPixelOnData( pScanline, nX, pMap[ pW->GetPixel( nY, nX ).GetIndex() ] );
}
}
}
@@ -569,12 +570,13 @@ void OutputDevice::EmulateDrawTransparent ( const tools::PolyPolygon& rPolyPoly,
{
for( nY = 0; nY < nHeight; nY++ )
{
+ Scanline pScanline = pW->GetScanline(nY);
for( nX = 0; nX < nWidth; nX++ )
{
if( pR->GetPixel( nY, nX ) == aBlack )
{
aPixCol = pW->GetColor( nY, nX );
- pW->SetPixel( nY, nX, aPixCol.Merge( aFillCol, cTrans ) );
+ pW->SetPixelOnData(pScanline, nX, aPixCol.Merge( aFillCol, cTrans ) );
}
}
}