summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHerbert Dürr <hdu@apache.org>2012-10-19 15:12:40 +0000
committerHerbert Dürr <hdu@apache.org>2012-10-19 15:12:40 +0000
commit2d9d5c8d6beb7fb0a7dafa0c1c4d10a25d7200fd (patch)
tree15a68700c164567baace3aa5dc175aa588ed9134
parentb0a48fbbaa2d3d530743672186618a468cce694a (diff)
make conversions between BitmapColor and sal_uInt8 explicit
Implicit conversions are a dangerous cause of confusion as seen in http://markmail.org/thread/a4copx2di7cxeowg and require tricky rewrites to work around them, this change cleans them up and disables them for all code outside of the immutable binfilter.
Notes
-rw-r--r--canvas/source/vcl/impltools.cxx28
-rw-r--r--filter/source/graphicfilter/egif/egif.cxx2
-rw-r--r--filter/source/graphicfilter/epbm/epbm.cxx4
-rw-r--r--filter/source/graphicfilter/epgm/epgm.cxx4
-rw-r--r--filter/source/graphicfilter/epict/epict.cxx6
-rw-r--r--filter/source/graphicfilter/eps/eps.cxx10
-rw-r--r--filter/source/graphicfilter/eras/eras.cxx4
-rw-r--r--filter/source/graphicfilter/etiff/etiff.cxx8
-rw-r--r--filter/source/graphicfilter/expm/expm.cxx4
-rw-r--r--filter/source/graphicfilter/icgm/bitmap.cxx10
-rw-r--r--filter/source/graphicfilter/ieps/ieps.cxx4
-rw-r--r--filter/source/graphicfilter/ipbm/ipbm.cxx8
-rw-r--r--filter/source/graphicfilter/ipcx/ipcx.cxx19
-rw-r--r--filter/source/graphicfilter/ipict/ipict.cxx30
-rw-r--r--filter/source/graphicfilter/ipsd/ipsd.cxx12
-rw-r--r--filter/source/graphicfilter/iras/iras.cxx5
-rw-r--r--filter/source/graphicfilter/itga/itga.cxx6
-rw-r--r--filter/source/graphicfilter/itiff/itiff.cxx48
-rw-r--r--filter/source/msfilter/svdfppt.cxx2
-rw-r--r--sd/source/ui/slidesorter/view/SlsButtonBar.cxx2
-rw-r--r--svtools/source/filter/igif/gifread.cxx8
-rw-r--r--svtools/source/filter/jpeg/jpeg.cxx4
-rw-r--r--svtools/source/filter/wmf/winwmf.cxx2
-rw-r--r--svtools/source/graphic/grfmgr2.cxx18
-rw-r--r--svtools/source/graphic/transformer.cxx18
-rw-r--r--svx/source/svdraw/svdetc.cxx4
-rw-r--r--svx/source/xoutdev/_xoutbmp.cxx26
-rw-r--r--svx/source/xoutdev/xattrbmp.cxx4
-rw-r--r--vcl/inc/vcl/bmpacc.hxx23
-rw-r--r--vcl/inc/vcl/salbtype.hxx16
-rw-r--r--vcl/source/gdi/bitmap.cxx24
-rw-r--r--vcl/source/gdi/bitmap2.cxx46
-rw-r--r--vcl/source/gdi/bitmap3.cxx64
-rw-r--r--vcl/source/gdi/bitmap4.cxx2
-rw-r--r--vcl/source/gdi/bmpacc2.cxx10
-rw-r--r--vcl/source/gdi/octree.cxx2
-rw-r--r--vcl/source/gdi/outdev2.cxx10
-rw-r--r--vcl/source/gdi/pngread.cxx8
-rw-r--r--vcl/source/gdi/pngwrite.cxx16
-rw-r--r--vcl/source/helper/canvasbitmap.cxx27
-rw-r--r--vcl/source/helper/canvastools.cxx8
41 files changed, 269 insertions, 287 deletions
diff --git a/canvas/source/vcl/impltools.cxx b/canvas/source/vcl/impltools.cxx
index 67972f8e3450..63ca62f13a45 100644
--- a/canvas/source/vcl/impltools.cxx
+++ b/canvas/source/vcl/impltools.cxx
@@ -382,18 +382,10 @@ namespace vclcanvas
// (invert 'alpha' pixel value,
// to get the standard alpha
// channel behaviour)
- pAlphaWriteAccess->SetPixel( y, x,
- BitmapColor(
- 255U -
- static_cast<sal_uInt8>(
- nAlphaModulation*
- (255U
- - aAlphaMap[ pAlphaReadAccess->GetPixel(
- nSrcY,
- nSrcX ).GetIndex() ] ) + .5 ) ) );
-
- BitmapColor aColor( pReadAccess->GetPixel( nSrcY,
- nSrcX ) );
+ const sal_uInt8 cMappedAlphaIdx = aAlphaMap[ pAlphaReadAccess->GetPixelIndex( nSrcY, nSrcX ) ];
+ const sal_uInt8 cModulatedAlphaIdx = 255U - static_cast<sal_uInt8>( nAlphaModulation* (255U - cMappedAlphaIdx) + .5 );
+ pAlphaWriteAccess->SetPixelIndex( y, x, cModulatedAlphaIdx );
+ BitmapColor aColor( pReadAccess->GetPixel( nSrcY, nSrcX ) );
aColor.SetRed(
static_cast<sal_uInt8>(
@@ -482,17 +474,13 @@ namespace vclcanvas
if( nSrcX < 0 || nSrcX >= aBmpSize.Width() ||
nSrcY < 0 || nSrcY >= aBmpSize.Height() )
{
- pAlphaWriteAccess->SetPixel( y, x, BitmapColor(255) );
+ pAlphaWriteAccess->SetPixelIndex( y, x, 255 );
}
else
{
- pAlphaWriteAccess->SetPixel( y, x,
- aAlphaMap[
- pAlphaReadAccess->GetPixel( nSrcY,
- nSrcX ) ] );
-
- pWriteAccess->SetPixel( y, x, pReadAccess->GetPixel( nSrcY,
- nSrcX ) );
+ const sal_uInt8 cAlphaIdx = pAlphaReadAccess->GetPixelIndex( nSrcY, nSrcX );
+ pAlphaWriteAccess->SetPixelIndex( y, x, aAlphaMap[ cAlphaIdx ] );
+ pWriteAccess->SetPixel( y, x, pReadAccess->GetPixel( nSrcY, nSrcX ) );
}
}
}
diff --git a/filter/source/graphicfilter/egif/egif.cxx b/filter/source/graphicfilter/egif/egif.cxx
index cdd78a02d614..66eb7b9afae0 100644
--- a/filter/source/graphicfilter/egif/egif.cxx
+++ b/filter/source/graphicfilter/egif/egif.cxx
@@ -522,7 +522,7 @@ void GIFWriter::WriteAccess()
else
{
for( long nX = 0L; nX < nWidth; nX++ )
- pBuffer[ nX ] = (sal_uInt8) pAcc->GetPixel( nY, nX );
+ pBuffer[ nX ] = pAcc->GetPixelIndex( nY, nX );
aCompressor.Compress( pBuffer, nWidth );
}
diff --git a/filter/source/graphicfilter/epbm/epbm.cxx b/filter/source/graphicfilter/epbm/epbm.cxx
index c048bb16a6db..5fb48533c5ab 100644
--- a/filter/source/graphicfilter/epbm/epbm.cxx
+++ b/filter/source/graphicfilter/epbm/epbm.cxx
@@ -153,7 +153,7 @@ void PBMWriter::ImplWriteBody()
for ( x = 0; x < mnWidth; x++ )
{
nBYTE <<= 1;
- if (!(mpAcc->GetPixel( y, x ) & 1 ) )
+ if (!(mpAcc->GetPixelIndex( y, x ) & 1 ) )
nBYTE++;
if ( ( x & 7 ) == 7 )
*mpOStm << nBYTE;
@@ -175,7 +175,7 @@ void PBMWriter::ImplWriteBody()
nxCount = 69;
*mpOStm << (sal_uInt8)10;
}
- *mpOStm << (sal_uInt8)( ( mpAcc->GetPixel( y, x ) ^ 1 ) + '0' ) ;
+ *mpOStm << (sal_uInt8)( ( mpAcc->GetPixelIndex( y, x ) ^ 1 ) + '0' ) ;
}
*mpOStm << (sal_uInt8)10;
}
diff --git a/filter/source/graphicfilter/epgm/epgm.cxx b/filter/source/graphicfilter/epgm/epgm.cxx
index 5640290eceaf..a67444053d00 100644
--- a/filter/source/graphicfilter/epgm/epgm.cxx
+++ b/filter/source/graphicfilter/epgm/epgm.cxx
@@ -155,7 +155,7 @@ void PGMWriter::ImplWriteBody()
{
for ( sal_uLong x = 0; x < mnWidth; x++ )
{
- *mpOStm << (sal_uInt8)( mpAcc->GetPixel( y, x ) );
+ *mpOStm << mpAcc->GetPixelIndex( y, x );
}
}
}
@@ -172,7 +172,7 @@ void PGMWriter::ImplWriteBody()
nCount = 69;
*mpOStm << (sal_uInt8)10;
}
- nDat = (sal_uInt8)mpAcc->GetPixel( y, x );
+ nDat = mpAcc->GetPixelIndex( y, x );
nNumb = nDat / 100;
if ( nNumb )
{
diff --git a/filter/source/graphicfilter/epict/epict.cxx b/filter/source/graphicfilter/epict/epict.cxx
index d6c96c980584..ae73e3699662 100644
--- a/filter/source/graphicfilter/epict/epict.cxx
+++ b/filter/source/graphicfilter/epict/epict.cxx
@@ -1183,17 +1183,17 @@ void PictWriter::WriteOpcode_BitsRect(const Point & rPoint, const Size & rSize,
for ( pTemp = pPix, i = 0; i < nSrcRowBytes; i++ )
*pTemp++ = (sal_uInt8)0;
for ( i = 0; i < nWidth; i++ )
- pPix[ ( i >> 3 ) ] |= (sal_uInt8)( pAcc->GetPixel( ny, i ) & 1 ) << ( ( i & 7 ) ^ 7 );
+ pPix[ ( i >> 3 ) ] |= (pAcc->GetPixelIndex( ny, i ) & 1) << ((i & 7) ^ 7);
break;
case 4 :
for ( pTemp = pPix, i = 0; i < nSrcRowBytes; i++ )
*pTemp++ = (sal_uInt8)0;
for ( i = 0; i < nWidth; i++ )
- pPix[ ( i >> 1 ) ] |= (sal_uInt8)( pAcc->GetPixel( ny, i ) & 15 ) << ( ( i & 1 ) << 2 ) ;
+ pPix[ ( i >> 1 ) ] |= (pAcc->GetPixelIndex( ny, i ) & 15) << ((i & 1) << 2);
break;
case 8 :
for ( i = 0; i < nWidth; i++ )
- pPix[ i ] = (sal_uInt8)pAcc->GetPixel( ny, i );
+ pPix[ i ] = pAcc->GetPixelIndex( ny, i );
break;
}
diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx
index 9e21611da409..22fc78edb788 100644
--- a/filter/source/graphicfilter/eps/eps.cxx
+++ b/filter/source/graphicfilter/eps/eps.cxx
@@ -1780,7 +1780,7 @@ void PSWriter::ImplBmp( Bitmap* pBitmap, Bitmap* pMaskBitmap, const Point & rPoi
{
for ( long x = 0; x < nWidth; x++ )
{
- ImplWriteHexByte( (sal_uInt8)pAcc->GetPixel( y, x ) );
+ ImplWriteHexByte( pAcc->GetPixelIndex( y, x ) );
}
}
*mpPS << (sal_uInt8)10;
@@ -1818,7 +1818,7 @@ void PSWriter::ImplBmp( Bitmap* pBitmap, Bitmap* pMaskBitmap, const Point & rPoi
{
for ( long x = 0; x < nWidth; x++ )
{
- Compress( (sal_uInt8)pAcc->GetPixel( y, x ) );
+ Compress( pAcc->GetPixelIndex( y, x ) );
}
}
EndCompression();
@@ -1829,7 +1829,7 @@ void PSWriter::ImplBmp( Bitmap* pBitmap, Bitmap* pMaskBitmap, const Point & rPoi
{
for ( long x = 0; x < nWidth; x++ )
{
- ImplWriteHexByte( (sal_uInt8)pAcc->GetPixel( y, x ) );
+ ImplWriteHexByte( pAcc->GetPixelIndex( y, x ) );
}
}
}
@@ -1881,7 +1881,7 @@ void PSWriter::ImplBmp( Bitmap* pBitmap, Bitmap* pMaskBitmap, const Point & rPoi
{
for ( long x = 0; x < nWidth; x++ )
{
- Compress( (sal_uInt8)pAcc->GetPixel( y, x ) );
+ Compress( pAcc->GetPixelIndex( y, x ) );
}
}
EndCompression();
@@ -1892,7 +1892,7 @@ void PSWriter::ImplBmp( Bitmap* pBitmap, Bitmap* pMaskBitmap, const Point & rPoi
{
for ( long x = 0; x < nWidth; x++ )
{
- ImplWriteHexByte( (sal_uInt8)pAcc->GetPixel( y, x ) );
+ ImplWriteHexByte( pAcc->GetPixelIndex( y, x ) );
}
}
}
diff --git a/filter/source/graphicfilter/eras/eras.cxx b/filter/source/graphicfilter/eras/eras.cxx
index 33da99adec75..a49dcd162357 100644
--- a/filter/source/graphicfilter/eras/eras.cxx
+++ b/filter/source/graphicfilter/eras/eras.cxx
@@ -210,7 +210,7 @@ void RASWriter::ImplWriteBody()
ImplCallback( y ); // processing output
for ( x = 0; x < mnWidth; x++ )
{
- ImplPutByte ( mpAcc->GetPixel( y, x ) );
+ ImplPutByte ( mpAcc->GetPixelIndex( y, x ) );
}
if ( x & 1 ) ImplPutByte( 0 ); // WORD ALIGNMENT ???
}
@@ -224,7 +224,7 @@ void RASWriter::ImplWriteBody()
ImplCallback( y ); // processing output
for ( x = 0; x < mnWidth; x++ )
{
- nDat = ( ( nDat << 1 ) | ( mpAcc->GetPixel ( y, x ) & 1 ) );
+ nDat = ( ( nDat << 1 ) | ( mpAcc->GetPixelIndex( y, x ) & 1 ) );
if ( ( x & 7 ) == 7 )
ImplPutByte( nDat );
}
diff --git a/filter/source/graphicfilter/etiff/etiff.cxx b/filter/source/graphicfilter/etiff/etiff.cxx
index a3ecf744622d..cd1ef448a32e 100644
--- a/filter/source/graphicfilter/etiff/etiff.cxx
+++ b/filter/source/graphicfilter/etiff/etiff.cxx
@@ -397,7 +397,7 @@ sal_Bool TIFFWriter::ImplWriteBody()
ImplCallback( 100 * mnCurAllPictHeight / mnSumOfAllPictHeight );
for ( x = 0; x < mnWidth; x++ )
{
- Compress( mpAcc->GetPixel( y, x ) );
+ Compress( mpAcc->GetPixelIndex( y, x ) );
}
}
}
@@ -411,9 +411,9 @@ sal_Bool TIFFWriter::ImplWriteBody()
for ( x = 0; x < mnWidth; x++, nShift++ )
{
if (!( nShift & 1 ))
- nTemp = ( (sal_uInt8)mpAcc->GetPixel( y, x ) << 4 );
+ nTemp = ( mpAcc->GetPixelIndex( y, x ) << 4 );
else
- Compress( (sal_uInt8)( nTemp | ( mpAcc->GetPixel( y, x ) & 0xf ) ) );
+ Compress( (sal_uInt8)( nTemp | ( mpAcc->GetPixelIndex( y, x ) & 0xf ) ) );
}
if ( nShift & 1 )
Compress( nTemp );
@@ -430,7 +430,7 @@ sal_Bool TIFFWriter::ImplWriteBody()
for ( x = 0; x < mnWidth; x++)
{
j <<= 1;
- j |= ( ( ~mpAcc->GetPixel( y, x ) ) & 1 );
+ j |= ( ( ~mpAcc->GetPixelIndex( y, x ) ) & 1 );
if ( j & 0x100 )
{
Compress( (sal_uInt8)j );
diff --git a/filter/source/graphicfilter/expm/expm.cxx b/filter/source/graphicfilter/expm/expm.cxx
index 6842128786fa..a9581c0ec7c6 100644
--- a/filter/source/graphicfilter/expm/expm.cxx
+++ b/filter/source/graphicfilter/expm/expm.cxx
@@ -176,7 +176,7 @@ void XPMWriter::ImplWritePalette()
sal_uInt16 nTransIndex = 0xffff;
if ( mbTrans )
- nTransIndex = mpAcc->GetBestMatchingColor( BMP_COL_TRANS );
+ nTransIndex = mpAcc->GetBestPaletteIndex( BMP_COL_TRANS );
for ( sal_uInt16 i = 0; i < mnColors; i++ )
{
*mpOStm << "\x22";
@@ -202,7 +202,7 @@ void XPMWriter::ImplWriteBody()
*mpOStm << (sal_uInt8)0x22;
for ( sal_uLong x = 0; x < mnWidth; x++ )
{
- ImplWritePixel( (sal_uInt8)(mpAcc->GetPixel( y, x ) ) );
+ ImplWritePixel( mpAcc->GetPixelIndex( y, x ) );
}
*mpOStm << "\x22,\x0a";
}
diff --git a/filter/source/graphicfilter/icgm/bitmap.cxx b/filter/source/graphicfilter/icgm/bitmap.cxx
index 69cb2f553d71..5c36abc2abc3 100644
--- a/filter/source/graphicfilter/icgm/bitmap.cxx
+++ b/filter/source/graphicfilter/icgm/bitmap.cxx
@@ -81,7 +81,7 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc )
nxC = nxCount;
for ( nx = 0; --nxC; nx++ )
{ // this is not fast, but a one bit/pixel format is rarely used
- rDesc.mpAcc->SetPixel( ny, nx, (sal_Int8)( (*( rDesc.mpBuf + ( nx >> 3 ) ) >> ( ( nx & 7 ) ^ 7 ) ) ) & 1 );
+ rDesc.mpAcc->SetPixelIndex( ny, nx, static_cast<sal_uInt8>( (*( rDesc.mpBuf + (nx >> 3)) >> ((nx & 7)^7))) & 1 );
}
}
}
@@ -95,7 +95,7 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc )
nxC = nxCount;
for ( nx = 0; --nxC; nx++ )
{ // this is not fast, but a two bits/pixel format is rarely used
- rDesc.mpAcc->SetPixel( ny, nx, (sal_Int8)( (*( rDesc.mpBuf + ( nx >> 2 ) ) >> ( ( ( nx & 3 ) ^ 3 ) << 1 ) ) ) & 3 );
+ rDesc.mpAcc->SetPixelIndex( ny, nx, static_cast<sal_uInt8>( (*(rDesc.mpBuf + (nx >> 2)) >> (((nx & 3)^3) << 1))) & 3 );
}
}
}
@@ -112,11 +112,11 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc )
for ( nx = 0; --nxC; nx++ )
{
nDat = *pTemp++;
- rDesc.mpAcc->SetPixel( ny, nx, (sal_Int8)( nDat >> 4 ) );
+ rDesc.mpAcc->SetPixelIndex( ny, nx, static_cast<sal_uInt8>(nDat >> 4) );
if ( --nxC )
{
nx ++;
- rDesc.mpAcc->SetPixel( ny, nx, (sal_Int8)( nDat & 15 ) );
+ rDesc.mpAcc->SetPixelIndex( ny, nx, static_cast<sal_uInt8>(nDat & 15) );
}
else
break;
@@ -134,7 +134,7 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc )
nxC = nxCount;
for ( nx = 0; --nxC; nx++ )
{
- rDesc.mpAcc->SetPixel( ny, nx, (sal_Int8)( *pTemp++ ) );
+ rDesc.mpAcc->SetPixelIndex( ny, nx, *(pTemp++) );
}
}
}
diff --git a/filter/source/graphicfilter/ieps/ieps.cxx b/filter/source/graphicfilter/ieps/ieps.cxx
index 4a783051ae39..29967e5c8802 100644
--- a/filter/source/graphicfilter/ieps/ieps.cxx
+++ b/filter/source/graphicfilter/ieps/ieps.cxx
@@ -648,10 +648,10 @@ extern "C" sal_Bool GraphicImport(SvStream & rStream, Graphic & rGraphic, Filter
}
}
if ( nBitDepth == 1 )
- pAcc->SetPixel( y, x, sal::static_int_cast< sal_uInt8 >(( nDat >> nBitsLeft ) & 1) );
+ pAcc->SetPixelIndex( y, x, static_cast<sal_uInt8>(nDat >> nBitsLeft) & 1 );
else
{
- pAcc->SetPixel( y, x, ( nDat ) ? 1 : 0 ); // nBitDepth == 8
+ pAcc->SetPixelIndex( y, x, nDat ? 1 : 0 ); // nBitDepth == 8
nBitsLeft = 0;
}
}
diff --git a/filter/source/graphicfilter/ipbm/ipbm.cxx b/filter/source/graphicfilter/ipbm/ipbm.cxx
index 3f986649cecf..b8ca0d1434db 100644
--- a/filter/source/graphicfilter/ipbm/ipbm.cxx
+++ b/filter/source/graphicfilter/ipbm/ipbm.cxx
@@ -276,7 +276,7 @@ sal_Bool PBMReader::ImplReadBody()
*mpPBM >> nDat;
nShift = 7;
}
- mpAcc->SetPixel( nHeight, nWidth, nDat >> nShift );
+ mpAcc->SetPixelIndex( nHeight, nWidth, nDat >> nShift );
if ( ++nWidth == mnWidth )
{
nShift = 0;
@@ -295,7 +295,7 @@ sal_Bool PBMReader::ImplReadBody()
return sal_False;
*mpPBM >> nDat;
- mpAcc->SetPixel( nHeight, nWidth++, nDat);
+ mpAcc->SetPixelIndex( nHeight, nWidth++, nDat);
if ( nWidth == mnWidth )
{
@@ -356,7 +356,7 @@ sal_Bool PBMReader::ImplReadBody()
if ( nDat == '0' || nDat == '1' )
{
- mpAcc->SetPixel( nHeight, nWidth, (sal_uInt8)nDat-'0' );
+ mpAcc->SetPixelIndex( nHeight, nWidth, static_cast<sal_uInt8>(nDat - '0') );
nWidth++;
if ( nWidth == mnWidth )
{
@@ -385,7 +385,7 @@ sal_Bool PBMReader::ImplReadBody()
nCount--;
if ( nGrey <= mnMaxVal )
nGrey = 255 * nGrey / mnMaxVal;
- mpAcc->SetPixel( nHeight, nWidth++, (sal_uInt8)nGrey );
+ mpAcc->SetPixelIndex( nHeight, nWidth++, static_cast<sal_uInt8>(nGrey) );
nGrey = 0;
if ( nWidth == mnWidth )
{
diff --git a/filter/source/graphicfilter/ipcx/ipcx.cxx b/filter/source/graphicfilter/ipcx/ipcx.cxx
index 2c99deeaacfb..6f3340ecaffa 100644
--- a/filter/source/graphicfilter/ipcx/ipcx.cxx
+++ b/filter/source/graphicfilter/ipcx/ipcx.cxx
@@ -308,12 +308,9 @@ void PCXReader::ImplReadBody()
{
sal_uLong nShift = ( i & 7 ) ^ 7;
if ( nShift == 0 )
- pAcc->SetPixel( ny, i, ( *pSource1++ & 1 ) );
+ pAcc->SetPixelIndex( ny, i, *(pSource1++) & 1 );
else
- pAcc->SetPixel(
- ny, i,
- sal::static_int_cast< sal_uInt8 >(
- ( *pSource1 >> nShift ) & 1) );
+ pAcc->SetPixelIndex( ny, i, (*pSource1 >> nShift ) & 1 );
}
break;
// 4 colors
@@ -335,14 +332,14 @@ void PCXReader::ImplReadBody()
nCol = ( *pSource1++ ) & 0x03;
break;
}
- pAcc->SetPixel( ny, i, nCol );
+ pAcc->SetPixelIndex( ny, i, nCol );
}
break;
// 256 colors
case 0x108 :
for ( i = 0; i < nWidth; i++ )
{
- pAcc->SetPixel( ny, i, *pSource1++ );
+ pAcc->SetPixelIndex( ny, i, *pSource1++ );
}
break;
// 8 colors
@@ -353,14 +350,14 @@ void PCXReader::ImplReadBody()
if ( nShift == 0 )
{
nCol = ( *pSource1++ & 1) + ( ( *pSource2++ << 1 ) & 2 ) + ( ( *pSource3++ << 2 ) & 4 );
- pAcc->SetPixel( ny, i, nCol );
+ pAcc->SetPixelIndex( ny, i, nCol );
}
else
{
nCol = sal::static_int_cast< sal_uInt8 >(
( ( *pSource1 >> nShift ) & 1) + ( ( ( *pSource2 >> nShift ) << 1 ) & 2 ) +
( ( ( *pSource3 >> nShift ) << 2 ) & 4 ));
- pAcc->SetPixel( ny, i, nCol );
+ pAcc->SetPixelIndex( ny, i, nCol );
}
}
break;
@@ -373,14 +370,14 @@ void PCXReader::ImplReadBody()
{
nCol = ( *pSource1++ & 1) + ( ( *pSource2++ << 1 ) & 2 ) + ( ( *pSource3++ << 2 ) & 4 ) +
( ( *pSource4++ << 3 ) & 8 );
- pAcc->SetPixel( ny, i, nCol );
+ pAcc->SetPixelIndex( ny, i, 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->SetPixel( ny, i, nCol );
+ pAcc->SetPixelIndex( ny, i, nCol );
}
}
break;
diff --git a/filter/source/graphicfilter/ipict/ipict.cxx b/filter/source/graphicfilter/ipict/ipict.cxx
index 64709a2b122a..e15ce308826a 100644
--- a/filter/source/graphicfilter/ipict/ipict.cxx
+++ b/filter/source/graphicfilter/ipict/ipict.cxx
@@ -260,38 +260,38 @@ public:
switch ( nPixelSize ) \
{ \
case 1 : \
- pAcc->SetPixel( ny, nx++, nDat >> 7 ); \
+ pAcc->SetPixelIndex( ny, nx++, nDat >> 7 ); \
if ( nx == nWidth ) break; \
- pAcc->SetPixel( ny, nx++, nDat >> 6 ); \
+ pAcc->SetPixelIndex( ny, nx++, nDat >> 6 ); \
if ( nx == nWidth ) break; \
- pAcc->SetPixel( ny, nx++, nDat >> 5 ); \
+ pAcc->SetPixelIndex( ny, nx++, nDat >> 5 ); \
if ( nx == nWidth ) break; \
- pAcc->SetPixel( ny, nx++, nDat >> 4 ); \
+ pAcc->SetPixelIndex( ny, nx++, nDat >> 4 ); \
if ( nx == nWidth ) break; \
- pAcc->SetPixel( ny, nx++, nDat >> 3 ); \
+ pAcc->SetPixelIndex( ny, nx++, nDat >> 3 ); \
if ( nx == nWidth ) break; \
- pAcc->SetPixel( ny, nx++, nDat >> 2 ); \
+ pAcc->SetPixelIndex( ny, nx++, nDat >> 2 ); \
if ( nx == nWidth ) break; \
- pAcc->SetPixel( ny, nx++, nDat >> 1 ); \
+ pAcc->SetPixelIndex( ny, nx++, nDat >> 1 ); \
if ( nx == nWidth ) break; \
- pAcc->SetPixel( ny, nx++, nDat ); \
+ pAcc->SetPixelIndex( ny, nx++, nDat ); \
break; \
case 2 : \
- pAcc->SetPixel( ny, nx++, nDat >> 6 ); \
+ pAcc->SetPixelIndex( ny, nx++, nDat >> 6 ); \
if ( nx == nWidth ) break; \
- pAcc->SetPixel( ny, nx++, nDat >> 4 & 3); \
+ pAcc->SetPixelIndex( ny, nx++, (nDat>>4)&3);\
if ( nx == nWidth ) break; \
- pAcc->SetPixel( ny, nx++, nDat >> 2 & 3 ); \
+ pAcc->SetPixelIndex( ny, nx++, (nDat>>2)&3 );\
if ( nx == nWidth ) break; \
- pAcc->SetPixel( ny, nx++, nDat & 3); \
+ pAcc->SetPixelIndex( ny, nx++, nDat & 3); \
break; \
case 4 : \
- pAcc->SetPixel( ny, nx++, nDat >> 4 ); \
+ pAcc->SetPixelIndex( ny, nx++, nDat >> 4 ); \
if ( nx == nWidth ) break; \
- pAcc->SetPixel( ny, nx++, nDat ); \
+ pAcc->SetPixelIndex( ny, nx++, nDat ); \
break; \
case 8 : \
- pAcc->SetPixel( ny, nx++, nDat ); \
+ pAcc->SetPixelIndex( ny, nx++, nDat ); \
break; \
}
diff --git a/filter/source/graphicfilter/ipsd/ipsd.cxx b/filter/source/graphicfilter/ipsd/ipsd.cxx
index be3ada272565..5c07066d5b29 100644
--- a/filter/source/graphicfilter/ipsd/ipsd.cxx
+++ b/filter/source/graphicfilter/ipsd/ipsd.cxx
@@ -368,7 +368,7 @@ sal_Bool PSDReader::ImplReadBody()
}
for ( sal_uInt16 i = 0; i < ( -nRunCount + 1 ); i++ )
{
- mpWriteAcc->SetPixel( nY, nX, (sal_uInt8)nDat >> nBitCount-- );
+ mpWriteAcc->SetPixelIndex( nY, nX, nDat >> nBitCount-- );
if ( ++nX == mpFileHeader->nColumns )
{
nX = 0;
@@ -389,7 +389,7 @@ sal_Bool PSDReader::ImplReadBody()
nDat ^= 0xff;
nBitCount = 7;
}
- mpWriteAcc->SetPixel( nY, nX, (sal_uInt8)nDat >> nBitCount-- );
+ mpWriteAcc->SetPixelIndex( nY, nX, nDat >> nBitCount-- );
if ( ++nX == mpFileHeader->nColumns )
{
nX = 0;
@@ -418,7 +418,7 @@ sal_Bool PSDReader::ImplReadBody()
*mpPSD >> nDummy;
for ( sal_uInt16 i = 0; i < ( -nRunCount + 1 ); i++ )
{
- mpWriteAcc->SetPixel( nY, nX, (sal_uInt8)nDat );
+ mpWriteAcc->SetPixelIndex( nY, nX, nDat );
if ( ++nX == mpFileHeader->nColumns )
{
nX = 0;
@@ -435,7 +435,7 @@ sal_Bool PSDReader::ImplReadBody()
*mpPSD >> nDat;
if ( mpFileHeader->nDepth == 16 ) // 16 bit depth is to be skipped
*mpPSD >> nDummy;
- mpWriteAcc->SetPixel( nY, nX, (sal_uInt8)nDat );
+ mpWriteAcc->SetPixelIndex( nY, nX, nDat );
if ( ++nX == mpFileHeader->nColumns )
{
nX = 0;
@@ -686,7 +686,7 @@ sal_Bool PSDReader::ImplReadBody()
*mpPSD >> nDummy;
for ( sal_uInt16 i = 0; i < ( -nRunCount + 1 ); i++ )
{
- mpMaskWriteAcc->SetPixel( nY, nX, (sal_uInt8)nDat );
+ mpMaskWriteAcc->SetPixelIndex( nY, nX, nDat );
if ( ++nX == mpFileHeader->nColumns )
{
nX = 0;
@@ -707,7 +707,7 @@ sal_Bool PSDReader::ImplReadBody()
nDat = 1;
if ( mpFileHeader->nDepth == 16 ) // 16 bit depth is to be skipped
*mpPSD >> nDummy;
- mpMaskWriteAcc->SetPixel( nY, nX, (sal_uInt8)nDat );
+ mpMaskWriteAcc->SetPixelIndex( nY, nX, nDat );
if ( ++nX == mpFileHeader->nColumns )
{
nX = 0;
diff --git a/filter/source/graphicfilter/iras/iras.cxx b/filter/source/graphicfilter/iras/iras.cxx
index 48923d15a4b1..7efafda5fcb0 100644
--- a/filter/source/graphicfilter/iras/iras.cxx
+++ b/filter/source/graphicfilter/iras/iras.cxx
@@ -229,8 +229,7 @@ sal_Bool RASReader::ImplReadBody()
{
if (!(x & 7))
nDat = ImplGetByte();
- mpAcc->SetPixel (
- y, x,
+ mpAcc->SetPixelIndex( y, x,
sal::static_int_cast< sal_uInt8 >(
nDat >> ( ( x & 7 ) ^ 7 )) );
}
@@ -244,7 +243,7 @@ sal_Bool RASReader::ImplReadBody()
for ( x = 0; x < mnWidth; x++ )
{
nDat = ImplGetByte();
- mpAcc->SetPixel ( y, x, nDat );
+ mpAcc->SetPixelIndex( y, x, nDat );
}
if ( x & 1 ) ImplGetByte(); // WORD ALIGNMENT ???
}
diff --git a/filter/source/graphicfilter/itga/itga.cxx b/filter/source/graphicfilter/itga/itga.cxx
index d4d217743a51..7e51d82979c4 100644
--- a/filter/source/graphicfilter/itga/itga.cxx
+++ b/filter/source/graphicfilter/itga/itga.cxx
@@ -380,7 +380,7 @@ sal_Bool TGAReader::ImplReadBody()
return sal_False;
for ( sal_uInt16 i = 0; i < ( ( nRunCount & 0x7f ) + 1 ); i++ )
{
- mpAcc->SetPixel( nY, nX, (sal_uInt8)nDummy );
+ mpAcc->SetPixelIndex( nY, nX, nDummy );
nX += nXAdd;
nXCount++;
if ( nXCount == mpFileHeader->nImageWidth )
@@ -403,7 +403,7 @@ sal_Bool TGAReader::ImplReadBody()
*mpTGA >> nDummy;
if ( nDummy >= mpFileHeader->nColorMapLength )
return sal_False;
- mpAcc->SetPixel( nY, nX, (sal_uInt8)nDummy );
+ mpAcc->SetPixelIndex( nY, nX, nDummy );
nX += nXAdd;
nXCount++;
if ( nXCount == mpFileHeader->nImageWidth )
@@ -617,7 +617,7 @@ sal_Bool TGAReader::ImplReadBody()
*mpTGA >> nDummy;
if ( nDummy >= mpFileHeader->nColorMapLength )
return sal_False;
- mpAcc->SetPixel( nY, nX, (sal_uInt8)nDummy );
+ mpAcc->SetPixelIndex( nY, nX, nDummy );
}
break;
default:
diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx
index b5a127318923..4cb6400e1eea 100644
--- a/filter/source/graphicfilter/itiff/itiff.cxx
+++ b/filter/source/graphicfilter/itiff/itiff.cxx
@@ -871,7 +871,7 @@ sal_Bool TIFFReader::ConvertScanline( sal_uLong nY )
nLast = BYTESWAP( (sal_uInt8)*pt++ );
for ( nx = 0; nx < nImageWidth; nx++ )
{
- pAcc->SetPixel( nY, nx, nLast );
+ pAcc->SetPixelIndex( nY, nx, nLast );
nLast = nLast + *pt++;
}
}
@@ -880,7 +880,7 @@ sal_Bool TIFFReader::ConvertScanline( sal_uLong nY )
for ( nx = 0; nx < nImageWidth; nx++ )
{
nLast = *pt++;
- pAcc->SetPixel( nY, nx, (sal_uInt8)( ( (BYTESWAP((sal_uLong)nLast ) - nMinSampleValue ) * nMinMax ) ) );
+ pAcc->SetPixelIndex( nY, nx, static_cast<sal_uInt8>( (BYTESWAP((sal_uLong)nLast) - nMinSampleValue) * nMinMax ) );
}
}
}
@@ -891,7 +891,7 @@ sal_Bool TIFFReader::ConvertScanline( sal_uLong nY )
nLast = *pt++;
for ( nx = 0; nx < nImageWidth; nx++ )
{
- pAcc->SetPixel( nY, nx, nLast );
+ pAcc->SetPixelIndex( nY, nx, nLast );
nLast = nLast + *pt++;
}
}
@@ -899,7 +899,7 @@ sal_Bool TIFFReader::ConvertScanline( sal_uLong nY )
{
for ( nx = 0; nx < nImageWidth; nx++ )
{
- pAcc->SetPixel( nY, nx, (sal_uInt8)( ( (sal_uLong)*pt++ - nMinSampleValue ) * nMinMax ) );
+ pAcc->SetPixelIndex( nY, nx, static_cast<sal_uInt8>( ((sal_uLong)*pt++ - nMinSampleValue) * nMinMax ) );
}
}
@@ -917,7 +917,7 @@ sal_Bool TIFFReader::ConvertScanline( sal_uLong nY )
for ( nx = 0; nx < nImageWidth; nx++ )
{
nVal = ( GetBits( pt, nx * nBitsPerSample, nBitsPerSample ) - nMinSampleValue ) * nMinMax;
- pAcc->SetPixel( nY, nx, (sal_uInt8)nVal );
+ pAcc->SetPixelIndex( nY, nx, static_cast<sal_uInt8>(nVal));
}
}
break;
@@ -931,28 +931,28 @@ sal_Bool TIFFReader::ConvertScanline( sal_uLong nY )
while ( --nByteCount )
{
nByteVal = *pt++;
- pAcc->SetPixel( nY, nx++, nByteVal & 1 );
+ pAcc->SetPixelIndex( nY, nx++, nByteVal & 1 );
nByteVal >>= 1;
- pAcc->SetPixel( nY, nx++, nByteVal & 1 );
+ pAcc->SetPixelIndex( nY, nx++, nByteVal & 1 );
nByteVal >>= 1;
- pAcc->SetPixel( nY, nx++, nByteVal & 1 );
+ pAcc->SetPixelIndex( nY, nx++, nByteVal & 1 );
nByteVal >>= 1;
- pAcc->SetPixel( nY, nx++, nByteVal & 1 );
+ pAcc->SetPixelIndex( nY, nx++, nByteVal & 1 );
nByteVal >>= 1;
- pAcc->SetPixel( nY, nx++, nByteVal & 1 );
+ pAcc->SetPixelIndex( nY, nx++, nByteVal & 1 );
nByteVal >>= 1;
- pAcc->SetPixel( nY, nx++, nByteVal & 1 );
+ pAcc->SetPixelIndex( nY, nx++, nByteVal & 1 );
nByteVal >>= 1;
- pAcc->SetPixel( nY, nx++, nByteVal & 1 );
+ pAcc->SetPixelIndex( nY, nx++, nByteVal & 1 );
nByteVal >>= 1;
- pAcc->SetPixel( nY, nx++, nByteVal );
+ pAcc->SetPixelIndex( nY, nx++, nByteVal );
}
if ( nImageWidth & 7 )
{
nByteVal = *pt++;
while ( nx < nImageWidth )
{
- pAcc->SetPixel( nY, nx++, nByteVal & 1 );
+ pAcc->SetPixelIndex( nY, nx++, nByteVal & 1 );
nByteVal >>= 1;
}
}
@@ -964,21 +964,21 @@ sal_Bool TIFFReader::ConvertScanline( sal_uLong nY )
while ( --nByteCount )
{
nByteVal = *pt++;
- pAcc->SetPixel( nY, nx, nByteVal & 1 );
+ pAcc->SetPixelIndex( nY, nx, nByteVal & 1 );
nByteVal >>= 1;
- pAcc->SetPixel( nY, --nx, nByteVal & 1 );
+ pAcc->SetPixelIndex( nY, --nx, nByteVal & 1 );
nByteVal >>= 1;
- pAcc->SetPixel( nY, --nx, nByteVal & 1 );
+ pAcc->SetPixelIndex( nY, --nx, nByteVal & 1 );
nByteVal >>= 1;
- pAcc->SetPixel( nY, --nx, nByteVal & 1 );
+ pAcc->SetPixelIndex( nY, --nx, nByteVal & 1 );
nByteVal >>= 1;
- pAcc->SetPixel( nY, --nx, nByteVal & 1 );
+ pAcc->SetPixelIndex( nY, --nx, nByteVal & 1 );
nByteVal >>= 1;
- pAcc->SetPixel( nY, --nx, nByteVal & 1 );
+ pAcc->SetPixelIndex( nY, --nx, nByteVal & 1 );
nByteVal >>= 1;
- pAcc->SetPixel( nY, --nx, nByteVal & 1 );
+ pAcc->SetPixelIndex( nY, --nx, nByteVal & 1 );
nByteVal >>= 1;
- pAcc->SetPixel( nY, --nx, nByteVal );
+ pAcc->SetPixelIndex( nY, --nx, nByteVal );
nx += 15;
}
if ( nImageWidth & 7 )
@@ -988,7 +988,7 @@ sal_Bool TIFFReader::ConvertScanline( sal_uLong nY )
nShift = 7;
while ( nx < nImageWidth )
{
- pAcc->SetPixel( nY, nx++, ( nByteVal >> nShift ) & 1);
+ pAcc->SetPixelIndex( nY, nx++, ( nByteVal >> nShift ) & 1);
}
}
}
@@ -1011,7 +1011,7 @@ sal_Bool TIFFReader::ConvertScanline( sal_uLong nY )
pt++;
for ( nx = 0; nx < nImageWidth; nx++, pt += 2 )
{
- pAcc->SetPixel( nY, nx, (sal_uInt8)( ( (sal_uLong)*pt - nMinSampleValue ) * nMinMax ) );
+ pAcc->SetPixelIndex( nY, nx, static_cast<sal_uInt8>( ((sal_uLong)*pt - nMinSampleValue) * nMinMax) );
}
}
}
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 4386e12d2a0d..51af756dc9d4 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -5912,7 +5912,7 @@ void PPTPortionObj::ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, s
{
for( long nX = 0L; nX < nWidth; nX++ )
{
- const BitmapColor& rCol = pAcc->GetPaletteColor( (sal_uInt8) pAcc->GetPixel( nY, nX ) );
+ const BitmapColor& rCol = pAcc->GetPaletteColor( pAcc->GetPixelIndex( nY, nX ) );
nRt+=rCol.GetRed(); nGn+=rCol.GetGreen(); nBl+=rCol.GetBlue();
}
}
diff --git a/sd/source/ui/slidesorter/view/SlsButtonBar.cxx b/sd/source/ui/slidesorter/view/SlsButtonBar.cxx
index d6f71505c345..ff088bf4675a 100644
--- a/sd/source/ui/slidesorter/view/SlsButtonBar.cxx
+++ b/sd/source/ui/slidesorter/view/SlsButtonBar.cxx
@@ -158,7 +158,7 @@ namespace {
static_cast<sal_Int32>(nValue * (1-nAlpha)),
0,
255));
- pBitmap->SetPixel(nY, nX, 255-sal_uInt8(nNewValue));
+ pBitmap->SetPixelIndex(nY, nX, static_cast<sal_uInt8>(255-nNewValue));
}
}
}
diff --git a/svtools/source/filter/igif/gifread.cxx b/svtools/source/filter/igif/gifread.cxx
index 979ce1d172ca..10a467413ec3 100644
--- a/svtools/source/filter/igif/gifread.cxx
+++ b/svtools/source/filter/igif/gifread.cxx
@@ -523,15 +523,15 @@ void GIFReader::FillImages( HPBYTE pBytes, sal_uLong nCount )
if( bGCTransparent )
{
if( cTmp == nGCTransparentIndex )
- pAcc1->SetPixel( nYAcc, nImageX++, cTransIndex1 );
+ pAcc1->SetPixelIndex( nYAcc, nImageX++, cTransIndex1 );
else
{
- pAcc8->SetPixel( nYAcc, nImageX, cTmp );
- pAcc1->SetPixel( nYAcc, nImageX++, cNonTransIndex1 );
+ pAcc8->SetPixelIndex( nYAcc, nImageX, cTmp );
+ pAcc1->SetPixelIndex( nYAcc, nImageX++, cNonTransIndex1 );
}
}
else
- pAcc8->SetPixel( nYAcc, nImageX++, cTmp );
+ pAcc8->SetPixelIndex( nYAcc, nImageX++, cTmp );
}
else
{
diff --git a/svtools/source/filter/jpeg/jpeg.cxx b/svtools/source/filter/jpeg/jpeg.cxx
index 78316c4e14c4..d544e064537b 100644
--- a/svtools/source/filter/jpeg/jpeg.cxx
+++ b/svtools/source/filter/jpeg/jpeg.cxx
@@ -660,7 +660,7 @@ void* JPEGWriter::GetScanline( long nY )
{
for( long nX = 0L; nX < nWidth; nX++ )
{
- aColor = pAcc->GetPaletteColor( (sal_uInt8) pAcc->GetPixel( nY, nX ) );
+ aColor = pAcc->GetPaletteColor( pAcc->GetPixelIndex( nY, nX ) );
*pTmp++ = aColor.GetRed();
if ( bGreys )
continue;
@@ -721,7 +721,7 @@ sal_Bool JPEGWriter::Write( const Graphic& rGraphic )
BitmapColor aColor;
for( long nX = 0L; bIsGrey && ( nX < nWidth ); nX++ )
{
- aColor = pAcc->HasPalette() ? pAcc->GetPaletteColor( (sal_uInt8) pAcc->GetPixel( nY, nX ) )
+ aColor = pAcc->HasPalette() ? pAcc->GetPaletteColor( pAcc->GetPixelIndex( nY, nX ) )
: pAcc->GetPixel( nY, nX );
bIsGrey = ( aColor.GetRed() == aColor.GetGreen() ) && ( aColor.GetRed() == aColor.GetBlue() );
}
diff --git a/svtools/source/filter/wmf/winwmf.cxx b/svtools/source/filter/wmf/winwmf.cxx
index 91fe7d7641be..0ecfed202a7e 100644
--- a/svtools/source/filter/wmf/winwmf.cxx
+++ b/svtools/source/filter/wmf/winwmf.cxx
@@ -562,7 +562,7 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc )
{
if ( x < nWidth )
{
- pAcc->SetPixel( y, x, (nEightPixels>>i)&1 );
+ pAcc->SetPixelIndex( y, x, (nEightPixels>>i)&1 );
}
x++;
}
diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx
index 61bc4b310038..c599a1d3f48d 100644
--- a/svtools/source/graphic/grfmgr2.cxx
+++ b/svtools/source/graphic/grfmgr2.cxx
@@ -993,14 +993,14 @@ sal_Bool GraphicManager::ImplCreateScaled( const BitmapEx& rBmpEx,
{
nTmpX = pMapIX[ nX ]; nTmpFX = pMapFX[ nX ];
- aCol0 = pAcc->GetPaletteColor( pAcc->GetPixel( nTmpY, nTmpX ) );
- aCol1 = pAcc->GetPaletteColor( pAcc->GetPixel( nTmpY, ++nTmpX ) );
+ aCol0 = pAcc->GetPaletteColor( pAcc->GetPixelIndex( nTmpY, nTmpX ) );
+ aCol1 = pAcc->GetPaletteColor( pAcc->GetPixelIndex( nTmpY, ++nTmpX ) );
cR0 = MAP( aCol0.GetRed(), aCol1.GetRed(), nTmpFX );
cG0 = MAP( aCol0.GetGreen(), aCol1.GetGreen(), nTmpFX );
cB0 = MAP( aCol0.GetBlue(), aCol1.GetBlue(), nTmpFX );
- aCol1 = pAcc->GetPaletteColor( pAcc->GetPixel( ++nTmpY, nTmpX ) );
- aCol0 = pAcc->GetPaletteColor( pAcc->GetPixel( nTmpY--, --nTmpX ) );
+ aCol1 = pAcc->GetPaletteColor( pAcc->GetPixelIndex( ++nTmpY, nTmpX ) );
+ aCol0 = pAcc->GetPaletteColor( pAcc->GetPixelIndex( nTmpY--, --nTmpX ) );
cR1 = MAP( aCol0.GetRed(), aCol1.GetRed(), nTmpFX );
cG1 = MAP( aCol0.GetGreen(), aCol1.GetGreen(), nTmpFX );
cB1 = MAP( aCol0.GetBlue(), aCol1.GetBlue(), nTmpFX );
@@ -1273,7 +1273,7 @@ sal_Bool GraphicManager::ImplCreateScaled( const BitmapEx& rBmpEx,
{
for( nX = 0L; nX < nDstW; nX++ )
{
- if( pAcc->GetPaletteColor( (sal_uInt8) pAcc->GetPixel( pMapLY[ nY ], pMapLX[ nX ] ) ) == aB )
+ if( pAcc->GetPaletteColor( pAcc->GetPixelIndex( pMapLY[ nY ], pMapLX[ nX ] ) ) == aB )
pWAcc->SetPixel( nY, nX, aWB );
else
pWAcc->SetPixel( nY, nX, aWW );
@@ -1387,14 +1387,14 @@ sal_Bool GraphicManager::ImplCreateRotatedScaled( const BitmapEx& rBmpEx,
nTmpX = pMapIX[ nUnRotX ]; nTmpFX = pMapFX[ nUnRotX ];
nTmpY = pMapIY[ nUnRotY ], nTmpFY = pMapFY[ nUnRotY ];
- const BitmapColor& rCol0 = pAcc->GetPaletteColor( pAcc->GetPixel( nTmpY, nTmpX ) );
- const BitmapColor& rCol1 = pAcc->GetPaletteColor( pAcc->GetPixel( nTmpY, ++nTmpX ) );
+ const BitmapColor& rCol0 = pAcc->GetPaletteColor( pAcc->GetPixelIndex( nTmpY, nTmpX ) );
+ const BitmapColor& rCol1 = pAcc->GetPaletteColor( pAcc->GetPixelIndex( nTmpY, ++nTmpX ) );
cR0 = MAP( rCol0.GetRed(), rCol1.GetRed(), nTmpFX );
cG0 = MAP( rCol0.GetGreen(), rCol1.GetGreen(), nTmpFX );
cB0 = MAP( rCol0.GetBlue(), rCol1.GetBlue(), nTmpFX );
- const BitmapColor& rCol3 = pAcc->GetPaletteColor( pAcc->GetPixel( ++nTmpY, nTmpX ) );
- const BitmapColor& rCol2 = pAcc->GetPaletteColor( pAcc->GetPixel( nTmpY, --nTmpX ) );
+ const BitmapColor& rCol3 = pAcc->GetPaletteColor( pAcc->GetPixelIndex( ++nTmpY, nTmpX ) );
+ const BitmapColor& rCol2 = pAcc->GetPaletteColor( pAcc->GetPixelIndex( nTmpY, --nTmpX ) );
cR1 = MAP( rCol2.GetRed(), rCol3.GetRed(), nTmpFX );
cG1 = MAP( rCol2.GetGreen(), rCol3.GetGreen(), nTmpFX );
cB1 = MAP( rCol2.GetBlue(), rCol3.GetBlue(), nTmpFX );
diff --git a/svtools/source/graphic/transformer.cxx b/svtools/source/graphic/transformer.cxx
index cb437c0b786b..b8eadb247961 100644
--- a/svtools/source/graphic/transformer.cxx
+++ b/svtools/source/graphic/transformer.cxx
@@ -62,22 +62,19 @@ GraphicTransformer::~GraphicTransformer()
// ------------------------------------------------------------------------------
-void setAlpha( Bitmap& rBitmap, AlphaMask& rAlpha, sal_Int32 nColorFrom, sal_Int8 nAlphaTo )
+void setAlpha( Bitmap& rBitmap, AlphaMask& rAlpha, sal_uInt8 cIndexFrom, sal_Int8 nAlphaTo )
{
BitmapWriteAccess* pWriteAccess = rAlpha.AcquireWriteAccess();
BitmapReadAccess* pReadAccess = rBitmap.AcquireReadAccess();
- BitmapColor aColorFrom( static_cast< sal_uInt8 >( nColorFrom >> 16 ),
- static_cast< sal_uInt8 >( nColorFrom >> 8 ),
- static_cast< sal_uInt8 >( nColorFrom ) );
if ( pReadAccess && pWriteAccess )
{
for ( sal_Int32 nY = 0; nY < pReadAccess->Height(); nY++ )
{
for ( sal_Int32 nX = 0; nX < pReadAccess->Width(); nX++ )
{
- BitmapColor aColor( pReadAccess->GetPixel( nY, nX ) );
- if ( aColor == aColorFrom )
- pWriteAccess->SetPixel( nY, nX, nAlphaTo );
+ const sal_uInt8 cIndex = pReadAccess->GetPixelIndex( nY, nX );
+ if ( cIndex == cIndexFrom )
+ pWriteAccess->SetPixelIndex( nY, nX, nAlphaTo );
}
}
}
@@ -95,6 +92,7 @@ uno::Reference< graphic::XGraphic > SAL_CALL GraphicTransformer::colorChange(
BitmapColor aColorFrom( static_cast< sal_uInt8 >( nColorFrom ), static_cast< sal_uInt8 >( nColorFrom >> 8 ), static_cast< sal_uInt8 >( nColorFrom >> 16 ) );
BitmapColor aColorTo( static_cast< sal_uInt8 >( nColorTo ), static_cast< sal_uInt8 >( nColorTo >> 8 ), static_cast< sal_uInt8 >( nColorTo >> 16 ) );
+ const sal_uInt8 cIndexFrom = aColorFrom.GetBlueOrIndex();
if ( aGraphic.GetType() == GRAPHIC_BITMAP )
{
@@ -104,7 +102,7 @@ uno::Reference< graphic::XGraphic > SAL_CALL GraphicTransformer::colorChange(
if ( aBitmapEx.IsAlpha() )
{
AlphaMask aAlphaMask( aBitmapEx.GetAlpha() );
- setAlpha( aBitmap, aAlphaMask, aColorFrom, nAlphaTo );
+ setAlpha( aBitmap, aAlphaMask, cIndexFrom, nAlphaTo );
aBitmap.Replace( aColorFrom, aColorTo, nTolerance );
aGraphic = ::Graphic( BitmapEx( aBitmap, aAlphaMask ) );
}
@@ -121,7 +119,7 @@ uno::Reference< graphic::XGraphic > SAL_CALL GraphicTransformer::colorChange(
else
{
AlphaMask aAlphaMask( aBitmapEx.GetMask() );
- setAlpha( aBitmap, aAlphaMask, aColorFrom, nAlphaTo );
+ setAlpha( aBitmap, aAlphaMask, cIndexFrom, nAlphaTo );
aBitmap.Replace( aColorFrom, aColorTo, nTolerance );
aGraphic = ::Graphic( BitmapEx( aBitmap, aAlphaMask ) );
}
@@ -137,7 +135,7 @@ uno::Reference< graphic::XGraphic > SAL_CALL GraphicTransformer::colorChange(
else
{
AlphaMask aAlphaMask( aBitmapEx.GetSizePixel() );
- setAlpha( aBitmap, aAlphaMask, aColorFrom, nAlphaTo );
+ setAlpha( aBitmap, aAlphaMask, cIndexFrom, nAlphaTo );
aBitmap.Replace( aColorFrom, aColorTo, nTolerance );
aGraphic = ::Graphic( BitmapEx( aBitmap, aAlphaMask ) );
}
diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx
index 4544e640b762..66f348a98448 100644
--- a/svx/source/svdraw/svdetc.cxx
+++ b/svx/source/svdraw/svdetc.cxx
@@ -558,9 +558,7 @@ FASTBOOL GetDraftFillColor(const SfxItemSet& rSet, Color& rCol)
{
for(sal_uInt32 nX(0L); nX < nWidth; nX += nXStep)
{
- const BitmapColor& rCol2 = (pAccess->HasPalette())
- ? pAccess->GetPaletteColor((sal_uInt8)pAccess->GetPixel(nY, nX))
- : pAccess->GetPixel(nY, nX);
+ const BitmapColor& rCol2 = pAccess->GetColor(nY, nX);
nRt += rCol2.GetRed();
nGn += rCol2.GetGreen();
diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx
index d2608c52fb35..fd04551a20ee 100644
--- a/svx/source/xoutdev/_xoutbmp.cxx
+++ b/svx/source/xoutdev/_xoutbmp.cxx
@@ -577,13 +577,13 @@ Bitmap XOutBitmap::DetectEdges( const Bitmap& rBmp, const sal_uInt8 cThreshold )
const long nHeight = aSize.Height();
const long nHeight2 = nHeight - 2L;
const long lThres2 = (long) cThreshold * cThreshold;
- const BitmapColor aWhite = (sal_uInt8) pWriteAcc->GetBestMatchingColor( Color( COL_WHITE ) );
- const BitmapColor aBlack = (sal_uInt8) pWriteAcc->GetBestMatchingColor( Color( COL_BLACK ) );
+ const sal_uInt8 nWhitePalIdx = pWriteAcc->GetBestPaletteIndex( Color( COL_WHITE ) );
+ const sal_uInt8 nBlackPalIdx = pWriteAcc->GetBestPaletteIndex( Color( COL_BLACK ) );
long nSum1;
long nSum2;
long lGray;
- // Rand mit Weiss init.
+ // initialize border with white pixels
pWriteAcc->SetLineColor( Color( COL_WHITE) );
pWriteAcc->DrawLine( Point(), Point( nWidth - 1L, 0L ) );
pWriteAcc->DrawLine( Point( nWidth - 1L, 0L ), Point( nWidth - 1L, nHeight - 1L ) );
@@ -596,24 +596,24 @@ Bitmap XOutBitmap::DetectEdges( const Bitmap& rBmp, const sal_uInt8 cThreshold )
{
nXTmp = nX;
- nSum1 = -( nSum2 = lGray = (sal_uInt8) pReadAcc->GetPixel( nY, nXTmp++ ) );
- nSum2 += ( (long) (sal_uInt8) pReadAcc->GetPixel( nY, nXTmp++ ) ) << 1;
- nSum1 += ( lGray = pReadAcc->GetPixel( nY, nXTmp ) );
+ nSum1 = -( nSum2 = lGray = pReadAcc->GetPixelIndex( nY, nXTmp++ ) );
+ nSum2 += ( (long) pReadAcc->GetPixelIndex( nY, nXTmp++ ) ) << 1;
+ nSum1 += ( lGray = pReadAcc->GetPixelIndex( nY, nXTmp ) );
nSum2 += lGray;
- nSum1 += ( (long) (sal_uInt8) pReadAcc->GetPixel( nY1, nXTmp ) ) << 1;
- nSum1 -= ( (long) (sal_uInt8) pReadAcc->GetPixel( nY1, nXTmp -= 2 ) ) << 1;
+ nSum1 += ( (long) pReadAcc->GetPixelIndex( nY1, nXTmp ) ) << 1;
+ nSum1 -= ( (long) pReadAcc->GetPixelIndex( nY1, nXTmp -= 2 ) ) << 1;
- nSum1 += ( lGray = -(long) (sal_uInt8) pReadAcc->GetPixel( nY2, nXTmp++ ) );
+ nSum1 += ( lGray = -(long) pReadAcc->GetPixelIndex( nY2, nXTmp++ ) );
nSum2 += lGray;
- nSum2 -= ( (long) (sal_uInt8) pReadAcc->GetPixel( nY2, nXTmp++ ) ) << 1;
- nSum1 += ( lGray = (long) (sal_uInt8) pReadAcc->GetPixel( nY2, nXTmp ) );
+ nSum2 -= ( (long) pReadAcc->GetPixelIndex( nY2, nXTmp++ ) ) << 1;
+ nSum1 += ( lGray = (long) pReadAcc->GetPixelIndex( nY2, nXTmp ) );
nSum2 -= lGray;
if( ( nSum1 * nSum1 + nSum2 * nSum2 ) < lThres2 )
- pWriteAcc->SetPixel( nY1, nXDst, aWhite );
+ pWriteAcc->SetPixelIndex( nY1, nXDst, nWhiteIdx );
else
- pWriteAcc->SetPixel( nY1, nXDst, aBlack );
+ pWriteAcc->SetPixelIndex( nY1, nXDst, nBlackIdx );
}
}
diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx
index 266492712cd8..9606a963771b 100644
--- a/svx/source/xoutdev/xattrbmp.cxx
+++ b/svx/source/xoutdev/xattrbmp.cxx
@@ -94,11 +94,11 @@ Bitmap createHistorical8x8FromArray(const sal_uInt16* pArray, Color aColorPix, C
{
if(pArray[(a * 8) + b])
{
- pContent->SetPixel(b, a, sal_uInt8(1));
+ pContent->SetPixelIndex(b, a, 1);
}
else
{
- pContent->SetPixel(b, a, sal_uInt8(0));
+ pContent->SetPixelIndex(b, a, 0);
}
}
}
diff --git a/vcl/inc/vcl/bmpacc.hxx b/vcl/inc/vcl/bmpacc.hxx
index 8c29b8cebf4d..c22e865f0d8e 100644
--- a/vcl/inc/vcl/bmpacc.hxx
+++ b/vcl/inc/vcl/bmpacc.hxx
@@ -169,7 +169,8 @@ public:
inline void SetPixelOnData( sal_uInt8* pData, long nX, const BitmapColor& rBitmapColor );
inline BitmapColor GetPixel( long nY, long nX ) const;
inline BitmapColor GetColor( long nY, long nX ) const;
- inline sal_uInt8 GetLuminance( long nY, long nX ) const;
+ inline sal_uInt8 GetPixelIndex( long nY, long nX ) const;
+ inline sal_uInt8 GetLuminance( long nY, long nX ) const;
};
// ---------------------
@@ -194,6 +195,7 @@ public:
inline void SetPaletteColor( sal_uInt16 nColor, const BitmapColor& rBitmapColor );
inline void SetPixel( long nY, long nX, const BitmapColor& rBitmapColor );
+ inline void SetPixelIndex( long nY, long nX, sal_uInt8 cIndex );
void SetLineColor();
void SetLineColor( const Color& rColor );
@@ -467,6 +469,11 @@ inline BitmapColor BitmapReadAccess::GetPixel( long nY, long nX ) const
return mFncGetPixel( mpScanBuf[ nY ], nX, maColorMask );
}
+inline sal_uInt8 BitmapReadAccess::GetPixelIndex( long nY, long nX ) const
+{
+ return GetPixel( nY, nX ).GetBlueOrIndex();
+}
+
// ------------------------------------------------------------------
inline BitmapColor BitmapReadAccess::GetPixelFromData( const sal_uInt8* pData, long nX ) const
@@ -487,11 +494,8 @@ inline void BitmapReadAccess::SetPixelOnData( sal_uInt8* pData, long nX, const B
inline BitmapColor BitmapReadAccess::GetColor( long nY, long nX ) const
{
- if( !!mpBuffer->maPalette )
- {
- DBG_ASSERT( mpBuffer, "Access is not valid!" );
- return mpBuffer->maPalette[ GetPixel( nY, nX ).GetIndex() ];
- }
+ if( HasPalette() )
+ return mpBuffer->maPalette[ GetPixelIndex( nY, nX ) ];
else
return GetPixel( nY, nX );
}
@@ -538,4 +542,11 @@ inline void BitmapWriteAccess::SetPixel( long nY, long nX, const BitmapColor& rB
mFncSetPixel( mpScanBuf[ nY ], nX, rBitmapColor, maColorMask );
}
+inline void BitmapWriteAccess::SetPixelIndex( long nY, long nX, sal_uInt8 cIndex )
+{
+ SetPixel( nY, nX, BitmapColor( cIndex ));
+}
+
+// ------------------------------------------------------------------
+
#endif // _SV_BMPACC_HXX
diff --git a/vcl/inc/vcl/salbtype.hxx b/vcl/inc/vcl/salbtype.hxx
index 88b598664e84..e3705cb0a10c 100644
--- a/vcl/inc/vcl/salbtype.hxx
+++ b/vcl/inc/vcl/salbtype.hxx
@@ -123,7 +123,11 @@ public:
inline BitmapColor( const BitmapColor& rBitmapColor );
inline BitmapColor( sal_uInt8 cRed, sal_uInt8 cGreen, sal_uInt8 cBlue );
inline BitmapColor( const Color& rColor );
+#ifndef BINFILTER_COMPAT
+ explicit
+#endif // BINFILTER_COMPAT
inline BitmapColor( sal_uInt8 cIndex );
+
inline ~BitmapColor() {};
inline sal_Bool operator==( const BitmapColor& rBitmapColor ) const;
@@ -144,8 +148,10 @@ public:
inline sal_uInt8 GetIndex() const;
inline void SetIndex( sal_uInt8 cIndex );
+#ifdef BINFILTER_COMPAT
+ operator sal_uInt8() const { return mcBlueOrIndex; }
+#endif // BINFILTER_COMPAT
operator Color() const;
- inline operator sal_uInt8() const;
inline sal_uInt8 GetBlueOrIndex() const;
@@ -437,14 +443,6 @@ inline BitmapColor::operator Color() const
// ------------------------------------------------------------------
-inline BitmapColor::operator sal_uInt8() const
-{
- DBG_ASSERT( mbIndex, "Pixel represents color values!" );
- return mcBlueOrIndex;
-}
-
-// ------------------------------------------------------------------
-
inline sal_uInt8 BitmapColor::GetBlueOrIndex() const
{
// #i47518# Yield a value regardless of mbIndex
diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx
index d7ae4f09aca3..409cf5cf2828 100644
--- a/vcl/source/gdi/bitmap.cxx
+++ b/vcl/source/gdi/bitmap.cxx
@@ -1039,7 +1039,7 @@ sal_Bool Bitmap::CopyPixel( const Rectangle& rRectDst,
for( long nSrcY = aRectSrc.Top(); nSrcY < nSrcEndY; nSrcY++, nDstY++ )
for( long nSrcX = aRectSrc.Left(), nDstX = aRectDst.Left(); nSrcX < nSrcEndX; nSrcX++, nDstX++ )
- pWriteAcc->SetPixel( nDstY, nDstX, pMap[ pReadAcc->GetPixel( nSrcY, nSrcX ).GetIndex() ] );
+ pWriteAcc->SetPixelIndex( nDstY, nDstX, pMap[ pReadAcc->GetPixelIndex( nSrcY, nSrcX ) ] );
delete[] pMap;
}
@@ -1047,7 +1047,7 @@ sal_Bool Bitmap::CopyPixel( const Rectangle& rRectDst,
{
for( long nSrcY = aRectSrc.Top(); nSrcY < nSrcEndY; nSrcY++, nDstY++ )
for( long nSrcX = aRectSrc.Left(), nDstX = aRectDst.Left(); nSrcX < nSrcEndX; nSrcX++, nDstX++ )
- pWriteAcc->SetPixel( nDstY, nDstX, pReadAcc->GetPaletteColor( pReadAcc->GetPixel( nSrcY, nSrcX ) ) );
+ pWriteAcc->SetPixel( nDstY, nDstX, pReadAcc->GetPaletteColor( pReadAcc->GetPixelIndex( nSrcY, nSrcX ) ) );
}
else
for( long nSrcY = aRectSrc.Top(); nSrcY < nSrcEndY; nSrcY++, nDstY++ )
@@ -1313,7 +1313,7 @@ Bitmap Bitmap::CreateMask( const Color& rTransColor, sal_uLong nTol ) const
{
for( long nX = 0L; nX < nWidth; nX++ )
{
- aCol = pReadAcc->GetPaletteColor( pReadAcc->GetPixel( nY, nX ) );
+ aCol = pReadAcc->GetPaletteColor( pReadAcc->GetPixelIndex( nY, nX ) );
nR = aCol.GetRed();
nG = aCol.GetGreen();
nB = aCol.GetBlue();
@@ -1444,16 +1444,14 @@ sal_Bool Bitmap::Replace( const Bitmap& rMask, const Color& rReplaceColor )
const sal_uInt16 nActColors = pAcc->GetPaletteEntryCount();
const sal_uInt16 nMaxColors = 1 << pAcc->GetBitCount();
- // erst einmal naechste Farbe nehmen
+ // default to the nearest color
aReplace = pAcc->GetBestMatchingColor( rReplaceColor );
- // falls Palettenbild, und die zu setzende Farbe ist nicht
- // in der Palette, suchen wir nach freien Eintraegen (teuer)
- if( pAcc->GetPaletteColor( (sal_uInt8) aReplace ) != BitmapColor( rReplaceColor ) )
+ // for paletted images without a matching palette entry
+ // look for an unused palette entry (NOTE: expensive!)
+ if( pAcc->GetPaletteColor( aReplace.GetIndex() ) != BitmapColor( rReplaceColor ) )
{
- // erst einmal nachsehen, ob wir unsere ReplaceColor
- // nicht auf einen freien Platz am Ende der Palette
- // setzen koennen
+ // if the palette has empty entries use the last one
if( nActColors < nMaxColors )
{
pAcc->SetPaletteEntryCount( nActColors + 1 );
@@ -1469,7 +1467,7 @@ sal_Bool Bitmap::Replace( const Bitmap& rMask, const Color& rReplaceColor )
for( long nY = 0L; nY < nHeight; nY++ )
for( long nX = 0L; nX < nWidth; nX++ )
- pFlags[ (sal_uInt8) pAcc->GetPixel( nY, nX ) ] = sal_True;
+ pFlags[ pAcc->GetPixelIndex( nY, nX ) ] = sal_True;
for( sal_uInt16 i = 0UL; i < nMaxColors; i++ )
{
@@ -1523,7 +1521,7 @@ sal_Bool Bitmap::Replace( const AlphaMask& rAlpha, const Color& rMergeColor )
for( long nX = 0L; nX < nWidth; nX++ )
{
aCol = pAcc->GetColor( nY, nX );
- pNewAcc->SetPixel( nY, nX, aCol.Merge( rMergeColor, 255 - (sal_uInt8) pAlphaAcc->GetPixel( nY, nX ) ) );
+ pNewAcc->SetPixel( nY, nX, aCol.Merge( rMergeColor, 255 - pAlphaAcc->GetPixelIndex( nY, nX ) ) );
}
}
@@ -1935,7 +1933,7 @@ sal_Bool Bitmap::Blend( const AlphaMask& rAlpha, const Color& rBackgroundColor )
for( long nX = 0L; nX < nWidth; ++nX )
pAcc->SetPixel( nY, nX,
pAcc->GetPixel( nY, nX ).Merge( rBackgroundColor,
- 255 - pAlphaAcc->GetPixel( nY, nX ) ) );
+ 255 - pAlphaAcc->GetPixelIndex( nY, nX ) ) );
bRet = sal_True;
}
diff --git a/vcl/source/gdi/bitmap2.cxx b/vcl/source/gdi/bitmap2.cxx
index 680d8a888eda..5992dd62cf0b 100644
--- a/vcl/source/gdi/bitmap2.cxx
+++ b/vcl/source/gdi/bitmap2.cxx
@@ -531,7 +531,7 @@ sal_Bool Bitmap::ImplReadDIBBits( SvStream& rIStm, DIBInfoHeader& rHeader, Bitma
cTmp = *pTmp++;
}
- rAcc.SetPixel( nY, nX, sal::static_int_cast<sal_uInt8>(( cTmp >> --nShift ) & 1) );
+ rAcc.SetPixelIndex( nY, nX, (cTmp >> --nShift) & 1);
}
}
}
@@ -555,7 +555,7 @@ sal_Bool Bitmap::ImplReadDIBBits( SvStream& rIStm, DIBInfoHeader& rHeader, Bitma
cTmp = *pTmp++;
}
- rAcc.SetPixel( nY, nX, sal::static_int_cast<sal_uInt8>(( cTmp >> ( --nShift << 2UL ) ) & 0x0f) );
+ rAcc.SetPixelIndex( nY, nX, (cTmp >> ( --nShift << 2UL ) ) & 0x0f);
}
}
}
@@ -570,7 +570,7 @@ sal_Bool Bitmap::ImplReadDIBBits( SvStream& rIStm, DIBInfoHeader& rHeader, Bitma
rIStm.Read( pTmp = pBuf, nAlignedWidth );
for( long nX = 0L; nX < nWidth; nX++ )
- rAcc.SetPixel( nY, nX, *pTmp++ );
+ rAcc.SetPixelIndex( nY, nX, *pTmp++ );
}
}
break;
@@ -970,7 +970,7 @@ sal_Bool Bitmap::ImplWriteDIBBits( SvStream& rOStm, BitmapReadAccess& rAcc,
cTmp = 0;
}
- cTmp |= ( (sal_uInt8) rAcc.GetPixel( nY, nX ) << --nShift );
+ cTmp |= rAcc.GetPixelIndex( nY, nX ) << --nShift;
}
*pTmp = cTmp;
@@ -995,7 +995,7 @@ sal_Bool Bitmap::ImplWriteDIBBits( SvStream& rOStm, BitmapReadAccess& rAcc,
cTmp = 0;
}
- cTmp |= ( (sal_uInt8) rAcc.GetPixel( nY, nX ) << ( --nShift << 2L ) );
+ cTmp |= rAcc.GetPixelIndex( nY, nX ) << ( --nShift << 2L );
}
*pTmp = cTmp;
rOStm.Write( pBuf, nAlignedWidth );
@@ -1010,7 +1010,7 @@ sal_Bool Bitmap::ImplWriteDIBBits( SvStream& rOStm, BitmapReadAccess& rAcc,
pTmp = pBuf;
for( long nX = 0L; nX < nWidth; nX++ )
- *pTmp++ = rAcc.GetPixel( nY, nX );
+ *pTmp++ = rAcc.GetPixelIndex( nY, nX );
rOStm.Write( pBuf, nAlignedWidth );
}
@@ -1082,16 +1082,16 @@ void Bitmap::ImplDecodeRLE( sal_uInt8* pBuffer, DIBInfoHeader& rHeader,
cTmp = *pRLE++;
if( nX < nWidth )
- rAcc.SetPixel( nY, nX++, cTmp >> 4 );
+ rAcc.SetPixelIndex( nY, nX++, cTmp >> 4 );
if( nX < nWidth )
- rAcc.SetPixel( nY, nX++, cTmp & 0x0f );
+ rAcc.SetPixelIndex( nY, nX++, cTmp & 0x0f );
}
if( nRunByte & 1 )
{
if( nX < nWidth )
- rAcc.SetPixel( nY, nX++, *pRLE >> 4 );
+ rAcc.SetPixelIndex( nY, nX++, *pRLE >> 4 );
pRLE++;
}
@@ -1104,7 +1104,7 @@ void Bitmap::ImplDecodeRLE( sal_uInt8* pBuffer, DIBInfoHeader& rHeader,
for( sal_uLong i = 0UL; i < nRunByte; i++ )
{
if( nX < nWidth )
- rAcc.SetPixel( nY, nX++, *pRLE );
+ rAcc.SetPixelIndex( nY, nX++, *pRLE );
pRLE++;
}
@@ -1137,19 +1137,19 @@ void Bitmap::ImplDecodeRLE( sal_uInt8* pBuffer, DIBInfoHeader& rHeader,
for( sal_uLong i = 0UL; i < nRunByte; i++ )
{
if( nX < nWidth )
- rAcc.SetPixel( nY, nX++, cTmp >> 4 );
+ rAcc.SetPixelIndex( nY, nX++, cTmp >> 4 );
if( nX < nWidth )
- rAcc.SetPixel( nY, nX++, cTmp & 0x0f );
+ rAcc.SetPixelIndex( nY, nX++, cTmp & 0x0f );
}
if( ( nCountByte & 1 ) && ( nX < nWidth ) )
- rAcc.SetPixel( nY, nX++, cTmp >> 4 );
+ rAcc.SetPixelIndex( nY, nX++, cTmp >> 4 );
}
else
{
for( sal_uLong i = 0UL; ( i < nCountByte ) && ( nX < nWidth ); i++ )
- rAcc.SetPixel( nY, nX++, cTmp );
+ rAcc.SetPixelIndex( nY, nX++, cTmp );
}
}
}
@@ -1180,9 +1180,10 @@ sal_Bool Bitmap::ImplWriteRLE( SvStream& rOStm, BitmapReadAccess& rAcc, sal_Bool
while( nX < nWidth )
{
nCount = 1L;
- cPix = rAcc.GetPixel( nY, nX++ );
+ cPix = rAcc.GetPixelIndex( nY, nX++ );
- while( ( nX < nWidth ) && ( nCount < 255L ) && ( cPix == rAcc.GetPixel( nY, nX ) ) )
+ while( ( nX < nWidth ) && ( nCount < 255L )
+ && ( cPix == rAcc.GetPixelIndex( nY, nX ) ) )
{
nX++;
nCount++;
@@ -1200,7 +1201,8 @@ sal_Bool Bitmap::ImplWriteRLE( SvStream& rOStm, BitmapReadAccess& rAcc, sal_Bool
nSaveIndex = nX - 1UL;
bFound = sal_False;
- while( ( nX < nWidth ) && ( nCount < 256L ) && ( cPix = rAcc.GetPixel( nY, nX ) ) != cLast )
+ while( ( nX < nWidth ) && ( nCount < 256L )
+ && ( cPix = rAcc.GetPixelIndex( nY, nX ) ) != cLast )
{
nX++; nCount++;
cLast = cPix;
@@ -1219,10 +1221,10 @@ sal_Bool Bitmap::ImplWriteRLE( SvStream& rOStm, BitmapReadAccess& rAcc, sal_Bool
{
for ( sal_uLong i = 0; i < nCount; i++, pTmp++ )
{
- *pTmp = (sal_uInt8) rAcc.GetPixel( nY, nSaveIndex++ ) << 4;
+ *pTmp = rAcc.GetPixelIndex( nY, nSaveIndex++ ) << 4;
if ( ++i < nCount )
- *pTmp |= rAcc.GetPixel( nY, nSaveIndex++ );
+ *pTmp |= rAcc.GetPixelIndex( nY, nSaveIndex++ );
}
nCount = ( nCount + 1 ) >> 1;
@@ -1230,7 +1232,7 @@ sal_Bool Bitmap::ImplWriteRLE( SvStream& rOStm, BitmapReadAccess& rAcc, sal_Bool
else
{
for( sal_uLong i = 0UL; i < nCount; i++ )
- *pTmp++ = rAcc.GetPixel( nY, nSaveIndex++ );
+ *pTmp++ = rAcc.GetPixelIndex( nY, nSaveIndex++ );
}
if ( nCount & 1 )
@@ -1244,12 +1246,12 @@ sal_Bool Bitmap::ImplWriteRLE( SvStream& rOStm, BitmapReadAccess& rAcc, sal_Bool
else
{
*pTmp++ = 1;
- *pTmp++ = (sal_uInt8) rAcc.GetPixel( nY, nSaveIndex ) << ( bRLE4 ? 4 : 0 );
+ *pTmp++ = rAcc.GetPixelIndex( nY, nSaveIndex ) << (bRLE4 ? 4 : 0);
if ( nCount == 3 )
{
*pTmp++ = 1;
- *pTmp++ = (sal_uInt8) rAcc.GetPixel( nY, ++nSaveIndex ) << ( bRLE4 ? 4 : 0 );
+ *pTmp++ = rAcc.GetPixelIndex( nY, ++nSaveIndex ) << ( bRLE4 ? 4 : 0 );
nBufCount += 4;
}
else
diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index 34dc80ac18cd..2f91cb5e073f 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -383,7 +383,8 @@ sal_Bool Bitmap::ImplMakeMono( sal_uInt8 cThreshold )
{
for( long nX = 0L; nX < nWidth; nX++ )
{
- if( pReadAcc->GetPaletteColor( pReadAcc->GetPixel( nY, nX ) ).GetLuminance() >=
+ const sal_uInt8 cIndex = pReadAcc->GetPixelIndex( nY, nX );
+ if( pReadAcc->GetPaletteColor( cIndex ).GetLuminance() >=
cThreshold )
{
pWriteAcc->SetPixel( nY, nX, aWhite );
@@ -459,7 +460,8 @@ sal_Bool Bitmap::ImplMakeMonoDither()
{
for( long nX = 0L, nModY = nY % 16; nX < nWidth; nX++ )
{
- if( pReadAcc->GetPaletteColor( pReadAcc->GetPixel( nY, nX ) ).GetLuminance() >
+ const sal_uInt8 cIndex = pReadAcc->GetPixelIndex( nY, nX );
+ if( pReadAcc->GetPaletteColor( cIndex ).GetLuminance() >
pDitherMatrix[ nModY ][ nX % 16 ] )
{
pWriteAcc->SetPixel( nY, nX, aWhite );
@@ -541,9 +543,9 @@ sal_Bool Bitmap::ImplMakeGreyscales( sal_uInt16 nGreys )
{
for( long nX = 0L; nX < nWidth; nX++ )
{
- pWriteAcc->SetPixel( nY, nX,
- (sal_uInt8) ( pReadAcc->GetPaletteColor(
- pReadAcc->GetPixel( nY, nX ) ).GetLuminance() >> nShift ) );
+ const sal_uInt8 cIndex = pReadAcc->GetPixelIndex( nY, nX );
+ pWriteAcc->SetPixelIndex( nY, nX,
+ (pReadAcc->GetPaletteColor( cIndex ).GetLuminance() >> nShift) );
}
}
}
@@ -591,7 +593,7 @@ sal_Bool Bitmap::ImplMakeGreyscales( sal_uInt16 nGreys )
{
for( long nY = 0L; nY < nHeight; nY++ )
for( long nX = 0L; nX < nWidth; nX++ )
- pWriteAcc->SetPixel( nY, nX, sal::static_int_cast<sal_uInt8>(( pReadAcc->GetPixel( nY, nX ) ).GetLuminance() >> nShift) );
+ pWriteAcc->SetPixelIndex( nY, nX, (pReadAcc->GetPixel( nY, nX ) ).GetLuminance() >> nShift );
}
aNewBmp.ReleaseAccess( pWriteAcc );
@@ -666,7 +668,7 @@ sal_Bool Bitmap::ImplConvertUp( sal_uInt16 nBitCount, Color* pExtColor )
{
for( long nY = 0L; nY < nHeight; nY++ )
for( long nX = 0L; nX < nWidth; nX++ )
- pWriteAcc->SetPixel( nY, nX, pReadAcc->GetPaletteColor( pReadAcc->GetPixel( nY, nX ) ) );
+ pWriteAcc->SetPixel( nY, nX, pReadAcc->GetPaletteColor( pReadAcc->GetPixelIndex( nY, nX ) ) );
}
else
{
@@ -752,7 +754,7 @@ sal_Bool Bitmap::ImplConvertDown( sal_uInt16 nBitCount, Color* pExtColor )
for( nX = 0L, pQLine2 = !nY ? pErrQuad1 : pErrQuad2; nX < nWidth; nX++ )
{
if( pReadAcc->HasPalette() )
- pQLine2[ nX ] = pReadAcc->GetPaletteColor( pReadAcc->GetPixel( nYTmp, nX ) );
+ pQLine2[ nX ] = pReadAcc->GetPaletteColor( pReadAcc->GetPixelIndex( nYTmp, nX ) );
else
pQLine2[ nX ] = pReadAcc->GetPixel( nYTmp, nX );
}
@@ -760,9 +762,9 @@ sal_Bool Bitmap::ImplConvertDown( sal_uInt16 nBitCount, Color* pExtColor )
for( nY = 0L; nY < nHeight; nY++, nYTmp++ )
{
- // erstes ZeilenPixel
+ // first pixel in the line
cIndex = (sal_uInt8) aColorMap.GetBestPaletteIndex( pQLine1[ 0 ].ImplGetColor() );
- pWriteAcc->SetPixel( nY, 0, cIndex );
+ pWriteAcc->SetPixelIndex( nY, 0, cIndex );
for( nX = 1L; nX < nWidth1; nX++ )
{
@@ -772,14 +774,14 @@ sal_Bool Bitmap::ImplConvertDown( sal_uInt16 nBitCount, Color* pExtColor )
pQLine2[ nX-- ].ImplAddColorError1( aErrQuad );
pQLine2[ nX-- ].ImplAddColorError5( aErrQuad );
pQLine2[ nX++ ].ImplAddColorError3( aErrQuad );
- pWriteAcc->SetPixel( nY, nX, cIndex );
+ pWriteAcc->SetPixelIndex( nY, nX, cIndex );
}
// letztes ZeilenPixel
if( nX < nWidth )
{
cIndex = (sal_uInt8) aColorMap.GetBestPaletteIndex( pQLine1[ nWidth1 ].ImplGetColor() );
- pWriteAcc->SetPixel( nY, nX, cIndex );
+ pWriteAcc->SetPixelIndex( nY, nX, cIndex );
}
// Zeilenpuffer neu fuellen/kopieren
@@ -791,7 +793,7 @@ sal_Bool Bitmap::ImplConvertDown( sal_uInt16 nBitCount, Color* pExtColor )
for( nX = 0L; nX < nWidth; nX++ )
{
if( pReadAcc->HasPalette() )
- pQLine2[ nX ] = pReadAcc->GetPaletteColor( pReadAcc->GetPixel( nYTmp, nX ) );
+ pQLine2[ nX ] = pReadAcc->GetPaletteColor( pReadAcc->GetPixelIndex( nYTmp, nX ) );
else
pQLine2[ nX ] = pReadAcc->GetPixel( nYTmp, nX );
}
@@ -1058,7 +1060,7 @@ sal_Bool Bitmap::ImplScaleInterpolate( const double& rScaleX, const double& rSca
{
if( 1 == nWidth )
{
- aCol0 = pReadAcc->GetPaletteColor( pReadAcc->GetPixel( nY, 0 ) );
+ aCol0 = pReadAcc->GetPaletteColor( pReadAcc->GetPixelIndex( nY, 0 ) );
for( nX = 0L; nX < nNewWidth; nX++ )
pWriteAcc->SetPixel( nY, nX, aCol0 );
@@ -1069,8 +1071,8 @@ sal_Bool Bitmap::ImplScaleInterpolate( const double& rScaleX, const double& rSca
{
nTemp = pLutInt[ nX ];
- aCol0 = pReadAcc->GetPaletteColor( pReadAcc->GetPixel( nY, nTemp++ ) );
- aCol1 = pReadAcc->GetPaletteColor( pReadAcc->GetPixel( nY, nTemp ) );
+ aCol0 = pReadAcc->GetPaletteColor( pReadAcc->GetPixelIndex( nY, nTemp++ ) );
+ aCol1 = pReadAcc->GetPaletteColor( pReadAcc->GetPixelIndex( nY, nTemp ) );
nTemp = pLutFrac[ nX ];
@@ -1162,7 +1164,7 @@ sal_Bool Bitmap::ImplScaleInterpolate( const double& rScaleX, const double& rSca
{
if( 1 == nHeight )
{
- aCol0 = pReadAcc->GetPaletteColor( pReadAcc->GetPixel( 0, nX ) );
+ aCol0 = pReadAcc->GetPaletteColor( pReadAcc->GetPixelIndex( 0, nX ) );
for( nY = 0L; nY < nNewHeight; nY++ )
pWriteAcc->SetPixel( nY, nX, aCol0 );
@@ -1173,8 +1175,8 @@ sal_Bool Bitmap::ImplScaleInterpolate( const double& rScaleX, const double& rSca
{
nTemp = pLutInt[ nY ];
- aCol0 = pReadAcc->GetPaletteColor( pReadAcc->GetPixel( nTemp++, nX ) );
- aCol1 = pReadAcc->GetPaletteColor( pReadAcc->GetPixel( nTemp, nX ) );
+ aCol0 = pReadAcc->GetPaletteColor( pReadAcc->GetPixelIndex( nTemp++, nX ) );
+ aCol1 = pReadAcc->GetPaletteColor( pReadAcc->GetPixelIndex( nTemp, nX ) );
nTemp = pLutFrac[ nY ];
@@ -1287,7 +1289,7 @@ sal_Bool Bitmap::ImplDitherMatrix()
{
for( sal_uLong nX = 0UL, nModY = ( nY & 0x0FUL ) << 4UL; nX < nWidth; nX++ )
{
- const BitmapColor aCol( pReadAcc->GetPaletteColor( pReadAcc->GetPixel( nY, nX ) ) );
+ const BitmapColor aCol( pReadAcc->GetPaletteColor( pReadAcc->GetPixelIndex( nY, nX ) ) );
const sal_uLong nD = nVCLDitherLut[ nModY + ( nX & 0x0FUL ) ];
const sal_uLong nR = ( nVCLLut[ aCol.GetRed() ] + nD ) >> 16UL;
const sal_uLong nG = ( nVCLLut[ aCol.GetGreen() ] + nD ) >> 16UL;
@@ -1375,7 +1377,7 @@ sal_Bool Bitmap::ImplDitherFloyd()
{
for( nZ = 0; nZ < nWidth; nZ++ )
{
- aColor = pReadAcc->GetPaletteColor( pReadAcc->GetPixel( 0, nZ ) );
+ aColor = pReadAcc->GetPaletteColor( pReadAcc->GetPixelIndex( 0, nZ ) );
*pTmp++ = (long) aColor.GetBlue() << 12;
*pTmp++ = (long) aColor.GetGreen() << 12;
@@ -1406,7 +1408,7 @@ sal_Bool Bitmap::ImplDitherFloyd()
{
for( nZ = 0; nZ < nWidth; nZ++ )
{
- aColor = pReadAcc->GetPaletteColor( pReadAcc->GetPixel( nY, nZ ) );
+ aColor = pReadAcc->GetPaletteColor( pReadAcc->GetPixelIndex( nY, nZ ) );
*pTmp++ = (long) aColor.GetBlue() << 12;
*pTmp++ = (long) aColor.GetGreen() << 12;
@@ -1432,7 +1434,7 @@ sal_Bool Bitmap::ImplDitherFloyd()
CALC_TABLES7;
nX -= 5;
CALC_TABLES5;
- pWriteAcc->SetPixel( nYAcc, 0, BitmapColor( (sal_uInt8) ( nVCLBLut[ nBC ] + nVCLGLut[nGC ] + nVCLRLut[nRC ] ) ) );
+ pWriteAcc->SetPixelIndex( nYAcc, 0, static_cast<sal_uInt8>(nVCLBLut[ nBC ] + nVCLGLut[nGC ] + nVCLRLut[nRC ]) );
// mittlere Pixel ueber Schleife
long nXAcc;
@@ -1443,7 +1445,7 @@ sal_Bool Bitmap::ImplDitherFloyd()
nX -= 8;
CALC_TABLES3;
CALC_TABLES5;
- pWriteAcc->SetPixel( nYAcc, nXAcc, BitmapColor( (sal_uInt8) ( nVCLBLut[ nBC ] + nVCLGLut[nGC ] + nVCLRLut[nRC ] ) ) );
+ pWriteAcc->SetPixelIndex( nYAcc, nXAcc, static_cast<sal_uInt8>(nVCLBLut[ nBC ] + nVCLGLut[nGC ] + nVCLRLut[nRC ]) );
}
// letztes Pixel gesondert betrachten
@@ -1451,7 +1453,7 @@ sal_Bool Bitmap::ImplDitherFloyd()
nX -= 5;
CALC_TABLES3;
CALC_TABLES5;
- pWriteAcc->SetPixel( nYAcc, nWidth1, BitmapColor( (sal_uInt8) ( nVCLBLut[ nBC ] + nVCLGLut[nGC ] + nVCLRLut[nRC ] ) ) );
+ pWriteAcc->SetPixelIndex( nYAcc, nWidth1, static_cast<sal_uInt8>(nVCLBLut[ nBC ] + nVCLGLut[nGC ] + nVCLRLut[nRC ]) );
}
delete[] p1;
@@ -1626,13 +1628,13 @@ sal_Bool Bitmap::ImplReduceSimple( sal_uInt16 nColorCount )
{
for( long nY = 0L; nY < nHeight; nY++ )
for( long nX =0L; nX < nWidth; nX++ )
- pWAcc->SetPixel( nY, nX, (sal_uInt8) aOct.GetBestPaletteIndex( pRAcc->GetPaletteColor( pRAcc->GetPixel( nY, nX ) ) ) );
+ pWAcc->SetPixelIndex( nY, nX, static_cast<sal_uInt8>(aOct.GetBestPaletteIndex( pRAcc->GetPaletteColor( pRAcc->GetPixelIndex( nY, nX ) ))) );
}
else
{
for( long nY = 0L; nY < nHeight; nY++ )
for( long nX =0L; nX < nWidth; nX++ )
- pWAcc->SetPixel( nY, nX, (sal_uInt8) aOct.GetBestPaletteIndex( pRAcc->GetPixel( nY, nX ) ) );
+ pWAcc->SetPixelIndex( nY, nX, static_cast<sal_uInt8>(aOct.GetBestPaletteIndex( pRAcc->GetPixel( nY, nX ) )) );
}
aNewBmp.ReleaseAccess( pWAcc );
@@ -1729,7 +1731,7 @@ sal_Bool Bitmap::ImplReducePopular( sal_uInt16 nColCount )
{
for( nX = 0L; nX < nWidth; nX++ )
{
- const BitmapColor& rCol = pRAcc->GetPaletteColor( pRAcc->GetPixel( nY, nX ) );
+ const BitmapColor& rCol = pRAcc->GetPaletteColor( pRAcc->GetPixelIndex( nY, nX ) );
pCountTable[ ( ( ( (sal_uInt32) rCol.GetRed() ) >> nRightShiftBits ) << nLeftShiftBits2 ) |
( ( ( (sal_uInt32) rCol.GetGreen() ) >> nRightShiftBits ) << nLeftShiftBits1 ) |
( ( (sal_uInt32) rCol.GetBlue() ) >> nRightShiftBits ) ].mnCount++;
@@ -1781,7 +1783,7 @@ sal_Bool Bitmap::ImplReducePopular( sal_uInt16 nColCount )
{
for( nX = 0L; nX < nWidth; nX++ )
{
- const BitmapColor& rCol = pRAcc->GetPaletteColor( pRAcc->GetPixel( nY, nX ) );
+ const BitmapColor& rCol = pRAcc->GetPaletteColor( pRAcc->GetPixelIndex( nY, nX ) );
aDstCol.SetIndex( pIndexMap[ ( ( ( (sal_uInt32) rCol.GetRed() ) >> nRightShiftBits ) << nLeftShiftBits2 ) |
( ( ( (sal_uInt32) rCol.GetGreen() ) >> nRightShiftBits ) << nLeftShiftBits1 ) |
( ( (sal_uInt32) rCol.GetBlue() ) >> nRightShiftBits ) ] );
@@ -1867,7 +1869,7 @@ sal_Bool Bitmap::ImplReduceMedian( sal_uInt16 nColCount )
{
for( long nX = 0L; nX < nWidth; nX++ )
{
- const BitmapColor& rCol = pRAcc->GetPaletteColor( pRAcc->GetPixel( nY, nX ) );
+ const BitmapColor& rCol = pRAcc->GetPaletteColor( pRAcc->GetPixelIndex( nY, nX ) );
pColBuf[ RGB15( rCol.GetRed() >> 3, rCol.GetGreen() >> 3, rCol.GetBlue() >> 3 ) ]++;
}
}
@@ -1894,7 +1896,7 @@ sal_Bool Bitmap::ImplReduceMedian( sal_uInt16 nColCount )
pWAcc->SetPalette( aPal );
for( long nY = 0L; nY < nHeight; nY++ )
for( long nX = 0L; nX < nWidth; nX++ )
- pWAcc->SetPixel( nY, nX, (sal_uInt8) aMap.GetBestPaletteIndex( pRAcc->GetColor( nY, nX ) ) );
+ pWAcc->SetPixelIndex( nY, nX, static_cast<sal_uInt8>( aMap.GetBestPaletteIndex( pRAcc->GetColor( nY, nX ) )) );
rtl_freeMemory( pColBuf );
aNewBmp.ReleaseAccess( pWAcc );
diff --git a/vcl/source/gdi/bitmap4.cxx b/vcl/source/gdi/bitmap4.cxx
index cc922149d109..da2f23d1aa4b 100644
--- a/vcl/source/gdi/bitmap4.cxx
+++ b/vcl/source/gdi/bitmap4.cxx
@@ -856,7 +856,7 @@ sal_Bool Bitmap::ImplMosaic( const BmpFilterParam* pFilterParam, const Link* /*p
{
for( nX = nX1; nX <= nX2; nX++ )
{
- const BitmapColor& rCol = pReadAcc->GetPaletteColor( (sal_uInt8) pReadAcc->GetPixel( nY, nX ) );
+ const BitmapColor& rCol = pReadAcc->GetPaletteColor( pReadAcc->GetPixelIndex( nY, nX ) );
nSumR += rCol.GetRed();
nSumG += rCol.GetGreen();
nSumB += rCol.GetBlue();
diff --git a/vcl/source/gdi/bmpacc2.cxx b/vcl/source/gdi/bmpacc2.cxx
index dc5410bbadf9..45b5063eb25a 100644
--- a/vcl/source/gdi/bmpacc2.cxx
+++ b/vcl/source/gdi/bmpacc2.cxx
@@ -32,7 +32,7 @@
IMPL_FORMAT_GETPIXEL_NOMASK( _1BIT_MSB_PAL )
{
- return( pScanline[ nX >> 3 ] & ( 1 << ( 7 - ( nX & 7 ) ) ) ? 1 : 0 );
+ return BitmapColor( pScanline[ nX >> 3 ] & ( 1 << ( 7 - ( nX & 7 ) ) ) ? 1 : 0 );
}
// ------------------------------------------------------------------
@@ -49,7 +49,7 @@ IMPL_FORMAT_SETPIXEL_NOMASK( _1BIT_MSB_PAL )
IMPL_FORMAT_GETPIXEL_NOMASK( _1BIT_LSB_PAL )
{
- return( pScanline[ nX >> 3 ] & ( 1 << ( nX & 7 ) ) ? 1 : 0 );
+ return BitmapColor( pScanline[ nX >> 3 ] & ( 1 << ( nX & 7 ) ) ? 1 : 0 );
}
// ------------------------------------------------------------------
@@ -66,7 +66,7 @@ IMPL_FORMAT_SETPIXEL_NOMASK( _1BIT_LSB_PAL )
IMPL_FORMAT_GETPIXEL_NOMASK( _4BIT_MSN_PAL )
{
- return( ( pScanline[ nX >> 1 ] >> ( nX & 1 ? 0 : 4 ) ) & 0x0f );
+ return BitmapColor( ( pScanline[ nX >> 1 ] >> ( nX & 1 ? 0 : 4 ) ) & 0x0f );
}
// ------------------------------------------------------------------
@@ -83,7 +83,7 @@ IMPL_FORMAT_SETPIXEL_NOMASK( _4BIT_MSN_PAL )
IMPL_FORMAT_GETPIXEL_NOMASK( _4BIT_LSN_PAL )
{
- return( ( pScanline[ nX >> 1 ] >> ( nX & 1 ? 4 : 0 ) ) & 0x0f );
+ return BitmapColor( ( pScanline[ nX >> 1 ] >> ( nX & 1 ? 4 : 0 ) ) & 0x0f );
}
// ------------------------------------------------------------------
@@ -100,7 +100,7 @@ IMPL_FORMAT_SETPIXEL_NOMASK( _4BIT_LSN_PAL )
IMPL_FORMAT_GETPIXEL_NOMASK( _8BIT_PAL )
{
- return pScanline[ nX ];
+ return BitmapColor( pScanline[ nX ] );
}
// ------------------------------------------------------------------
diff --git a/vcl/source/gdi/octree.cxx b/vcl/source/gdi/octree.cxx
index 6ce2f7fc0ca3..ef164a2d3503 100644
--- a/vcl/source/gdi/octree.cxx
+++ b/vcl/source/gdi/octree.cxx
@@ -130,7 +130,7 @@ void Octree::ImplCreateOctree()
{
for( long nX = 0; nX < nWidth; nX++ )
{
- pColor = &(BitmapColor&) pAcc->GetPaletteColor( pAcc->GetPixel( nY, nX ) );
+ pColor = &(BitmapColor&) pAcc->GetPaletteColor( pAcc->GetPixelIndex( nY, nX ) );
nLevel = 0L;
ImplAdd( &pTree );
diff --git a/vcl/source/gdi/outdev2.cxx b/vcl/source/gdi/outdev2.cxx
index d1b25b871f8e..9a90ae414fe6 100644
--- a/vcl/source/gdi/outdev2.cxx
+++ b/vcl/source/gdi/outdev2.cxx
@@ -1666,8 +1666,8 @@ Bitmap OutputDevice::ImplBlendWithAlpha( Bitmap aBmp,
aSrcCol = pP->GetColor( nMapY, nMapX );
aDstCol = pB->GetColor( nY, nX );
- const sal_uInt8 nSrcOpaq = 255 - pA->GetPixel( nMapY, nMapX ).GetBlueOrIndex();
- const sal_uInt8 nDstOpaq = 255 - pAlphaW->GetPixel( nY, nX ).GetBlueOrIndex();
+ const sal_uInt8 nSrcOpaq = 255 - pA->GetPixelIndex( nMapY, nMapX );
+ const sal_uInt8 nDstOpaq = 255 - pAlphaW->GetPixelIndex( nY, nX );
aDstCol.SetRed( lcl_calcColor( aSrcCol.GetRed(), nSrcOpaq, aDstCol.GetRed() ) );
aDstCol.SetBlue( lcl_calcColor( aSrcCol.GetBlue(), nSrcOpaq, aDstCol.GetBlue() ) );
@@ -1711,8 +1711,8 @@ Bitmap OutputDevice::ImplBlendWithAlpha( Bitmap aBmp,
aSrcCol = pP->GetColor( nMapY, nMapX );
aDstCol = pB->GetColor( nY, nX );
- const sal_uInt8 nSrcOpaq = 255 - pA->GetPixel( nMapY, nMapX ).GetBlueOrIndex();
- const sal_uInt8 nDstOpaq = 255 - pAlphaW->GetPixel( nY, nX ).GetBlueOrIndex();
+ const sal_uInt8 nSrcOpaq = 255 - pA->GetPixelIndex( nMapY, nMapX );
+ const sal_uInt8 nDstOpaq = 255 - pAlphaW->GetPixelIndex( nY, nX );
aDstCol.SetRed( lcl_calcColor( aSrcCol.GetRed(), nSrcOpaq, aDstCol.GetRed() ) );
aDstCol.SetBlue( lcl_calcColor( aSrcCol.GetBlue(), nSrcOpaq, aDstCol.GetBlue() ) );
@@ -1782,7 +1782,7 @@ Bitmap OutputDevice::ImplBlend( Bitmap aBmp,
const sal_uLong nD = nVCLDitherLut[ nModY | ( nOutX & 0x0FL ) ];
aDstCol = pB->GetColor( nY, nX );
- aDstCol.Merge( pP->GetColor( nMapY, nMapX ), (sal_uInt8) pA->GetPixel( nMapY, nMapX ) );
+ aDstCol.Merge( pP->GetColor( nMapY, nMapX ), pA->GetPixelIndex( nMapY, nMapX ) );
aIndex.SetIndex( (sal_uInt8) ( nVCLRLut[ ( nVCLLut[ aDstCol.GetRed() ] + nD ) >> 16UL ] +
nVCLGLut[ ( nVCLLut[ aDstCol.GetGreen() ] + nD ) >> 16UL ] +
nVCLBLut[ ( nVCLLut[ aDstCol.GetBlue() ] + nD ) >> 16UL ] ) );
diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx
index 89e96799919f..3e798b5ea601 100644
--- a/vcl/source/gdi/pngread.cxx
+++ b/vcl/source/gdi/pngread.cxx
@@ -1485,7 +1485,7 @@ void PNGReaderImpl::ImplSetPixel( sal_uInt32 nY, sal_uInt32 nX, sal_uInt8 nPalIn
return;
nX >>= mnPreviewShift;
- mpAcc->SetPixel( nY, nX, nPalIndex );
+ mpAcc->SetPixelIndex( nY, nX, nPalIndex );
}
// ------------------------------------------------------------------------
@@ -1515,8 +1515,8 @@ void PNGReaderImpl::ImplSetAlphaPixel( sal_uInt32 nY, sal_uInt32 nX,
return;
nX >>= mnPreviewShift;
- mpAcc->SetPixel( nY, nX, nPalIndex );
- mpMaskAcc->SetPixel( nY, nX, ~nAlpha );
+ mpAcc->SetPixelIndex( nY, nX, nPalIndex );
+ mpMaskAcc->SetPixelIndex( nY, nX, ~nAlpha );
}
// ------------------------------------------------------------------------
@@ -1530,7 +1530,7 @@ void PNGReaderImpl::ImplSetAlphaPixel( sal_uInt32 nY, sal_uInt32 nX,
nX >>= mnPreviewShift;
mpAcc->SetPixel( nY, nX, rBitmapColor );
- mpMaskAcc->SetPixel( nY, nX, ~nAlpha );
+ mpMaskAcc->SetPixelIndex( nY, nX, ~nAlpha );
}
// ------------------------------------------------------------------------
diff --git a/vcl/source/gdi/pngwrite.cxx b/vcl/source/gdi/pngwrite.cxx
index fe10e4d4be01..459fcc2a2863 100644
--- a/vcl/source/gdi/pngwrite.cxx
+++ b/vcl/source/gdi/pngwrite.cxx
@@ -366,7 +366,7 @@ void PNGWriterImpl::ImplWritePalette()
void PNGWriterImpl::ImplWriteTransparent ()
{
- const sal_uLong nTransIndex = mpAccess->GetBestMatchingColor( BMP_COL_TRANS );
+ const sal_uLong nTransIndex = mpAccess->GetBestPaletteIndex( BMP_COL_TRANS );
ImplOpenChunk( PNGCHUNK_tRNS );
@@ -517,11 +517,11 @@ sal_uLong PNGWriterImpl::ImplGetFilter ( sal_uLong nY, sal_uLong nXStart, sal_uL
{
sal_uLong nShift = ( nXIndex & 7 ) ^ 7;
if ( nShift == 7)
- *pDest = (sal_uInt8)(mpAccess->GetPixel( nY, nX ) << nShift);
+ *pDest = mpAccess->GetPixelIndex( nY, nX ) << nShift;
else if ( nShift == 0 )
- *pDest++ |= (sal_uInt8) mpAccess->GetPixel( nY, nX ) << nShift;
+ *pDest++ |= mpAccess->GetPixelIndex( nY, nX ) << nShift;
else
- *pDest |= (sal_uInt8) mpAccess->GetPixel( nY, nX ) << nShift;
+ *pDest |= mpAccess->GetPixelIndex( nY, nX ) << nShift;
}
if ( ( nXIndex & 7 ) != 0 ) pDest++; // byte is not completely used, so the
} // bufferpointer is to correct
@@ -533,9 +533,9 @@ sal_uLong PNGWriterImpl::ImplGetFilter ( sal_uLong nY, sal_uLong nXStart, sal_uL
for ( nX = nXStart, nXIndex = 0; nX < mnWidth; nX+= nXAdd, nXIndex++ )
{
if( nXIndex & 1 )
- *pDest++ |= (sal_uInt8) mpAccess->GetPixel( nY, nX );
+ *pDest++ |= mpAccess->GetPixelIndex( nY, nX );
else
- *pDest = (sal_uInt8) mpAccess->GetPixel( nY, nX ) << 4;
+ *pDest = mpAccess->GetPixelIndex( nY, nX ) << 4;
}
if ( nXIndex & 1 ) pDest++;
}
@@ -544,7 +544,7 @@ sal_uLong PNGWriterImpl::ImplGetFilter ( sal_uLong nY, sal_uLong nXStart, sal_uL
case( 8 ):
{
for ( sal_uLong nX = nXStart; nX < mnWidth; nX+=nXAdd )
- *pDest++ = mpAccess->GetPixel( nY, nX );
+ *pDest++ = mpAccess->GetPixelIndex( nY, nX );
}
break;
@@ -565,7 +565,7 @@ sal_uLong PNGWriterImpl::ImplGetFilter ( sal_uLong nY, sal_uLong nXStart, sal_uL
*pDest++ = rColor.GetRed();
*pDest++ = rColor.GetGreen();
*pDest++ = rColor.GetBlue();
- *pDest++ = 255 - mpMaskAccess->GetPixel( nY, nX );
+ *pDest++ = 255 - mpMaskAccess->GetPixelIndex( nY, nX );
}
}
else
diff --git a/vcl/source/helper/canvasbitmap.cxx b/vcl/source/helper/canvasbitmap.cxx
index bffba6cfaef0..8ae3ccb987db 100644
--- a/vcl/source/helper/canvasbitmap.cxx
+++ b/vcl/source/helper/canvasbitmap.cxx
@@ -541,8 +541,8 @@ uno::Sequence< sal_Int8 > SAL_CALL VclCanvasBitmap::getData( rendering::IntegerB
// input less than a byte - copy via GetPixel()
for( long x=aRequestedArea.Left(); x<aRequestedArea.Right(); ++x )
{
- *pOutScan++ = m_pBmpAcc->GetPixel(y,x);
- *pOutScan++ = m_pAlphaAcc->GetPixel(y,x);
+ *pOutScan++ = m_pBmpAcc->GetPixelIndex(y,x);
+ *pOutScan++ = m_pAlphaAcc->GetPixelIndex(y,x);
}
}
else
@@ -556,7 +556,7 @@ uno::Sequence< sal_Int8 > SAL_CALL VclCanvasBitmap::getData( rendering::IntegerB
{
for( long i=0; i<nNonAlphaBytes; ++i )
*pOutScan++ = *pScan++;
- *pOutScan++ = m_pAlphaAcc->GetPixel(y,x);
+ *pOutScan++ = m_pAlphaAcc->GetPixelIndex( y, x );
}
}
@@ -618,8 +618,8 @@ uno::Sequence< sal_Int8 > SAL_CALL VclCanvasBitmap::getPixel( rendering::Integer
if( m_nBitsPerInputPixel < 8 )
{
// input less than a byte - copy via GetPixel()
- *pOutBuf++ = m_pBmpAcc->GetPixel(pos.Y,pos.X);
- *pOutBuf = m_pAlphaAcc->GetPixel(pos.Y,pos.X);
+ *pOutBuf++ = m_pBmpAcc->GetPixelIndex(pos.Y,pos.X);
+ *pOutBuf = m_pAlphaAcc->GetPixelIndex(pos.Y,pos.X);
}
else
{
@@ -629,7 +629,7 @@ uno::Sequence< sal_Int8 > SAL_CALL VclCanvasBitmap::getPixel( rendering::Integer
// input integer multiple of byte - copy directly
rtl_copyMemory(pOutBuf, pScan+nScanlineLeftOffset, nNonAlphaBytes );
pOutBuf += nNonAlphaBytes;
- *pOutBuf++ = m_pAlphaAcc->GetPixel(pos.Y,pos.X);
+ *pOutBuf++ = m_pAlphaAcc->GetPixelIndex(pos.Y,pos.X);
}
}
@@ -1176,10 +1176,7 @@ uno::Sequence<rendering::RGBColor> SAL_CALL VclCanvasBitmap::convertIntegerToRGB
{
const BitmapColor aCol =
m_bPalette ?
- m_pBmpAcc->GetPaletteColor(
- sal::static_int_cast<sal_uInt16>(
- m_pBmpAcc->GetPixelFromData(
- pIn, i ))) :
+ m_pBmpAcc->GetPaletteColor( m_pBmpAcc->GetPixelFromData( pIn, i ).GetIndex()) :
m_pBmpAcc->GetPixelFromData(pIn, i);
// TODO(F3): Convert result to sRGB color space
@@ -1233,10 +1230,7 @@ uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertIntegerToAR
{
const BitmapColor aCol =
m_bPalette ?
- m_pBmpAcc->GetPaletteColor(
- sal::static_int_cast<sal_uInt16>(
- m_pBmpAcc->GetPixelFromData(
- pIn, i ))) :
+ m_pBmpAcc->GetPaletteColor( m_pBmpAcc->GetPixelFromData( pIn, i ).GetIndex() ) :
m_pBmpAcc->GetPixelFromData(pIn, i);
// TODO(F3): Convert result to sRGB color space
@@ -1292,10 +1286,7 @@ uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertIntegerToPA
{
const BitmapColor aCol =
m_bPalette ?
- m_pBmpAcc->GetPaletteColor(
- sal::static_int_cast<sal_uInt16>(
- m_pBmpAcc->GetPixelFromData(
- pIn, i ))) :
+ m_pBmpAcc->GetPaletteColor( m_pBmpAcc->GetPixelFromData( pIn, i ).GetIndex() ) :
m_pBmpAcc->GetPixelFromData(pIn, i);
// TODO(F3): Convert result to sRGB color space
diff --git a/vcl/source/helper/canvastools.cxx b/vcl/source/helper/canvastools.cxx
index 89e23415c6a0..ac425717785a 100644
--- a/vcl/source/helper/canvastools.cxx
+++ b/vcl/source/helper/canvastools.cxx
@@ -249,8 +249,8 @@ namespace vcl
for( sal_Int32 x=0; x<nWidth; ++x )
{
const rendering::ARGBColor& rColor=aARGBColors[x];
- rWriteAcc->SetPixel( aRect.Y1, x,
- (sal_uInt8)rWriteAcc->GetBestPaletteIndex(
+ rWriteAcc->SetPixelIndex( aRect.Y1, x,
+ (sal_uInt8) rWriteAcc->GetBestPaletteIndex(
BitmapColor( toByteColor(rColor.Red),
toByteColor(rColor.Green),
toByteColor(rColor.Blue))) );
@@ -281,8 +281,8 @@ namespace vcl
for( sal_Int32 x=0; x<nWidth; ++x )
{
const rendering::RGBColor& rColor=aRGBColors[x];
- rWriteAcc->SetPixel( aRect.Y1, x,
- (sal_uInt8)rWriteAcc->GetBestPaletteIndex(
+ rWriteAcc->SetPixelIndex( aRect.Y1, x,
+ (sal_uInt8) rWriteAcc->GetBestPaletteIndex(
BitmapColor( toByteColor(rColor.Red),
toByteColor(rColor.Green),
toByteColor(rColor.Blue))) );