diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2018-01-30 20:40:19 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-06 07:39:11 +0100 |
commit | 3e0efdb50cd9bcf1749993607330ea1567eb33a2 (patch) | |
tree | c740dfc9b598480d5168282154045bbc938f6862 | |
parent | f38e35338e3010f137d7b35fa3150792fabfa825 (diff) |
convert SetPixel->SetPixelOnData
by extracting out the Y scanline computation from the innermost
loop.
Inspired by commit 078d01c1b6cb9bbd80aeadc49a71cc817413164c.
Change-Id: Ic3c1827c01ed3aec629975749a551c7a68ae4a5e
Reviewed-on: https://gerrit.libreoffice.org/48926
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
32 files changed, 436 insertions, 236 deletions
diff --git a/canvas/source/vcl/canvasbitmaphelper.cxx b/canvas/source/vcl/canvasbitmaphelper.cxx index f3f3995a889b..bdb4444016fd 100644 --- a/canvas/source/vcl/canvasbitmaphelper.cxx +++ b/canvas/source/vcl/canvasbitmaphelper.cxx @@ -308,17 +308,20 @@ namespace vclcanvas default: { + Scanline pScan = pWriteAccess->GetScanline( y ); + Scanline pAScan = pAlphaWriteAccess->GetScanline( y ); + for( long x=rect.X1; x<aBmpSize.Width() && x<rect.X2; ++x ) { - pWriteAccess->SetPixel( y, x, BitmapColor( data[ nCurrPos ], + pWriteAccess->SetPixelOnData( pScan, x, BitmapColor( data[ nCurrPos ], data[ nCurrPos+1 ], data[ nCurrPos+2 ] ) ); nCurrPos += 3; // cast to unsigned byte, for correct subtraction result - pAlphaWriteAccess->SetPixel( y, x, + pAlphaWriteAccess->SetPixelOnData( pAScan, x, BitmapColor( static_cast<sal_uInt8>(255 - static_cast<sal_uInt8>(data[ nCurrPos++ ])) ) ); @@ -387,11 +390,13 @@ namespace vclcanvas default: { + Scanline pScan = pWriteAccess->GetScanline( y ); + for( long x=rect.X1; x<aBmpSize.Width() && x<rect.X2; ++x ) { - pWriteAccess->SetPixel( y, x, BitmapColor( data[ nCurrPos ], + pWriteAccess->SetPixelOnData( pScan, x, BitmapColor( data[ nCurrPos ], data[ nCurrPos+1 ], data[ nCurrPos+2 ] ) ); nCurrPos += 4; // skip three colors, _plus_ alpha diff --git a/canvas/source/vcl/canvashelper.cxx b/canvas/source/vcl/canvashelper.cxx index f75f6344c575..761a2fdc22b1 100644 --- a/canvas/source/vcl/canvashelper.cxx +++ b/canvas/source/vcl/canvashelper.cxx @@ -1094,9 +1094,11 @@ namespace vclcanvas default: { + Scanline pScan = pWriteAccess->GetScanline( y ); + for( x=0; x<nWidth; ++x ) { - pWriteAccess->SetPixel( y, x, BitmapColor( data[ nCurrPos ], + pWriteAccess->SetPixelOnData( pScan, x, BitmapColor( data[ nCurrPos ], data[ nCurrPos+1 ], data[ nCurrPos+2 ] ) ); nCurrPos += 4; diff --git a/canvas/source/vcl/impltools.cxx b/canvas/source/vcl/impltools.cxx index 3abc76f8f7c7..055eb061930e 100644 --- a/canvas/source/vcl/impltools.cxx +++ b/canvas/source/vcl/impltools.cxx @@ -322,6 +322,8 @@ namespace vclcanvas // vs. multi-level transparency) if( rBitmap.IsTransparent() ) { + Scanline pScan = pWriteAccess->GetScanline( y ); + Scanline pScanAlpha = pAlphaWriteAccess->GetScanline( y ); // Handling alpha and mask just the same... for( long x=0; x<aDestBmpSize.Width(); ++x ) { @@ -333,18 +335,20 @@ namespace vclcanvas if( nSrcX < 0 || nSrcX >= aBmpSize.Width() || nSrcY < 0 || nSrcY >= aBmpSize.Height() ) { - pAlphaWriteAccess->SetPixelIndex( y, x, 255 ); + pAlphaWriteAccess->SetPixelOnData( pScanAlpha, x, BitmapColor(255) ); } else { const sal_uInt8 cAlphaIdx = pAlphaReadAccess->GetPixelIndex( nSrcY, nSrcX ); - pAlphaWriteAccess->SetPixelIndex( y, x, aAlphaMap[ cAlphaIdx ] ); - pWriteAccess->SetPixel( y, x, pReadAccess->GetPixel( nSrcY, nSrcX ) ); + pAlphaWriteAccess->SetPixelOnData( pScanAlpha, x, BitmapColor(aAlphaMap[ cAlphaIdx ]) ); + pWriteAccess->SetPixelOnData( pScan, x, pReadAccess->GetPixel( nSrcY, nSrcX ) ); } } } else { + Scanline pScan = pWriteAccess->GetScanline( y ); + Scanline pScanAlpha = pAlphaWriteAccess->GetScanline( y ); for( long x=0; x<aDestBmpSize.Width(); ++x ) { ::basegfx::B2DPoint aPoint(x,y); @@ -355,12 +359,12 @@ namespace vclcanvas if( nSrcX < 0 || nSrcX >= aBmpSize.Width() || nSrcY < 0 || nSrcY >= aBmpSize.Height() ) { - pAlphaWriteAccess->SetPixel( y, x, BitmapColor(255) ); + pAlphaWriteAccess->SetPixelOnData( pScanAlpha, x, BitmapColor(255) ); } else { - pAlphaWriteAccess->SetPixel( y, x, BitmapColor(0) ); - pWriteAccess->SetPixel( y, x, pReadAccess->GetPixel( nSrcY, + pAlphaWriteAccess->SetPixelOnData( pScanAlpha, x, BitmapColor(0) ); + pWriteAccess->SetPixelOnData( pScan, x, pReadAccess->GetPixel( nSrcY, nSrcX ) ); } } diff --git a/cui/source/dialogs/colorpicker.cxx b/cui/source/dialogs/colorpicker.cxx index 6492ad558a3e..d6e0269b39b4 100644 --- a/cui/source/dialogs/colorpicker.cxx +++ b/cui/source/dialogs/colorpicker.cxx @@ -334,72 +334,78 @@ void ColorFieldControl::UpdateBitmap() case HUE: while (y--) { + Scanline pScanline = pWriteAccess->GetScanline( y ); nBri = pPercent_Vert[y]; x = nWidth; while (x--) { nSat = pPercent_Horiz[x]; - pWriteAccess->SetPixel(y, x, BitmapColor(Color(Color::HSBtoRGB(nHue, nSat, nBri)))); + pWriteAccess->SetPixelOnData(pScanline, x, BitmapColor(Color(Color::HSBtoRGB(nHue, nSat, nBri)))); } } break; case SATURATION: while (y--) { + Scanline pScanline = pWriteAccess->GetScanline( y ); nBri = pPercent_Vert[y]; x = nWidth; while (x--) { nHue = pGrad_Horiz[x]; - pWriteAccess->SetPixel(y, x, BitmapColor(Color(Color::HSBtoRGB(nHue, nSat, nBri)))); + pWriteAccess->SetPixelOnData(pScanline, x, BitmapColor(Color(Color::HSBtoRGB(nHue, nSat, nBri)))); } } break; case BRIGHTNESS: while (y--) { + Scanline pScanline = pWriteAccess->GetScanline( y ); nSat = pPercent_Vert[y]; x = nWidth; while (x--) { nHue = pGrad_Horiz[x]; - pWriteAccess->SetPixel(y, x, BitmapColor(Color(Color::HSBtoRGB(nHue, nSat, nBri)))); + pWriteAccess->SetPixelOnData(pScanline, x, BitmapColor(Color(Color::HSBtoRGB(nHue, nSat, nBri)))); } } break; case RED: while (y--) { + Scanline pScanline = pWriteAccess->GetScanline( y ); aBitmapColor.SetGreen(pRGB_Vert[y]); x = nWidth; while (x--) { aBitmapColor.SetBlue(pRGB_Horiz[x]); - pWriteAccess->SetPixel(y, x, aBitmapColor); + pWriteAccess->SetPixelOnData(pScanline, x, aBitmapColor); } } break; case GREEN: while (y--) { + Scanline pScanline = pWriteAccess->GetScanline( y ); aBitmapColor.SetRed(pRGB_Vert[y]); x = nWidth; while (x--) { aBitmapColor.SetBlue(pRGB_Horiz[x]); - pWriteAccess->SetPixel(y, x, aBitmapColor); + pWriteAccess->SetPixelOnData(pScanline, x, aBitmapColor); } } break; case BLUE: while (y--) { + Scanline pScanline = pWriteAccess->GetScanline( y ); aBitmapColor.SetGreen(pRGB_Vert[y]); x = nWidth; while (x--) { aBitmapColor.SetRed(pRGB_Horiz[x]); - pWriteAccess->SetPixel(y, x, aBitmapColor); + pWriteAccess->SetPixelOnData(pScanline, x, aBitmapColor); } } break; diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx index 13a81abbaf19..150c13c58db7 100644 --- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx @@ -63,6 +63,8 @@ namespace for(sal_uInt32 y(0); y < nHeight; y++) { + Scanline pScanlineContent = pContent->GetScanline( y ); + Scanline pScanlineAlpha = pAlpha->GetScanline( y ); for(sal_uInt32 x(0); x < nWidth; x++) { sal_uInt16 nRed(0); @@ -89,11 +91,11 @@ namespace if(nOpacity) { - pContent->SetPixel(y, x, BitmapColor( + pContent->SetPixelOnData(pScanlineContent, x, BitmapColor( static_cast<sal_uInt8>(nRed / nDivisor), static_cast<sal_uInt8>(nGreen / nDivisor), static_cast<sal_uInt8>(nBlue / nDivisor))); - pAlpha->SetPixel(y, x, BitmapColor(255 - static_cast<sal_uInt8>(nOpacity))); + pAlpha->SetPixelOnData(pScanlineAlpha, x, BitmapColor(255 - static_cast<sal_uInt8>(nOpacity))); } } } @@ -104,14 +106,16 @@ namespace for(sal_uInt32 y(0); y < nHeight; y++) { + Scanline pScanlineContent = pContent->GetScanline( y ); + Scanline pScanlineAlpha = pAlpha->GetScanline( y ); for(sal_uInt32 x(0); x < nWidth; x++) { const basegfx::BPixel& rPixel(rRaster.getBPixel(nIndex++)); if(rPixel.getOpacity()) { - pContent->SetPixel(y, x, BitmapColor(rPixel.getRed(), rPixel.getGreen(), rPixel.getBlue())); - pAlpha->SetPixel(y, x, BitmapColor(255 - rPixel.getOpacity())); + pContent->SetPixelOnData(pScanlineContent, x, BitmapColor(rPixel.getRed(), rPixel.getGreen(), rPixel.getBlue())); + pAlpha->SetPixelOnData(pScanlineAlpha, x, BitmapColor(255 - rPixel.getOpacity())); } } } diff --git a/emfio/source/reader/wmfreader.cxx b/emfio/source/reader/wmfreader.cxx index 5b4353f77132..e0822757eefe 100644 --- a/emfio/source/reader/wmfreader.cxx +++ b/emfio/source/reader/wmfreader.cxx @@ -688,6 +688,7 @@ namespace emfio { for (sal_uInt16 y = 0; y < nHeight && mpInputStream->good(); ++y) { + Scanline pScanline = pAcc->GetScanline( y ); sal_uInt16 x = 0; for (sal_uInt16 scan = 0; scan < nBytesPerScan; scan++ ) { @@ -697,7 +698,7 @@ namespace emfio { if ( x < nWidth ) { - pAcc->SetPixelIndex( y, x, (nEightPixels>>i)&1 ); + pAcc->SetPixelOnData( pScanline, x, BitmapColor((nEightPixels>>i)&1) ); } x++; } diff --git a/filter/source/graphicfilter/icgm/bitmap.cxx b/filter/source/graphicfilter/icgm/bitmap.cxx index bcc08874b292..5125c9957c7a 100644 --- a/filter/source/graphicfilter/icgm/bitmap.cxx +++ b/filter/source/graphicfilter/icgm/bitmap.cxx @@ -94,7 +94,7 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc ) for ( ny = 0; --nyCount ; ny++, rDesc.mpBuf += rDesc.mnScanSize ) { nxC = nxCount; - Scanline pScanline = rDesc.mpAcc->GetScanline(ny); + Scanline pScanline = rDesc.mpAcc->GetScanline( ny ); for ( nx = 0; --nxC; nx++ ) { // this is not fast, but a one bit/pixel format is rarely used rDesc.mpAcc->SetPixelOnData(pScanline, nx, BitmapColor(static_cast<sal_uInt8>( (*( rDesc.mpBuf + (nx >> 3)) >> ((nx & 7)^7))) & 1)); @@ -109,7 +109,7 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc ) for ( ny = 0; --nyCount; ny++, rDesc.mpBuf += rDesc.mnScanSize ) { nxC = nxCount; - Scanline pScanline = rDesc.mpAcc->GetScanline(ny); + Scanline pScanline = rDesc.mpAcc->GetScanline( ny ); for ( nx = 0; --nxC; nx++ ) { // this is not fast, but a two bits/pixel format is rarely used rDesc.mpAcc->SetPixelOnData(pScanline, nx, BitmapColor(static_cast<sal_uInt8>( (*(rDesc.mpBuf + (nx >> 2)) >> (((nx & 3)^3) << 1))) & 3)); @@ -124,12 +124,13 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc ) for ( ny = 0; --nyCount; ny++, rDesc.mpBuf += rDesc.mnScanSize ) { nxC = nxCount; + Scanline pScanline = rDesc.mpAcc->GetScanline( ny ); sal_Int8 nDat; sal_uInt8* pTemp = rDesc.mpBuf; for ( nx = 0; --nxC; nx++ ) { nDat = *pTemp++; - Scanline pScanline = rDesc.mpAcc->GetScanline(ny); + rDesc.mpAcc->SetPixelOnData(pScanline, nx, BitmapColor(static_cast<sal_uInt8>(nDat >> 4))); if ( --nxC ) { @@ -149,7 +150,7 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc ) for ( ny = 0; --nyCount; ny++, rDesc.mpBuf += rDesc.mnScanSize ) { sal_uInt8* pTemp = rDesc.mpBuf; - Scanline pScanline = rDesc.mpAcc->GetScanline(ny); + Scanline pScanline = rDesc.mpAcc->GetScanline( ny ); nxC = nxCount; for ( nx = 0; --nxC; nx++ ) { @@ -166,7 +167,7 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc ) { sal_uInt8* pTemp = rDesc.mpBuf; nxC = nxCount; - Scanline pScanline = rDesc.mpAcc->GetScanline(ny); + Scanline pScanline = rDesc.mpAcc->GetScanline( ny ); for ( nx = 0; --nxC; nx++ ) { aBitmapColor.SetRed( *pTemp++ ); diff --git a/filter/source/graphicfilter/ieps/ieps.cxx b/filter/source/graphicfilter/ieps/ieps.cxx index f9ad7d49cd76..2808975ff5e1 100644 --- a/filter/source/graphicfilter/ieps/ieps.cxx +++ b/filter/source/graphicfilter/ieps/ieps.cxx @@ -665,6 +665,7 @@ ipsGraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* ) char nByte; for (long y = 0; bIsValid && y < nHeight; ++y) { + Scanline pScanline = pAcc->GetScanline( y ); int nBitsLeft = 0; for (long x = 0; x < nWidth; ++x) { @@ -714,10 +715,10 @@ ipsGraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* ) if (!bIsValid) break; if ( nBitDepth == 1 ) - pAcc->SetPixelIndex( y, x, static_cast<sal_uInt8>(nDat >> nBitsLeft) & 1 ); + pAcc->SetPixelOnData( pScanline, x, BitmapColor(static_cast<sal_uInt8>(nDat >> nBitsLeft) & 1) ); else { - pAcc->SetPixelIndex( y, x, nDat ? 1 : 0 ); // nBitDepth == 8 + pAcc->SetPixelOnData( pScanline, x, BitmapColor(nDat ? 1 : 0) ); // nBitDepth == 8 nBitsLeft = 0; } } diff --git a/filter/source/graphicfilter/ipcx/ipcx.cxx b/filter/source/graphicfilter/ipcx/ipcx.cxx index b6ea13f04a3d..7364137083b6 100644 --- a/filter/source/graphicfilter/ipcx/ipcx.cxx +++ b/filter/source/graphicfilter/ipcx/ipcx.cxx @@ -277,6 +277,7 @@ void PCXReader::ImplReadBody(BitmapWriteAccess * pAcc) sal_uInt8 *pSource2 = pPlane[ 1 ]; sal_uInt8 *pSource3 = pPlane[ 2 ]; sal_uInt8 *pSource4 = pPlane[ 3 ]; + Scanline pScanline = pAcc->GetScanline( ny ); switch ( nBitsPerPlanePix + ( nPlanes << 8 ) ) { // 2 colors @@ -285,9 +286,9 @@ void PCXReader::ImplReadBody(BitmapWriteAccess * pAcc) { sal_uLong nShift = ( i & 7 ) ^ 7; if ( nShift == 0 ) - pAcc->SetPixelIndex( ny, i, *(pSource1++) & 1 ); + pAcc->SetPixelOnData( pScanline, i, BitmapColor(*(pSource1++) & 1) ); else - pAcc->SetPixelIndex( ny, i, (*pSource1 >> nShift ) & 1 ); + pAcc->SetPixelOnData( pScanline, i, BitmapColor((*pSource1 >> nShift ) & 1) ); } break; // 4 colors @@ -309,14 +310,14 @@ void PCXReader::ImplReadBody(BitmapWriteAccess * pAcc) nCol = ( *pSource1++ ) & 0x03; break; } - pAcc->SetPixelIndex( ny, i, nCol ); + pAcc->SetPixelOnData( pScanline, i, BitmapColor(nCol) ); } break; // 256 colors case 0x108 : for ( i = 0; i < nWidth; i++ ) { - pAcc->SetPixelIndex( ny, i, *pSource1++ ); + pAcc->SetPixelOnData( pScanline, i, BitmapColor(*pSource1++) ); } break; // 8 colors @@ -327,14 +328,14 @@ void PCXReader::ImplReadBody(BitmapWriteAccess * pAcc) if ( nShift == 0 ) { nCol = ( *pSource1++ & 1) + ( ( *pSource2++ << 1 ) & 2 ) + ( ( *pSource3++ << 2 ) & 4 ); - pAcc->SetPixelIndex( ny, i, nCol ); + pAcc->SetPixelOnData( pScanline, i, BitmapColor(nCol) ); } else { nCol = sal::static_int_cast< sal_uInt8 >( ( ( *pSource1 >> nShift ) & 1) + ( ( ( *pSource2 >> nShift ) << 1 ) & 2 ) + ( ( ( *pSource3 >> nShift ) << 2 ) & 4 )); - pAcc->SetPixelIndex( ny, i, nCol ); + pAcc->SetPixelOnData( pScanline, i, BitmapColor(nCol) ); } } break; @@ -347,14 +348,14 @@ void PCXReader::ImplReadBody(BitmapWriteAccess * pAcc) { nCol = ( *pSource1++ & 1) + ( ( *pSource2++ << 1 ) & 2 ) + ( ( *pSource3++ << 2 ) & 4 ) + ( ( *pSource4++ << 3 ) & 8 ); - pAcc->SetPixelIndex( ny, i, nCol ); + pAcc->SetPixelOnData( pScanline, i, BitmapColor(nCol) ); } else { nCol = sal::static_int_cast< sal_uInt8 >( ( ( *pSource1 >> nShift ) & 1) + ( ( ( *pSource2 >> nShift ) << 1 ) & 2 ) + ( ( ( *pSource3 >> nShift ) << 2 ) & 4 ) + ( ( ( *pSource4 >> nShift ) << 3 ) & 8 )); - pAcc->SetPixelIndex( ny, i, nCol ); + pAcc->SetPixelOnData( pScanline, i, BitmapColor(nCol) ); } } break; @@ -362,7 +363,7 @@ void PCXReader::ImplReadBody(BitmapWriteAccess * pAcc) case 0x308 : for ( i = 0; i < nWidth; i++ ) { - pAcc->SetPixel( ny, i, Color( *pSource1++, *pSource2++, *pSource3++ ) ); + pAcc->SetPixelOnData( pScanline, i, Color( *pSource1++, *pSource2++, *pSource3++ ) ); } break; diff --git a/filter/source/graphicfilter/ipict/ipict.cxx b/filter/source/graphicfilter/ipict/ipict.cxx index 8239fe05bed2..8cbe27bc71f7 100644 --- a/filter/source/graphicfilter/ipict/ipict.cxx +++ b/filter/source/graphicfilter/ipict/ipict.cxx @@ -961,10 +961,10 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo for (sal_uInt16 ny = 0; ny < nHeight; ++ny) { + Scanline pScanline = pAcc->GetScanline( ny ); sal_uInt16 nx = 0; if ( nRowBytes < 8 || nPackType == 1 ) { - Scanline pScanline = pAcc->GetScanline(ny); for (size_t i = 0; i < nWidth; ++i) { pPict->ReadUInt16( nD ); @@ -1004,7 +1004,6 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo this case. Have a look at 32bit, there I changed the encoding, so that it is used a straight forward array */ - Scanline pScanline = pAcc->GetScanline(ny); for (size_t i = 0; i < nCount; ++i) { pPict->ReadUInt16( nD ); @@ -1025,7 +1024,6 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo nRed = static_cast<sal_uInt8>( nD >> 7 ); nGreen = static_cast<sal_uInt8>( nD >> 2 ); nBlue = static_cast<sal_uInt8>( nD << 3 ); - Scanline pScanline = pAcc->GetScanline(ny); for (size_t i = 0; i < nCount; ++i) { pAcc->SetPixelOnData(pScanline, nx++, BitmapColor(nRed, nGreen, nBlue)); diff --git a/filter/source/graphicfilter/ipsd/ipsd.cxx b/filter/source/graphicfilter/ipsd/ipsd.cxx index 9f08f4dd8c93..f8f53ccfaf1f 100644 --- a/filter/source/graphicfilter/ipsd/ipsd.cxx +++ b/filter/source/graphicfilter/ipsd/ipsd.cxx @@ -672,6 +672,7 @@ bool PSDReader::ImplReadBody() for ( nY = 0; nY < mpFileHeader->nRows; nY++ ) { + Scanline pScanline = mpWriteAcc->GetScanline( nY ); for ( nX = 0; nX < mpFileHeader->nColumns; nX++ ) { sal_Int32 nDAT = pBlack[ nX + nY * mpFileHeader->nColumns ] * ( nBlackMax - 256 ) / 0x1ff; @@ -680,7 +681,7 @@ bool PSDReader::ImplReadBody() 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 )); - mpWriteAcc->SetPixel( nY, nX, BitmapColor( cR, cG, cB ) ); + mpWriteAcc->SetPixelOnData( pScanline, nX, BitmapColor( cR, cG, cB ) ); } } } diff --git a/filter/source/graphicfilter/itga/itga.cxx b/filter/source/graphicfilter/itga/itga.cxx index 4efbd21d3e4b..17fd8cdaffb2 100644 --- a/filter/source/graphicfilter/itga/itga.cxx +++ b/filter/source/graphicfilter/itga/itga.cxx @@ -613,6 +613,7 @@ bool TGAReader::ImplReadBody() { nX = nXStart; nXCount = 0; + Scanline pScanline = mpAcc->GetScanline( nY ); if ( mbIndexing ) { @@ -630,7 +631,7 @@ bool TGAReader::ImplReadBody() nRed = static_cast<sal_uInt8>( mpColorMap[ nRGB16 ] >> 16 ); nGreen = static_cast<sal_uInt8>( mpColorMap[ nRGB16 ] >> 8 ); nBlue = static_cast<sal_uInt8>( mpColorMap[ nRGB16 ] ); - mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) ); + mpAcc->SetPixelOnData( pScanline, nX, BitmapColor( nRed, nGreen, nBlue ) ); } break; @@ -643,7 +644,7 @@ bool TGAReader::ImplReadBody() return false; if ( nDummy >= mpFileHeader->nColorMapLength ) return false; - mpAcc->SetPixelIndex( nY, nX, nDummy ); + mpAcc->SetPixelOnData( pScanline, nX, BitmapColor(nDummy) ); } break; default: @@ -662,7 +663,7 @@ bool TGAReader::ImplReadBody() m_rTGA.ReadUChar( nBlue ).ReadUChar( nGreen ).ReadUChar( nRed ).ReadUChar( nDummy ); if ( !m_rTGA.good()) return false; - mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) ); + mpAcc->SetPixelOnData( pScanline, nX, BitmapColor( nRed, nGreen, nBlue ) ); } } break; @@ -674,7 +675,7 @@ bool TGAReader::ImplReadBody() m_rTGA.ReadUChar( nBlue ).ReadUChar( nGreen ).ReadUChar( nRed ); if ( !m_rTGA.good()) return false; - mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) ); + mpAcc->SetPixelOnData( pScanline, nX, BitmapColor( nRed, nGreen, nBlue ) ); } break; @@ -688,7 +689,7 @@ bool TGAReader::ImplReadBody() nRed = static_cast<sal_uInt8>( nRGB16 >> 7 ) & 0xf8; nGreen = static_cast<sal_uInt8>( nRGB16 >> 2 ) & 0xf8; nBlue = static_cast<sal_uInt8>( nRGB16 << 3 ) & 0xf8; - mpAcc->SetPixel( nY, nX, BitmapColor( nRed, nGreen, nBlue ) ); + mpAcc->SetPixelOnData( pScanline, nX, BitmapColor( nRed, nGreen, nBlue ) ); } break; default: diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx index 976c1be508c8..3c3c29b776ba 100644 --- a/svtools/source/graphic/grfmgr2.cxx +++ b/svtools/source/graphic/grfmgr2.cxx @@ -468,6 +468,7 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib nSinY = pSinY[ y ]; nCosY = pCosY[ y ]; + Scanline pScanline = pWriteAccess->GetScanline( y ); for( x = 0; x < aTargetWidth; x++ ) { nUnRotX = ( pCosX[ x ] - nSinY ) >> 8; @@ -496,7 +497,7 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib aColRes.SetRed( MAP( cR0, cR1, nTmpFY ) ); aColRes.SetGreen( MAP( cG0, cG1, nTmpFY ) ); aColRes.SetBlue( MAP( cB0, cB1, nTmpFY ) ); - pWriteAccess->SetPixel( y, x, aColRes ); + pWriteAccess->SetPixelOnData( pScanline, x, aColRes ); } } } @@ -510,6 +511,7 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib nSinY = pSinY[ y ]; nCosY = pCosY[ y ]; + Scanline pScanline = pWriteAccess->GetScanline( y ); for( x = 0; x < aTargetWidth; x++ ) { nUnRotX = ( pCosX[ x ] - nSinY ) >> 8; @@ -538,7 +540,7 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib aColRes.SetRed( MAP( cR0, cR1, nTmpFY ) ); aColRes.SetGreen( MAP( cG0, cG1, nTmpFY ) ); aColRes.SetBlue( MAP( cB0, cB1, nTmpFY ) ); - pWriteAccess->SetPixel( y, x, aColRes ); + pWriteAccess->SetPixelOnData( pScanline, x, aColRes ); } } } @@ -555,6 +557,7 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib nSinY = pSinY[ y ]; nCosY = pCosY[ y ]; + Scanline pScanline = pWriteAccess->GetScanline( y ); for( x = 0; x < aTargetWidth; x++ ) { double aUnrotatedX = ( pCosX[ x ] - nSinY ) / 256.0; @@ -604,7 +607,7 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib aResultColor.SetGreen( MinMax( aSumGreen / aCount, 0, 255) ); aResultColor.SetBlue( MinMax( aSumBlue / aCount, 0, 255) ); - pWriteAccess->SetPixel( y, x, aResultColor ); + pWriteAccess->SetPixelOnData( pScanline, x, aResultColor ); } } } @@ -689,6 +692,7 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib { nSinY = pSinY[ y ]; nCosY = pCosY[ y ]; + Scanline pScanline = pWriteAccess->GetScanline( y ); for( x = 0; x < aTargetWidth; x++ ) { @@ -728,11 +732,11 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib } } aResultColor.SetIndex( MinMax( aSum / aCount, 0, 255) ); - pWriteAccess->SetPixel( y, x, aResultColor ); + pWriteAccess->SetPixelOnData( pScanline, x, aResultColor ); } else { - pWriteAccess->SetPixel( y, x, aTrans ); + pWriteAccess->SetPixelOnData( pScanline, x, aTrans ); } } } @@ -747,6 +751,7 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib { nSinY = pSinY[ nY ]; nCosY = pCosY[ nY ]; + Scanline pScanline = pWriteAccess->GetScanline( nY ); for( long nX = 0; nX < aTargetWidth; nX++ ) { @@ -769,10 +774,10 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib const long n1 = MAP( nAlpha2, nAlpha3, nTmpFX ); aAlphaVal.SetIndex( MAP( n0, n1, nTmpFY ) ); - pWriteAccess->SetPixel( nY, nX, aAlphaVal ); + pWriteAccess->SetPixelOnData( pScanline, nX, aAlphaVal ); } else - pWriteAccess->SetPixel( nY, nX, aTrans ); + pWriteAccess->SetPixelOnData( pScanline, nX, aTrans ); } } } @@ -821,6 +826,7 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib { nSinY = pSinY[ nY ]; nCosY = pCosY[ nY ]; + Scanline pScanline = pWriteAccess->GetScanline( nY ); for( long nX = 0; nX < aTargetWidth; nX++ ) { @@ -833,15 +839,15 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib if( pMAcc ) { if( pMAcc->GetPixel( pMapLY[ nUnRotY ], pMapLX[ nUnRotX ] ) == aTestB ) - pWriteAccess->SetPixel( nY, nX, aB ); + pWriteAccess->SetPixelOnData( pScanline, nX, aB ); else - pWriteAccess->SetPixel( nY, nX, aW ); + pWriteAccess->SetPixelOnData( pScanline, nX, aW ); } else - pWriteAccess->SetPixel( nY, nX, aB ); + pWriteAccess->SetPixelOnData( pScanline, nX, aB ); } else - pWriteAccess->SetPixel( nY, nX, aW ); + pWriteAccess->SetPixelOnData( pScanline, nX, aW ); } } @@ -1486,11 +1492,12 @@ void GraphicManager::ImplAdjust( BitmapEx& rBmpEx, const GraphicAttr& rAttr, Gra for( long nY = 0; nY < nHeight; nY++ ) { + Scanline pScanline = pA->GetScanline( nY ); for( long nX = 0; nX < nWidth; nX++ ) { nNewTrans = nTrans + pA->GetPixel( nY, nX ).GetIndex(); aAlphaValue.SetIndex( static_cast<sal_uInt8>( ( nNewTrans & 0xffffff00 ) ? 255 : nNewTrans ) ); - pA->SetPixel( nY, nX, aAlphaValue ); + pA->SetPixelOnData( pScanline, nX, aAlphaValue ); } } } diff --git a/svtools/source/graphic/transformer.cxx b/svtools/source/graphic/transformer.cxx index d21f0755624a..ead61881da39 100644 --- a/svtools/source/graphic/transformer.cxx +++ b/svtools/source/graphic/transformer.cxx @@ -54,11 +54,12 @@ void setAlpha( Bitmap& rBitmap, AlphaMask& rAlpha, sal_uInt8 cIndexFrom, sal_Int { for ( long nY = 0; nY < pReadAccess->Height(); nY++ ) { + Scanline pScanline = pWriteAccess->GetScanline( nY ); for ( long nX = 0; nX < pReadAccess->Width(); nX++ ) { const sal_uInt8 cIndex = pReadAccess->GetPixelIndex( nY, nX ); if ( cIndex == cIndexFrom ) - pWriteAccess->SetPixelIndex( nY, nX, nAlphaTo ); + pWriteAccess->SetPixelOnData( pScanline, nX, BitmapColor(nAlphaTo) ); } } } diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx index d8cc89375e49..28fbb9635725 100644 --- a/svx/source/svdraw/svdfmtf.cxx +++ b/svx/source/svdraw/svdfmtf.cxx @@ -1585,12 +1585,13 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaFloatTransparentAction const & rAct) for(long y(0); y < pOld->Height(); y++) { + Scanline pScanline = pOld->GetScanline( y ); for(long x(0); x < pOld->Width(); x++) { const double fOpOld(1.0 - (pOld->GetPixel(y, x).GetIndex() * fFactor)); const sal_uInt8 aCol(basegfx::fround((1.0 - (fOpOld * fOpNew)) * 255.0)); - pOld->SetPixel(y, x, BitmapColor(aCol)); + pOld->SetPixelOnData(pScanline, x, BitmapColor(aCol)); } } } @@ -1604,13 +1605,14 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaFloatTransparentAction const & rAct) { for(long y(0); y < pOld->Height(); y++) { + Scanline pScanline = pOld->GetScanline( y ); for(long x(0); x < pOld->Width(); x++) { const double fOpOld(1.0 - (pOld->GetPixel(y, x).GetIndex() * fFactor)); const double fOpNew(1.0 - (pNew->GetPixel(y, x).GetIndex() * fFactor)); const sal_uInt8 aCol(basegfx::fround((1.0 - (fOpOld * fOpNew)) * 255.0)); - pOld->SetPixel(y, x, BitmapColor(aCol)); + pOld->SetPixelOnData(pScanline, x, BitmapColor(aCol)); } } } diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index ab2465689df4..8b5fce92eea2 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -361,6 +361,7 @@ SdrObject* ImpCreateShadowObjectClone(const SdrObject& rOriginal, const SfxItemS { for(long y(0); y < pReadAccess->Height(); y++) { + Scanline pScanline = pWriteAccess->GetScanline( y ); for(long x(0); x < pReadAccess->Width(); x++) { sal_uInt16 nLuminance(static_cast<sal_uInt16>(pReadAccess->GetLuminance(y, x)) + 1); @@ -368,7 +369,7 @@ SdrObject* ImpCreateShadowObjectClone(const SdrObject& rOriginal, const SfxItemS static_cast<sal_uInt8>((nLuminance * static_cast<sal_uInt16>(aShadowColor.GetRed())) >> 8), static_cast<sal_uInt8>((nLuminance * static_cast<sal_uInt16>(aShadowColor.GetGreen())) >> 8), static_cast<sal_uInt8>((nLuminance * static_cast<sal_uInt16>(aShadowColor.GetBlue())) >> 8)); - pWriteAccess->SetPixel(y, x, aDestColor); + pWriteAccess->SetPixelOnData(pScanline, x, aDestColor); } } diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx index 94f8d3f2cc5b..0dae5e1992d8 100644 --- a/svx/source/xoutdev/_xoutbmp.cxx +++ b/svx/source/xoutdev/_xoutbmp.cxx @@ -479,6 +479,7 @@ Bitmap XOutBitmap::DetectEdges( const Bitmap& rBmp, const sal_uInt8 cThreshold ) for( long nY = 0, nY1 = 1, nY2 = 2; nY < nHeight2; nY++, nY1++, nY2++ ) { + Scanline pScanline = pWriteAcc->GetScanline( nY1 ); for( long nX = 0, nXDst = 1, nXTmp; nX < nWidth2; nX++, nXDst++ ) { nXTmp = nX; @@ -498,9 +499,9 @@ Bitmap XOutBitmap::DetectEdges( const Bitmap& rBmp, const sal_uInt8 cThreshold ) nSum2 -= lGray; if( ( nSum1 * nSum1 + nSum2 * nSum2 ) < lThres2 ) - pWriteAcc->SetPixelIndex( nY1, nXDst, nWhitePalIdx ); + pWriteAcc->SetPixelOnData( pScanline, nXDst, BitmapColor(nWhitePalIdx) ); else - pWriteAcc->SetPixelIndex( nY1, nXDst, nBlackPalIdx ); + pWriteAcc->SetPixelOnData( pScanline, nXDst, BitmapColor(nBlackPalIdx) ); } } 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 ) ); } } } diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index 7cf941485973..c73991b57b92 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -1309,6 +1309,8 @@ public: int nSizeY = aSrc.GetSizePixel().Height(); for (int y = 0; y < nSizeY; y++) { + Scanline pScanlineMask = pMaskAcc->GetScanline( y ); + Scanline pScanlineRec = pRecAcc->GetScanline( y ); for (int x = 0; x < nSizeX; x++) { BitmapColor aColW = pAccW->GetPixel(y,x); @@ -1324,7 +1326,7 @@ public: nInverseAlpha = CLAMP(nInverseAlpha, 0, 255); long nAlpha = 255 - nInverseAlpha; - pMaskAcc->SetPixel(y,x,BitmapColor(static_cast<sal_Int8>(CLAMP(nInverseAlpha,0,255)))); + pMaskAcc->SetPixelOnData(pScanlineMask,x,BitmapColor(static_cast<sal_Int8>(CLAMP(nInverseAlpha,0,255)))); // now recover the pixels long nR = (aColW.GetRed() + aColB.GetRed() - nInverseAlpha) * 128; long nG = (aColW.GetGreen() + aColB.GetGreen() - nInverseAlpha) * 128; @@ -1337,7 +1339,7 @@ public: { nR /= nAlpha; nG /= nAlpha; nB /= nAlpha; } - pRecAcc->SetPixel(y,x,BitmapColor( + pRecAcc->SetPixelOnData(pScanlineRec,x,BitmapColor( static_cast<sal_uInt8>(CLAMP(nR,0,255)), static_cast<sal_uInt8>(CLAMP(nG,0,255)), static_cast<sal_uInt8>(CLAMP(nB,0,255)))); |