summaryrefslogtreecommitdiff
path: root/svx
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 /svx
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 'svx')
-rw-r--r--svx/source/gallery2/galobj.cxx2
-rw-r--r--svx/source/svdraw/svdetc.cxx4
-rw-r--r--svx/source/xoutdev/_xoutbmp.cxx26
-rw-r--r--svx/source/xoutdev/xattrbmp.cxx4
4 files changed, 17 insertions, 19 deletions
diff --git a/svx/source/gallery2/galobj.cxx b/svx/source/gallery2/galobj.cxx
index 763790a15e48..290eaec38055 100644
--- a/svx/source/gallery2/galobj.cxx
+++ b/svx/source/gallery2/galobj.cxx
@@ -102,7 +102,7 @@ sal_Bool SgaObject::CreateThumb( const Graphic& rGraphic )
std::max( (long) (fFactor < 1. ? S_THUMB : S_THUMB / fFactor), 8L ) );
if( aThumbBmp.Scale( (double) aNewSize.Width() / aBmpSize.Width(),
- (double) aNewSize.Height() / aBmpSize.Height(), BMP_SCALE_BEST ) )
+ (double) aNewSize.Height() / aBmpSize.Height(), BMP_SCALE_BESTQUALITY ) )
{
aThumbBmp.Convert( BMP_CONVERSION_8BIT_COLORS );
bRet = sal_True;
diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx
index 58b63499409f..f133ca8fb14d 100644
--- a/svx/source/svdraw/svdetc.cxx
+++ b/svx/source/svdraw/svdetc.cxx
@@ -341,9 +341,7 @@ bool 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 f0885267a8e7..62a613774829 100644
--- a/svx/source/xoutdev/_xoutbmp.cxx
+++ b/svx/source/xoutdev/_xoutbmp.cxx
@@ -332,13 +332,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 ) );
@@ -351,24 +351,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, nWhitePalIdx );
else
- pWriteAcc->SetPixel( nY1, nXDst, aBlack );
+ pWriteAcc->SetPixelIndex( nY1, nXDst, nBlackPalIdx );
}
}
diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx
index 8a6be6b8737a..d2a556676611 100644
--- a/svx/source/xoutdev/xattrbmp.cxx
+++ b/svx/source/xoutdev/xattrbmp.cxx
@@ -297,11 +297,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);
}
}
}