canvas/source/vcl/canvasbitmaphelper.cxx | 11 - canvas/source/vcl/canvashelper.cxx | 4 canvas/source/vcl/impltools.cxx | 16 + cui/source/dialogs/colorpicker.cxx | 18 + drawinglayer/source/primitive2d/sceneprimitive2d.cxx | 12 - emfio/source/reader/wmfreader.cxx | 3 filter/source/graphicfilter/icgm/bitmap.cxx | 11 - filter/source/graphicfilter/ieps/ieps.cxx | 5 filter/source/graphicfilter/ipcx/ipcx.cxx | 19 +- filter/source/graphicfilter/ipict/ipict.cxx | 4 filter/source/graphicfilter/ipsd/ipsd.cxx | 3 filter/source/graphicfilter/itga/itga.cxx | 11 - forms/source/component/Columns.hxx | 4 forms/source/component/Hidden.hxx | 4 include/comphelper/accessibletexthelper.hxx | 4 include/svx/svdview.hxx | 4 sd/source/ui/inc/fuhhconv.hxx | 4 svtools/source/graphic/grfmgr2.cxx | 31 ++- svtools/source/graphic/transformer.cxx | 3 svx/source/inc/sdbdatacolumn.hxx | 4 svx/source/svdraw/svdfmtf.cxx | 6 svx/source/svdraw/svdoashp.cxx | 3 svx/source/xoutdev/_xoutbmp.cxx | 5 vcl/source/bitmap/BitmapProcessor.cxx | 18 + vcl/source/bitmap/BitmapScaleConvolution.cxx | 3 vcl/source/bitmap/bitmapscalesuper.cxx | 30 ++- vcl/source/gdi/alpha.cxx | 8 vcl/source/gdi/bitmap.cxx | 180 +++++++++++++------ vcl/source/gdi/bitmap3.cxx | 96 ++++++---- vcl/source/gdi/bitmap4.cxx | 46 +++- vcl/source/gdi/bitmapex.cxx | 48 ++--- vcl/source/gdi/bmpacc.cxx | 5 vcl/source/gdi/bmpacc3.cxx | 3 vcl/source/gdi/dibtools.cxx | 6 vcl/source/helper/canvastools.cxx | 22 +- vcl/source/outdev/bitmap.cxx | 30 +-- vcl/source/outdev/transparent.cxx | 6 vcl/workben/vcldemo.cxx | 6 38 files changed, 444 insertions(+), 252 deletions(-)
New commits: commit 3e0efdb50cd9bcf1749993607330ea1567eb33a2 Author: Noel Grandin <noelgran...@gmail.com> Date: Tue Jan 30 20:40:19 2018 +0200 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 <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> 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 ) )) ); ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits