diff options
author | Herbert Dürr <hdu@apache.org> | 2012-10-19 15:12:40 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-05-09 11:18:22 +0100 |
commit | 78eca44c4db67848a85b600cc40e25d41bb647df (patch) | |
tree | 70b9352af07b4ac4678d44aaa88031eb5c225be7 /filter | |
parent | aa0bc15b42e8d432def185089ea8fca17f3fd8c8 (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.
(cherry picked from commit 2d9d5c8d6beb7fb0a7dafa0c1c4d10a25d7200fd)
Conflicts:
filter/source/graphicfilter/egif/egif.cxx
filter/source/graphicfilter/epbm/epbm.cxx
filter/source/graphicfilter/epgm/epgm.cxx
filter/source/graphicfilter/ipbm/ipbm.cxx
filter/source/graphicfilter/ipsd/ipsd.cxx
sd/source/ui/slidesorter/view/SlsButtonBar.cxx
svtools/source/filter/igif/gifread.cxx
svtools/source/filter/jpeg/jpeg.cxx
svtools/source/filter/wmf/winwmf.cxx
svtools/source/graphic/grfmgr2.cxx
vcl/inc/vcl/bmpacc.hxx
vcl/inc/vcl/salbtype.hxx
vcl/source/gdi/bitmap.cxx
vcl/source/gdi/bitmap3.cxx
vcl/source/gdi/outdev2.cxx
Change-Id: I1d163c66782c2750aeee00725dbb2b614507c0d4
(cherry picked from commit ff80c37b18b941712fb967a0c1d48813b47c0583)
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/graphicfilter/egif/egif.cxx | 2 | ||||
-rw-r--r-- | filter/source/graphicfilter/epbm/epbm.cxx | 4 | ||||
-rw-r--r-- | filter/source/graphicfilter/epgm/epgm.cxx | 4 | ||||
-rw-r--r-- | filter/source/graphicfilter/epict/epict.cxx | 6 | ||||
-rw-r--r-- | filter/source/graphicfilter/eps/eps.cxx | 10 | ||||
-rw-r--r-- | filter/source/graphicfilter/eras/eras.cxx | 4 | ||||
-rw-r--r-- | filter/source/graphicfilter/etiff/etiff.cxx | 8 | ||||
-rw-r--r-- | filter/source/graphicfilter/expm/expm.cxx | 4 | ||||
-rw-r--r-- | filter/source/graphicfilter/icgm/bitmap.cxx | 10 | ||||
-rw-r--r-- | filter/source/graphicfilter/ieps/ieps.cxx | 4 | ||||
-rw-r--r-- | filter/source/graphicfilter/ipbm/ipbm.cxx | 8 | ||||
-rw-r--r-- | filter/source/graphicfilter/ipcx/ipcx.cxx | 19 | ||||
-rw-r--r-- | filter/source/graphicfilter/ipict/ipict.cxx | 30 | ||||
-rw-r--r-- | filter/source/graphicfilter/ipsd/ipsd.cxx | 12 | ||||
-rw-r--r-- | filter/source/graphicfilter/iras/iras.cxx | 5 | ||||
-rw-r--r-- | filter/source/graphicfilter/itga/itga.cxx | 6 | ||||
-rw-r--r-- | filter/source/graphicfilter/itiff/itiff.cxx | 52 | ||||
-rw-r--r-- | filter/source/msfilter/svdfppt.cxx | 2 |
18 files changed, 93 insertions, 97 deletions
diff --git a/filter/source/graphicfilter/egif/egif.cxx b/filter/source/graphicfilter/egif/egif.cxx index 0f701f9f6ab2..708e7b57505e 100644 --- a/filter/source/graphicfilter/egif/egif.cxx +++ b/filter/source/graphicfilter/egif/egif.cxx @@ -520,7 +520,7 @@ void GIFWriter::WriteAccess() else { for( long nX = 0L; nX < nWidth; nX++ ) - pBuffer[ nX ] = (sal_uInt8) m_pAcc->GetPixel( nY, nX ); + pBuffer[ nX ] = m_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 4080d70f0dba..a32fd8ab94c4 100644 --- a/filter/source/graphicfilter/epbm/epbm.cxx +++ b/filter/source/graphicfilter/epbm/epbm.cxx @@ -145,7 +145,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 ) m_rOStm << nBYTE; @@ -167,7 +167,7 @@ void PBMWriter::ImplWriteBody() nxCount = 69; m_rOStm << (sal_uInt8)10; } - m_rOStm << (sal_uInt8)( ( mpAcc->GetPixel( y, x ) ^ 1 ) + '0' ) ; + m_rOStm << (sal_uInt8)( ( mpAcc->GetPixelIndex( y, x ) ^ 1 ) + '0' ) ; } m_rOStm << (sal_uInt8)10; } diff --git a/filter/source/graphicfilter/epgm/epgm.cxx b/filter/source/graphicfilter/epgm/epgm.cxx index 47c0860715d2..ee91eb827da6 100644 --- a/filter/source/graphicfilter/epgm/epgm.cxx +++ b/filter/source/graphicfilter/epgm/epgm.cxx @@ -147,7 +147,7 @@ void PGMWriter::ImplWriteBody() { for ( sal_uLong x = 0; x < mnWidth; x++ ) { - m_rOStm << (sal_uInt8)( mpAcc->GetPixel( y, x ) ); + m_rOStm << mpAcc->GetPixelIndex( y, x ); } } } @@ -164,7 +164,7 @@ void PGMWriter::ImplWriteBody() nCount = 69; m_rOStm << (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 35123846bae6..8af1c52abc5f 100644 --- a/filter/source/graphicfilter/epict/epict.cxx +++ b/filter/source/graphicfilter/epict/epict.cxx @@ -1164,17 +1164,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 b48fba706ada..3d721d9202aa 100644 --- a/filter/source/graphicfilter/eps/eps.cxx +++ b/filter/source/graphicfilter/eps/eps.cxx @@ -1792,7 +1792,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; @@ -1830,7 +1830,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(); @@ -1841,7 +1841,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 ) ); } } } @@ -1893,7 +1893,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(); @@ -1904,7 +1904,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 77d6009e2f60..d0f3eff712ce 100644 --- a/filter/source/graphicfilter/eras/eras.cxx +++ b/filter/source/graphicfilter/eras/eras.cxx @@ -203,7 +203,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 ??? } @@ -217,7 +217,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 6475c90ecdb2..b7ae837ae185 100644 --- a/filter/source/graphicfilter/etiff/etiff.cxx +++ b/filter/source/graphicfilter/etiff/etiff.cxx @@ -386,7 +386,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 ) ); } } } @@ -400,9 +400,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 ); @@ -419,7 +419,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 7af3eca251eb..451ad2e63ee5 100644 --- a/filter/source/graphicfilter/expm/expm.cxx +++ b/filter/source/graphicfilter/expm/expm.cxx @@ -170,7 +170,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++ ) { m_rOStm << "\x22"; @@ -196,7 +196,7 @@ void XPMWriter::ImplWriteBody() m_rOStm << (sal_uInt8)0x22; for ( sal_uLong x = 0; x < mnWidth; x++ ) { - ImplWritePixel( (sal_uInt8)(mpAcc->GetPixel( y, x ) ) ); + ImplWritePixel( mpAcc->GetPixelIndex( y, x ) ); } m_rOStm << "\x22,\x0a"; } diff --git a/filter/source/graphicfilter/icgm/bitmap.cxx b/filter/source/graphicfilter/icgm/bitmap.cxx index eb636eb5981a..995bbe223e30 100644 --- a/filter/source/graphicfilter/icgm/bitmap.cxx +++ b/filter/source/graphicfilter/icgm/bitmap.cxx @@ -75,7 +75,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 ); } } } @@ -89,7 +89,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 ); } } } @@ -106,11 +106,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; @@ -128,7 +128,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 e45b1dd57beb..31ad87042009 100644 --- a/filter/source/graphicfilter/ieps/ieps.cxx +++ b/filter/source/graphicfilter/ieps/ieps.cxx @@ -619,10 +619,10 @@ GraphicImport(SvStream & rStream, Graphic & rGraphic, FilterConfigItem*, sal_Boo } } 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 f9b7f932f4ed..5ca1c7b3b2a9 100644 --- a/filter/source/graphicfilter/ipbm/ipbm.cxx +++ b/filter/source/graphicfilter/ipbm/ipbm.cxx @@ -271,7 +271,7 @@ sal_Bool PBMReader::ImplReadBody() mrPBM >> nDat; nShift = 7; } - mpAcc->SetPixel( nHeight, nWidth, nDat >> nShift ); + mpAcc->SetPixelIndex( nHeight, nWidth, nDat >> nShift ); if ( ++nWidth == mnWidth ) { nShift = 0; @@ -290,7 +290,7 @@ sal_Bool PBMReader::ImplReadBody() return sal_False; mrPBM >> nDat; - mpAcc->SetPixel( nHeight, nWidth++, nDat); + mpAcc->SetPixelIndex( nHeight, nWidth++, nDat); if ( nWidth == mnWidth ) { @@ -351,7 +351,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 ) { @@ -380,7 +380,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 a73c64b6b071..c45f98c42b7d 100644 --- a/filter/source/graphicfilter/ipcx/ipcx.cxx +++ b/filter/source/graphicfilter/ipcx/ipcx.cxx @@ -291,12 +291,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 @@ -318,14 +315,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 @@ -336,14 +333,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; @@ -356,14 +353,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 583250967d34..49d9f92f771a 100644 --- a/filter/source/graphicfilter/ipict/ipict.cxx +++ b/filter/source/graphicfilter/ipict/ipict.cxx @@ -255,38 +255,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 50c2f8e5bbe1..b693c1365c68 100644 --- a/filter/source/graphicfilter/ipsd/ipsd.cxx +++ b/filter/source/graphicfilter/ipsd/ipsd.cxx @@ -364,7 +364,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; @@ -385,7 +385,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; @@ -414,7 +414,7 @@ sal_Bool PSDReader::ImplReadBody() m_rPSD >> 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; @@ -431,7 +431,7 @@ sal_Bool PSDReader::ImplReadBody() m_rPSD >> nDat; if ( mpFileHeader->nDepth == 16 ) // 16 bit depth is to be skipped m_rPSD >> nDummy; - mpWriteAcc->SetPixel( nY, nX, (sal_uInt8)nDat ); + mpWriteAcc->SetPixelIndex( nY, nX, nDat ); if ( ++nX == mpFileHeader->nColumns ) { nX = 0; @@ -682,7 +682,7 @@ sal_Bool PSDReader::ImplReadBody() m_rPSD >> 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; @@ -703,7 +703,7 @@ sal_Bool PSDReader::ImplReadBody() nDat = 1; if ( mpFileHeader->nDepth == 16 ) // 16 bit depth is to be skipped m_rPSD >> 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 c5f94626a03b..36241e52bd46 100644 --- a/filter/source/graphicfilter/iras/iras.cxx +++ b/filter/source/graphicfilter/iras/iras.cxx @@ -224,8 +224,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 )) ); } @@ -239,7 +238,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 b17c70a68fa6..e3967e9392e7 100644 --- a/filter/source/graphicfilter/itga/itga.cxx +++ b/filter/source/graphicfilter/itga/itga.cxx @@ -397,7 +397,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 ) @@ -422,7 +422,7 @@ sal_Bool TGAReader::ImplReadBody() return sal_False; 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 ) @@ -658,7 +658,7 @@ sal_Bool TGAReader::ImplReadBody() return sal_False; 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 0698a146183f..e2ebadb12f65 100644 --- a/filter/source/graphicfilter/itiff/itiff.cxx +++ b/filter/source/graphicfilter/itiff/itiff.cxx @@ -755,7 +755,7 @@ sal_Bool TIFFReader::ConvertScanline( sal_uLong nY ) if (nSamplesPerPixel >= 4 && pMaskAcc) { nLAlpha = nLAlpha + pt[ 3 ]; - pMaskAcc->SetPixel( nY, nx, ~nLAlpha ); + pMaskAcc->SetPixel( nY, nx, BitmapColor(~nLAlpha) ); } } } @@ -767,7 +767,7 @@ sal_Bool TIFFReader::ConvertScanline( sal_uLong nY ) if (nSamplesPerPixel >= 4 && pMaskAcc) { sal_uInt8 nAlpha = pt[3]; - pMaskAcc->SetPixel( nY, nx, ~nAlpha ); + pMaskAcc->SetPixel( nY, nx, BitmapColor(~nAlpha) ); } } } @@ -885,7 +885,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++; } } @@ -894,7 +894,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 ) ); } } } @@ -905,7 +905,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++; } } @@ -913,7 +913,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 ) ); } } @@ -931,7 +931,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; @@ -945,28 +945,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; } } @@ -978,21 +978,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 ) @@ -1002,7 +1002,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); } } } @@ -1025,7 +1025,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 ae2f36f3354e..1914c5538a70 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -5602,7 +5602,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(); } } |