summaryrefslogtreecommitdiff
path: root/vcl/source/gdi
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-03-26 15:32:26 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-03-26 15:33:40 +0100
commit513fc2916053db5ee7ffaf9f53c271a05cef8981 (patch)
tree7f24849841f33f3e1b2737762548c8525bca780e /vcl/source/gdi
parent41982607d0c9b69efd5789762bbdae6c7301ee8b (diff)
const_cast: convert some C-style casts and remove some redundant ones
Change-Id: I17c57a85bcda98ef36ddefd6562d4681d0c7d5fc
Diffstat (limited to 'vcl/source/gdi')
-rw-r--r--vcl/source/gdi/animate.cxx6
-rw-r--r--vcl/source/gdi/bitmap.cxx22
-rw-r--r--vcl/source/gdi/bitmapex.cxx2
-rw-r--r--vcl/source/gdi/font.cxx2
-rw-r--r--vcl/source/gdi/gfxlink.cxx2
-rw-r--r--vcl/source/gdi/impgraph.cxx6
-rw-r--r--vcl/source/gdi/jobset.cxx2
-rw-r--r--vcl/source/gdi/pngread.cxx2
-rw-r--r--vcl/source/gdi/region.cxx8
-rw-r--r--vcl/source/gdi/salgdilayout.cxx8
-rw-r--r--vcl/source/gdi/sallayout.cxx2
11 files changed, 31 insertions, 31 deletions
diff --git a/vcl/source/gdi/animate.cxx b/vcl/source/gdi/animate.cxx
index 66cfe546d0b3..9efb7fe33c9d 100644
--- a/vcl/source/gdi/animate.cxx
+++ b/vcl/source/gdi/animate.cxx
@@ -338,9 +338,9 @@ void Animation::Draw( OutputDevice* pOut, const Point& rDestPt, const Size& rDes
else
{
const size_t nOldPos = mnPos;
- ( (Animation*) this )->mnPos = mbLoopTerminated ? ( nCount - 1UL ) : mnPos;
- delete new ImplAnimView( (Animation*) this, pOut, rDestPt, rDestSz, 0 );
- ( (Animation*) this )->mnPos = nOldPos;
+ const_cast<Animation*>(this)->mnPos = mbLoopTerminated ? ( nCount - 1UL ) : mnPos;
+ delete new ImplAnimView( const_cast<Animation*>(this), pOut, rDestPt, rDestSz, 0 );
+ const_cast<Animation*>(this)->mnPos = nOldPos;
}
}
}
diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx
index 5a8bad6f341f..2315ab1dbdc7 100644
--- a/vcl/source/gdi/bitmap.cxx
+++ b/vcl/source/gdi/bitmap.cxx
@@ -118,7 +118,7 @@ Bitmap::Bitmap( const Size& rSizePixel, sal_uInt16 nBitCount, const BitmapPalett
}
}
else
- pRealPal = (BitmapPalette*) pPal;
+ pRealPal = const_cast<BitmapPalette*>(pPal);
}
mpImpBmp = new ImpBitmap;
@@ -275,12 +275,12 @@ bool Bitmap::HasGreyPalette() const
const sal_uInt16 nBitCount = GetBitCount();
bool bRet = nBitCount == 1;
- BitmapInfoAccess* pIAcc = ( (Bitmap*) this )->AcquireInfoAccess();
+ BitmapInfoAccess* pIAcc = const_cast<Bitmap*>(this)->AcquireInfoAccess();
if( pIAcc )
{
bRet = pIAcc->HasPalette() && pIAcc->GetPalette().IsGreyPalette();
- ( (Bitmap*) this )->ReleaseAccess( pIAcc );
+ const_cast<Bitmap*>(this)->ReleaseAccess( pIAcc );
}
return bRet;
@@ -296,7 +296,7 @@ sal_uLong Bitmap::GetChecksum() const
if( !nRet )
{
- BitmapReadAccess* pRAcc = ( (Bitmap*) this )->AcquireReadAccess();
+ BitmapReadAccess* pRAcc = const_cast<Bitmap*>(this)->AcquireReadAccess();
if( pRAcc && pRAcc->Width() && pRAcc->Height() )
{
@@ -334,7 +334,7 @@ sal_uLong Bitmap::GetChecksum() const
mpImpBmp->ImplSetChecksum( nRet = nCrc );
}
- if (pRAcc) ( (Bitmap*) this )->ReleaseAccess( pRAcc );
+ if (pRAcc) const_cast<Bitmap*>(this)->ReleaseAccess( pRAcc );
}
}
@@ -846,7 +846,7 @@ bool Bitmap::CopyPixel( const Rectangle& rRectDst,
{
if( pBmpSrc && ( *pBmpSrc != *this ) )
{
- Bitmap* pSrc = (Bitmap*) pBmpSrc;
+ Bitmap* pSrc = const_cast<Bitmap*>(pBmpSrc);
const Size aCopySizePix( pSrc->GetSizePixel() );
Rectangle aRectSrc( rRectSrc );
const sal_uInt16 nSrcBitCount = pBmpSrc->GetBitCount();
@@ -1031,7 +1031,7 @@ bool Bitmap::CopyPixel_AlphaOptimized( const Rectangle& rRectDst, const Rectangl
{
if( pBmpSrc && ( *pBmpSrc != *this ) )
{
- Bitmap* pSrc = (Bitmap*) pBmpSrc;
+ Bitmap* pSrc = const_cast<Bitmap*>(pBmpSrc);
const Size aCopySizePix( pSrc->GetSizePixel() );
Rectangle aRectSrc( rRectSrc );
@@ -1191,7 +1191,7 @@ Bitmap Bitmap::CreateMask( const Color& rTransColor, sal_uLong nTol ) const
if( pWriteAcc )
{
- BitmapReadAccess* pReadAcc = ( (Bitmap*) this )->AcquireReadAccess();
+ BitmapReadAccess* pReadAcc = const_cast<Bitmap*>(this)->AcquireReadAccess();
if( pReadAcc )
{
@@ -1355,7 +1355,7 @@ Bitmap Bitmap::CreateMask( const Color& rTransColor, sal_uLong nTol ) const
}
}
- ( (Bitmap*) this )->ReleaseAccess( pReadAcc );
+ const_cast<Bitmap*>(this)->ReleaseAccess( pReadAcc );
bRet = true;
}
@@ -1377,7 +1377,7 @@ vcl::Region Bitmap::CreateRegion( const Color& rColor, const Rectangle& rRect )
{
vcl::Region aRegion;
Rectangle aRect( rRect );
- BitmapReadAccess* pReadAcc = ( (Bitmap*) this )->AcquireReadAccess();
+ BitmapReadAccess* pReadAcc = const_cast<Bitmap*>(this)->AcquireReadAccess();
aRect.Intersection( Rectangle( Point(), GetSizePixel() ) );
aRect.Justify();
@@ -1470,7 +1470,7 @@ vcl::Region Bitmap::CreateRegion( const Color& rColor, const Rectangle& rRect )
//aRegion.ImplEndAddRect();
//aRegion.SetRegionRectangles(aRectangles);
- ( (Bitmap*) this )->ReleaseAccess( pReadAcc );
+ const_cast<Bitmap*>(this)->ReleaseAccess( pReadAcc );
}
else
aRegion = aRect;
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index 6d35ec64b3c6..ab451c3f81bc 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -637,7 +637,7 @@ bool BitmapEx::Replace( const Color& rSearchColor, const Color& rReplaceColor, s
bool BitmapEx::Replace( const Color* pSearchColors, const Color* pReplaceColors, sal_uLong nColorCount, const sal_uLong* pTols )
{
- return !!aBitmap && aBitmap.Replace( pSearchColors, pReplaceColors, nColorCount, (sal_uLong*) pTols );
+ return !!aBitmap && aBitmap.Replace( pSearchColors, pReplaceColors, nColorCount, const_cast<sal_uLong*>(pTols) );
}
bool BitmapEx::Adjust( short nLuminancePercent, short nContrastPercent,
diff --git a/vcl/source/gdi/font.cxx b/vcl/source/gdi/font.cxx
index 43ea999b0cd3..fb7d1368672d 100644
--- a/vcl/source/gdi/font.cxx
+++ b/vcl/source/gdi/font.cxx
@@ -753,7 +753,7 @@ namespace
{
bool bResult = false;
TrueTypeFont* pTTF = NULL;
- if( OpenTTFontBuffer( const_cast<void*>(i_pBuffer), i_nSize, 0, &pTTF ) == SF_OK )
+ if( OpenTTFontBuffer( i_pBuffer, i_nSize, 0, &pTTF ) == SF_OK )
{
TTGlobalFontInfo aInfo;
GetTTGlobalFontInfo( pTTF, &aInfo );
diff --git a/vcl/source/gdi/gfxlink.cxx b/vcl/source/gdi/gfxlink.cxx
index 2d569659d987..75fd45c356ed 100644
--- a/vcl/source/gdi/gfxlink.cxx
+++ b/vcl/source/gdi/gfxlink.cxx
@@ -140,7 +140,7 @@ bool GfxLink::IsNative() const
const sal_uInt8* GfxLink::GetData() const
{
if( IsSwappedOut() )
- ( (GfxLink*) this )->SwapIn();
+ const_cast<GfxLink*>(this)->SwapIn();
return( mpBuf ? mpBuf->mpBuffer : NULL );
}
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 98bee4c9bbd1..3f65281a7163 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -891,9 +891,9 @@ void ImpGraphic::ImplDraw( OutputDevice* pOutDev,
default:
{
- ( (ImpGraphic*) this )->maMetaFile.WindStart();
- ( (ImpGraphic*) this )->maMetaFile.Play( pOutDev, rDestPt, rDestSize );
- ( (ImpGraphic*) this )->maMetaFile.WindStart();
+ const_cast<ImpGraphic*>(this)->maMetaFile.WindStart();
+ const_cast<ImpGraphic*>(this)->maMetaFile.Play( pOutDev, rDestPt, rDestSize );
+ const_cast<ImpGraphic*>(this)->maMetaFile.WindStart();
}
break;
}
diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx
index 07ddb8326647..df3f47cc043a 100644
--- a/vcl/source/gdi/jobset.cxx
+++ b/vcl/source/gdi/jobset.cxx
@@ -114,7 +114,7 @@ ImplJobSetup* JobSetup::ImplGetConstData()
const ImplJobSetup* JobSetup::ImplGetConstData() const
{
if ( !mpData )
- ((JobSetup*)this)->mpData = new ImplJobSetup;
+ const_cast<JobSetup*>(this)->mpData = new ImplJobSetup;
return mpData;
}
diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx
index 4e08ba694e14..38a5bd7b9a3d 100644
--- a/vcl/source/gdi/pngread.cxx
+++ b/vcl/source/gdi/pngread.cxx
@@ -173,7 +173,7 @@ PNGReaderImpl::PNGReaderImpl( SvStream& rPNGStream )
mpScanPrior ( NULL ),
mpTransTab ( NULL ),
mpScanCurrent ( NULL ),
- mpColorTable ( (sal_uInt8*) mpDefaultColorTable ),
+ mpColorTable ( const_cast<sal_uInt8*>(mpDefaultColorTable) ),
mnChunkType ( 0 ),
mnChunkLen ( 0 ),
mnBPP ( 0 ),
diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx
index fa908deeb253..d6114ef721d4 100644
--- a/vcl/source/gdi/region.cxx
+++ b/vcl/source/gdi/region.cxx
@@ -1537,8 +1537,8 @@ bool vcl::Region::operator==( const vcl::Region& rRegion ) const
{
// one of both has a B2DPolyPolygon based region, ensure both have it
// by evtl. conversion
- const_cast< vcl::Region* >(this)->GetAsB2DPolyPolygon();
- const_cast< vcl::Region& >(rRegion).GetAsB2DPolyPolygon();
+ GetAsB2DPolyPolygon();
+ rRegion.GetAsB2DPolyPolygon();
return *rRegion.getB2DPolyPolygon() == *getB2DPolyPolygon();
}
@@ -1547,8 +1547,8 @@ bool vcl::Region::operator==( const vcl::Region& rRegion ) const
{
// one of both has a B2DPolyPolygon based region, ensure both have it
// by evtl. conversion
- const_cast< vcl::Region* >(this)->GetAsPolyPolygon();
- const_cast< vcl::Region& >(rRegion).GetAsPolyPolygon();
+ GetAsPolyPolygon();
+ rRegion.GetAsPolyPolygon();
return *rRegion.getPolyPolygon() == *getPolyPolygon();
}
diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx
index 0112071adcc5..760f1899f511 100644
--- a/vcl/source/gdi/salgdilayout.cxx
+++ b/vcl/source/gdi/salgdilayout.cxx
@@ -105,7 +105,7 @@ void SalGraphics::mirror( long& x, const OutputDevice *pOutDev, bool bBack ) con
{
if( pOutDev && pOutDev->ImplIsAntiparallel() )
{
- OutputDevice *pOutDevRef = (OutputDevice*) pOutDev;
+ OutputDevice *pOutDevRef = const_cast<OutputDevice*>(pOutDev);
// mirror this window back
if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) )
{
@@ -137,7 +137,7 @@ void SalGraphics::mirror( long& x, long& nWidth, const OutputDevice *pOutDev, bo
{
if( pOutDev && pOutDev->ImplIsAntiparallel() )
{
- OutputDevice *pOutDevRef = (OutputDevice*) pOutDev;
+ OutputDevice *pOutDevRef = const_cast<OutputDevice*>(pOutDev);
// mirror this window back
if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) )
{
@@ -172,7 +172,7 @@ bool SalGraphics::mirror( sal_uInt32 nPoints, const SalPoint *pPtAry, SalPoint *
if( pOutDev && pOutDev->ImplIsAntiparallel() )
{
- OutputDevice *pOutDevRef = (OutputDevice*) pOutDev;
+ OutputDevice *pOutDevRef = const_cast<OutputDevice*>(pOutDev);
// mirror this window back
if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) )
{
@@ -295,7 +295,7 @@ basegfx::B2DPoint SalGraphics::mirror( const basegfx::B2DPoint& i_rPoint, const
{
if( i_pOutDev && !i_pOutDev->IsRTLEnabled() )
{
- OutputDevice *pOutDevRef = (OutputDevice*)i_pOutDev;
+ OutputDevice *pOutDevRef = const_cast<OutputDevice*>(i_pOutDev);
// mirror this window back
double devX = w-pOutDevRef->GetOutputWidthPixel()-pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX
if( i_bBack )
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index fbaeb22a468a..9ba3dcc21d02 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -668,7 +668,7 @@ void SalLayout::Release() const
if( --mnRefCount > 0 )
return;
// const_cast because some compilers violate ANSI C++ spec
- delete const_cast<SalLayout*>(this);
+ delete this;
}
Point SalLayout::GetDrawPosition( const Point& rRelative ) const