From 4a7fb6abcd8999d64acefb598dfe85fff042d533 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 12 Jan 2018 20:27:12 +0100 Subject: More loplugin:cstylecast: cppcanvas auto-rewrite with "Enable loplugin:cstylecast for some more cases" plus solenv/clang-format/reformat-formatted-files Change-Id: Ib58b16600c97f8dab1b32d7e049c946ca82e660b --- cppcanvas/source/mtfrenderer/emfppath.cxx | 2 +- cppcanvas/source/mtfrenderer/implrenderer.cxx | 32 +++++++++++++-------------- cppcanvas/source/mtfrenderer/mtftools.cxx | 12 +++++----- 3 files changed, 23 insertions(+), 23 deletions(-) (limited to 'cppcanvas') diff --git a/cppcanvas/source/mtfrenderer/emfppath.cxx b/cppcanvas/source/mtfrenderer/emfppath.cxx index 39dc1bcb9f99..162873750ad0 100644 --- a/cppcanvas/source/mtfrenderer/emfppath.cxx +++ b/cppcanvas/source/mtfrenderer/emfppath.cxx @@ -87,7 +87,7 @@ namespace cppcanvas if (pPointTypes) for (int i = 0; i < nPoints; i ++) { s.ReadUChar( pPointTypes [i] ); - SAL_INFO ("cppcanvas.emf", "EMF+\tpoint type: " << (int)pPointTypes [i]); + SAL_INFO ("cppcanvas.emf", "EMF+\tpoint type: " << static_cast(pPointTypes [i])); } aPolygon.clear (); diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx index b71b34ddd8b8..cb8949684542 100644 --- a/cppcanvas/source/mtfrenderer/implrenderer.cxx +++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx @@ -528,15 +528,15 @@ namespace cppcanvas // scale color coefficients with gradient intensities const sal_uInt16 nStartIntensity( rGradient.GetStartIntensity() ); ::Color aVCLStartColor( rGradient.GetStartColor() ); - aVCLStartColor.SetRed( (sal_uInt8)(aVCLStartColor.GetRed() * nStartIntensity / 100) ); - aVCLStartColor.SetGreen( (sal_uInt8)(aVCLStartColor.GetGreen() * nStartIntensity / 100) ); - aVCLStartColor.SetBlue( (sal_uInt8)(aVCLStartColor.GetBlue() * nStartIntensity / 100) ); + aVCLStartColor.SetRed( static_cast(aVCLStartColor.GetRed() * nStartIntensity / 100) ); + aVCLStartColor.SetGreen( static_cast(aVCLStartColor.GetGreen() * nStartIntensity / 100) ); + aVCLStartColor.SetBlue( static_cast(aVCLStartColor.GetBlue() * nStartIntensity / 100) ); const sal_uInt16 nEndIntensity( rGradient.GetEndIntensity() ); ::Color aVCLEndColor( rGradient.GetEndColor() ); - aVCLEndColor.SetRed( (sal_uInt8)(aVCLEndColor.GetRed() * nEndIntensity / 100) ); - aVCLEndColor.SetGreen( (sal_uInt8)(aVCLEndColor.GetGreen() * nEndIntensity / 100) ); - aVCLEndColor.SetBlue( (sal_uInt8)(aVCLEndColor.GetBlue() * nEndIntensity / 100) ); + aVCLEndColor.SetRed( static_cast(aVCLEndColor.GetRed() * nEndIntensity / 100) ); + aVCLEndColor.SetGreen( static_cast(aVCLEndColor.GetGreen() * nEndIntensity / 100) ); + aVCLEndColor.SetBlue( static_cast(aVCLEndColor.GetBlue() * nEndIntensity / 100) ); uno::Reference xColorSpace( rParms.mrCanvas->getUNOCanvas()->getDevice()->getDeviceColorSpace()); @@ -816,7 +816,7 @@ namespace cppcanvas sal_Int32 nNormalWidth = rParms.mrVDev.GetFontMetric( aTestFont ).GetAverageFontWidth(); if( nNormalWidth != nFontWidthLog ) if( nNormalWidth ) - aFontMatrix.m00 = (double)nFontWidthLog / nNormalWidth; + aFontMatrix.m00 = static_cast(nFontWidthLog) / nNormalWidth; } // #i52608# apply map mode scale also to font matrix - an @@ -1477,11 +1477,11 @@ namespace cppcanvas // TODO(Q2): define and use appropriate enumeration types rState.textReliefStyle = rFont.GetRelief(); - rState.textOverlineStyle = (sal_Int8)rFont.GetOverline(); + rState.textOverlineStyle = static_cast(rFont.GetOverline()); rState.textUnderlineStyle = rParms.maFontUnderline.is_initialized() ? - (*rParms.maFontUnderline ? (sal_Int8)LINESTYLE_SINGLE : (sal_Int8)LINESTYLE_NONE) : - (sal_Int8)rFont.GetUnderline(); - rState.textStrikeoutStyle = (sal_Int8)rFont.GetStrikeout(); + (*rParms.maFontUnderline ? sal_Int8(LINESTYLE_SINGLE) : sal_Int8(LINESTYLE_NONE)) : + static_cast(rFont.GetUnderline()); + rState.textStrikeoutStyle = static_cast(rFont.GetStrikeout()); rState.textEmphasisMarkStyle = rFont.GetEmphasisMark() & FontEmphasisMark::Style; rState.isTextEffectShadowSet = rFont.IsShadow(); rState.isTextWordUnderlineSet = rFont.IsWordLineMode(); @@ -1580,8 +1580,8 @@ namespace cppcanvas rStates.getState().transform.translate( rPos.X(), rPos.Y() ); - rStates.getState().transform.scale( (double)rSize.Width() / aMtfSizePix.Width(), - (double)rSize.Height() / aMtfSizePix.Height() ); + rStates.getState().transform.scale( static_cast(rSize.Width()) / aMtfSizePix.Width(), + static_cast(rSize.Height()) / aMtfSizePix.Height() ); createActions( const_cast(pAct->GetSubstitute()), rFactoryParms, @@ -1945,8 +1945,8 @@ namespace cppcanvas vcl::unotools::b2DPointFromPoint( rRect.TopLeft() ), vcl::unotools::b2DPointFromPoint( rRect.BottomRight() ) + ::basegfx::B2DPoint(1,1) ), - ( (double) static_cast(pCurrAct)->GetHorzRound() ) / rRect.GetWidth(), - ( (double) static_cast(pCurrAct)->GetVertRound() ) / rRect.GetHeight() ) ); + static_cast(static_cast(pCurrAct)->GetHorzRound()) / rRect.GetWidth(), + static_cast(static_cast(pCurrAct)->GetVertRound()) / rRect.GetHeight() ) ); aPoly.transform( rStates.getState().mapModeTransform ); createFillAndStroke( aPoly, @@ -2568,7 +2568,7 @@ namespace cppcanvas // entry represents the 'end' position of // the corresponding character, thus, we // let i run from 1 to nLen. - *p++ += (long)i*nWidthDifference/nLen; + *p++ += static_cast(i)*nWidthDifference/nLen; } createTextAction( diff --git a/cppcanvas/source/mtfrenderer/mtftools.cxx b/cppcanvas/source/mtfrenderer/mtftools.cxx index 59ad2fbd9b6d..291eea7fcccb 100644 --- a/cppcanvas/source/mtfrenderer/mtftools.cxx +++ b/cppcanvas/source/mtfrenderer/mtftools.cxx @@ -93,8 +93,8 @@ namespace cppcanvas const ::Size aSizePixel( rVDev.LogicToPixel( aSizeLogic ) ); o_rMatrix = basegfx::utils::createScaleB2DHomMatrix( - aSizePixel.Width() / (double)aSizeLogic.Width(), - aSizePixel.Height() / (double)aSizeLogic.Height() ); + aSizePixel.Width() / static_cast(aSizeLogic.Width()), + aSizePixel.Height() / static_cast(aSizeLogic.Height()) ); return o_rMatrix; } @@ -170,10 +170,10 @@ namespace cppcanvas ::basegfx::B2DPolygon aLocalClip( ::basegfx::utils::createPolygonFromRect( ::basegfx::B2DRectangle( - (double)(aLocalClipRect.Left()), - (double)(aLocalClipRect.Top()), - (double)(aLocalClipRect.Right()), - (double)(aLocalClipRect.Bottom()) ) ) ); + static_cast(aLocalClipRect.Left()), + static_cast(aLocalClipRect.Top()), + static_cast(aLocalClipRect.Right()), + static_cast(aLocalClipRect.Bottom()) ) ) ); ::basegfx::B2DHomMatrix aTransform; if( bOffsetting ) -- cgit