Kaydet (Commit) 4a7fb6ab authored tarafından Stephan Bergmann's avatar Stephan Bergmann

More loplugin:cstylecast: cppcanvas

auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable
loplugin:cstylecast for some more cases" plus
solenv/clang-format/reformat-formatted-files

Change-Id: Ib58b16600c97f8dab1b32d7e049c946ca82e660b
üst 14d38072
...@@ -87,7 +87,7 @@ namespace cppcanvas ...@@ -87,7 +87,7 @@ namespace cppcanvas
if (pPointTypes) if (pPointTypes)
for (int i = 0; i < nPoints; i ++) { for (int i = 0; i < nPoints; i ++) {
s.ReadUChar( pPointTypes [i] ); s.ReadUChar( pPointTypes [i] );
SAL_INFO ("cppcanvas.emf", "EMF+\tpoint type: " << (int)pPointTypes [i]); SAL_INFO ("cppcanvas.emf", "EMF+\tpoint type: " << static_cast<int>(pPointTypes [i]));
} }
aPolygon.clear (); aPolygon.clear ();
......
...@@ -528,15 +528,15 @@ namespace cppcanvas ...@@ -528,15 +528,15 @@ namespace cppcanvas
// scale color coefficients with gradient intensities // scale color coefficients with gradient intensities
const sal_uInt16 nStartIntensity( rGradient.GetStartIntensity() ); const sal_uInt16 nStartIntensity( rGradient.GetStartIntensity() );
::Color aVCLStartColor( rGradient.GetStartColor() ); ::Color aVCLStartColor( rGradient.GetStartColor() );
aVCLStartColor.SetRed( (sal_uInt8)(aVCLStartColor.GetRed() * nStartIntensity / 100) ); aVCLStartColor.SetRed( static_cast<sal_uInt8>(aVCLStartColor.GetRed() * nStartIntensity / 100) );
aVCLStartColor.SetGreen( (sal_uInt8)(aVCLStartColor.GetGreen() * nStartIntensity / 100) ); aVCLStartColor.SetGreen( static_cast<sal_uInt8>(aVCLStartColor.GetGreen() * nStartIntensity / 100) );
aVCLStartColor.SetBlue( (sal_uInt8)(aVCLStartColor.GetBlue() * nStartIntensity / 100) ); aVCLStartColor.SetBlue( static_cast<sal_uInt8>(aVCLStartColor.GetBlue() * nStartIntensity / 100) );
const sal_uInt16 nEndIntensity( rGradient.GetEndIntensity() ); const sal_uInt16 nEndIntensity( rGradient.GetEndIntensity() );
::Color aVCLEndColor( rGradient.GetEndColor() ); ::Color aVCLEndColor( rGradient.GetEndColor() );
aVCLEndColor.SetRed( (sal_uInt8)(aVCLEndColor.GetRed() * nEndIntensity / 100) ); aVCLEndColor.SetRed( static_cast<sal_uInt8>(aVCLEndColor.GetRed() * nEndIntensity / 100) );
aVCLEndColor.SetGreen( (sal_uInt8)(aVCLEndColor.GetGreen() * nEndIntensity / 100) ); aVCLEndColor.SetGreen( static_cast<sal_uInt8>(aVCLEndColor.GetGreen() * nEndIntensity / 100) );
aVCLEndColor.SetBlue( (sal_uInt8)(aVCLEndColor.GetBlue() * nEndIntensity / 100) ); aVCLEndColor.SetBlue( static_cast<sal_uInt8>(aVCLEndColor.GetBlue() * nEndIntensity / 100) );
uno::Reference<rendering::XColorSpace> xColorSpace( uno::Reference<rendering::XColorSpace> xColorSpace(
rParms.mrCanvas->getUNOCanvas()->getDevice()->getDeviceColorSpace()); rParms.mrCanvas->getUNOCanvas()->getDevice()->getDeviceColorSpace());
...@@ -816,7 +816,7 @@ namespace cppcanvas ...@@ -816,7 +816,7 @@ namespace cppcanvas
sal_Int32 nNormalWidth = rParms.mrVDev.GetFontMetric( aTestFont ).GetAverageFontWidth(); sal_Int32 nNormalWidth = rParms.mrVDev.GetFontMetric( aTestFont ).GetAverageFontWidth();
if( nNormalWidth != nFontWidthLog ) if( nNormalWidth != nFontWidthLog )
if( nNormalWidth ) if( nNormalWidth )
aFontMatrix.m00 = (double)nFontWidthLog / nNormalWidth; aFontMatrix.m00 = static_cast<double>(nFontWidthLog) / nNormalWidth;
} }
// #i52608# apply map mode scale also to font matrix - an // #i52608# apply map mode scale also to font matrix - an
...@@ -1477,11 +1477,11 @@ namespace cppcanvas ...@@ -1477,11 +1477,11 @@ namespace cppcanvas
// TODO(Q2): define and use appropriate enumeration types // TODO(Q2): define and use appropriate enumeration types
rState.textReliefStyle = rFont.GetRelief(); rState.textReliefStyle = rFont.GetRelief();
rState.textOverlineStyle = (sal_Int8)rFont.GetOverline(); rState.textOverlineStyle = static_cast<sal_Int8>(rFont.GetOverline());
rState.textUnderlineStyle = rParms.maFontUnderline.is_initialized() ? rState.textUnderlineStyle = rParms.maFontUnderline.is_initialized() ?
(*rParms.maFontUnderline ? (sal_Int8)LINESTYLE_SINGLE : (sal_Int8)LINESTYLE_NONE) : (*rParms.maFontUnderline ? sal_Int8(LINESTYLE_SINGLE) : sal_Int8(LINESTYLE_NONE)) :
(sal_Int8)rFont.GetUnderline(); static_cast<sal_Int8>(rFont.GetUnderline());
rState.textStrikeoutStyle = (sal_Int8)rFont.GetStrikeout(); rState.textStrikeoutStyle = static_cast<sal_Int8>(rFont.GetStrikeout());
rState.textEmphasisMarkStyle = rFont.GetEmphasisMark() & FontEmphasisMark::Style; rState.textEmphasisMarkStyle = rFont.GetEmphasisMark() & FontEmphasisMark::Style;
rState.isTextEffectShadowSet = rFont.IsShadow(); rState.isTextEffectShadowSet = rFont.IsShadow();
rState.isTextWordUnderlineSet = rFont.IsWordLineMode(); rState.isTextWordUnderlineSet = rFont.IsWordLineMode();
...@@ -1580,8 +1580,8 @@ namespace cppcanvas ...@@ -1580,8 +1580,8 @@ namespace cppcanvas
rStates.getState().transform.translate( rPos.X(), rStates.getState().transform.translate( rPos.X(),
rPos.Y() ); rPos.Y() );
rStates.getState().transform.scale( (double)rSize.Width() / aMtfSizePix.Width(), rStates.getState().transform.scale( static_cast<double>(rSize.Width()) / aMtfSizePix.Width(),
(double)rSize.Height() / aMtfSizePix.Height() ); static_cast<double>(rSize.Height()) / aMtfSizePix.Height() );
createActions( const_cast<GDIMetaFile&>(pAct->GetSubstitute()), createActions( const_cast<GDIMetaFile&>(pAct->GetSubstitute()),
rFactoryParms, rFactoryParms,
...@@ -1945,8 +1945,8 @@ namespace cppcanvas ...@@ -1945,8 +1945,8 @@ namespace cppcanvas
vcl::unotools::b2DPointFromPoint( rRect.TopLeft() ), vcl::unotools::b2DPointFromPoint( rRect.TopLeft() ),
vcl::unotools::b2DPointFromPoint( rRect.BottomRight() ) + vcl::unotools::b2DPointFromPoint( rRect.BottomRight() ) +
::basegfx::B2DPoint(1,1) ), ::basegfx::B2DPoint(1,1) ),
( (double) static_cast<MetaRoundRectAction*>(pCurrAct)->GetHorzRound() ) / rRect.GetWidth(), static_cast<double>(static_cast<MetaRoundRectAction*>(pCurrAct)->GetHorzRound()) / rRect.GetWidth(),
( (double) static_cast<MetaRoundRectAction*>(pCurrAct)->GetVertRound() ) / rRect.GetHeight() ) ); static_cast<double>(static_cast<MetaRoundRectAction*>(pCurrAct)->GetVertRound()) / rRect.GetHeight() ) );
aPoly.transform( rStates.getState().mapModeTransform ); aPoly.transform( rStates.getState().mapModeTransform );
createFillAndStroke( aPoly, createFillAndStroke( aPoly,
...@@ -2568,7 +2568,7 @@ namespace cppcanvas ...@@ -2568,7 +2568,7 @@ namespace cppcanvas
// entry represents the 'end' position of // entry represents the 'end' position of
// the corresponding character, thus, we // the corresponding character, thus, we
// let i run from 1 to nLen. // let i run from 1 to nLen.
*p++ += (long)i*nWidthDifference/nLen; *p++ += static_cast<long>(i)*nWidthDifference/nLen;
} }
createTextAction( createTextAction(
......
...@@ -93,8 +93,8 @@ namespace cppcanvas ...@@ -93,8 +93,8 @@ namespace cppcanvas
const ::Size aSizePixel( rVDev.LogicToPixel( aSizeLogic ) ); const ::Size aSizePixel( rVDev.LogicToPixel( aSizeLogic ) );
o_rMatrix = basegfx::utils::createScaleB2DHomMatrix( o_rMatrix = basegfx::utils::createScaleB2DHomMatrix(
aSizePixel.Width() / (double)aSizeLogic.Width(), aSizePixel.Width() / static_cast<double>(aSizeLogic.Width()),
aSizePixel.Height() / (double)aSizeLogic.Height() ); aSizePixel.Height() / static_cast<double>(aSizeLogic.Height()) );
return o_rMatrix; return o_rMatrix;
} }
...@@ -170,10 +170,10 @@ namespace cppcanvas ...@@ -170,10 +170,10 @@ namespace cppcanvas
::basegfx::B2DPolygon aLocalClip( ::basegfx::B2DPolygon aLocalClip(
::basegfx::utils::createPolygonFromRect( ::basegfx::utils::createPolygonFromRect(
::basegfx::B2DRectangle( ::basegfx::B2DRectangle(
(double)(aLocalClipRect.Left()), static_cast<double>(aLocalClipRect.Left()),
(double)(aLocalClipRect.Top()), static_cast<double>(aLocalClipRect.Top()),
(double)(aLocalClipRect.Right()), static_cast<double>(aLocalClipRect.Right()),
(double)(aLocalClipRect.Bottom()) ) ) ); static_cast<double>(aLocalClipRect.Bottom()) ) ) );
::basegfx::B2DHomMatrix aTransform; ::basegfx::B2DHomMatrix aTransform;
if( bOffsetting ) if( bOffsetting )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment