summaryrefslogtreecommitdiff
path: root/vcl/source/helper
diff options
context:
space:
mode:
authorHerbert Dürr <hdu@apache.org>2012-10-19 15:12:40 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-05-09 11:18:22 +0100
commit78eca44c4db67848a85b600cc40e25d41bb647df (patch)
tree70b9352af07b4ac4678d44aaa88031eb5c225be7 /vcl/source/helper
parentaa0bc15b42e8d432def185089ea8fca17f3fd8c8 (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 'vcl/source/helper')
-rw-r--r--vcl/source/helper/canvasbitmap.cxx27
-rw-r--r--vcl/source/helper/canvastools.cxx8
2 files changed, 13 insertions, 22 deletions
diff --git a/vcl/source/helper/canvasbitmap.cxx b/vcl/source/helper/canvasbitmap.cxx
index 6951b95b857d..c80554c1ebae 100644
--- a/vcl/source/helper/canvasbitmap.cxx
+++ b/vcl/source/helper/canvasbitmap.cxx
@@ -534,8 +534,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
@@ -549,7 +549,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 );
}
}
@@ -611,8 +611,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
{
@@ -622,7 +622,7 @@ uno::Sequence< sal_Int8 > SAL_CALL VclCanvasBitmap::getPixel( rendering::Integer
// input integer multiple of byte - copy directly
memcpy(pOutBuf, pScan+nScanlineLeftOffset, nNonAlphaBytes );
pOutBuf += nNonAlphaBytes;
- *pOutBuf++ = m_pAlphaAcc->GetPixel(pos.Y,pos.X);
+ *pOutBuf++ = m_pAlphaAcc->GetPixelIndex(pos.Y,pos.X);
}
}
@@ -1169,10 +1169,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
@@ -1226,10 +1223,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
@@ -1285,10 +1279,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 4218cb1a692e..ae48e4b41a54 100644
--- a/vcl/source/helper/canvastools.cxx
+++ b/vcl/source/helper/canvastools.cxx
@@ -153,8 +153,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))) );
@@ -185,8 +185,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))) );