loplugin:flatten in cppcanvas

Change-Id: I4303c31ad3de1ba71aa366b6dc203504b8fffd77
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92453
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2020-04-17 15:46:19 +02:00
parent 803b49a377
commit f7f7fa8fe3
2 changed files with 88 additions and 88 deletions

View File

@ -83,20 +83,20 @@ namespace
const cppcanvas::CanvasSharedPtr& rCanvas )
{
rIsColorSet = pAct->IsSetting();
if (rIsColorSet)
{
::Color aColor( pAct->GetColor() );
if (!rIsColorSet)
return;
// force alpha part of color to
// opaque. transparent painting is done
// explicitly via MetaActionType::Transparent
aColor.SetTransparency(0);
//aColor.SetTransparency(128);
::Color aColor( pAct->GetColor() );
rColorSequence = vcl::unotools::colorToDoubleSequence(
aColor,
rCanvas->getUNOCanvas()->getDevice()->getDeviceColorSpace() );
}
// force alpha part of color to
// opaque. transparent painting is done
// explicitly via MetaActionType::Transparent
aColor.SetTransparency(0);
//aColor.SetTransparency(128);
rColorSequence = vcl::unotools::colorToDoubleSequence(
aColor,
rCanvas->getUNOCanvas()->getDevice()->getDeviceColorSpace() );
}
void setupStrokeAttributes( rendering::StrokeAttributes& o_rStrokeAttributes,
@ -150,46 +150,46 @@ namespace
}
}
if( LineStyle::Dash == rLineInfo.GetStyle() )
if( LineStyle::Dash != rLineInfo.GetStyle() )
return;
const ::cppcanvas::internal::OutDevState& rState( rParms.mrStates.getState() );
// TODO(F1): Interpret OutDev::GetRefPoint() for the start of the dashing.
// interpret dash info only if explicitly enabled as
// style
const ::basegfx::B2DSize aDistance( rLineInfo.GetDistance(), 0 );
const double nDistance( (rState.mapModeTransform * aDistance).getX() );
const ::basegfx::B2DSize aDashLen( rLineInfo.GetDashLen(), 0 );
const double nDashLen( (rState.mapModeTransform * aDashLen).getX() );
const ::basegfx::B2DSize aDotLen( rLineInfo.GetDotLen(), 0 );
const double nDotLen( (rState.mapModeTransform * aDotLen).getX() );
const sal_Int32 nNumArryEntries( 2*rLineInfo.GetDashCount() +
2*rLineInfo.GetDotCount() );
o_rStrokeAttributes.DashArray.realloc( nNumArryEntries );
double* pDashArray = o_rStrokeAttributes.DashArray.getArray();
// iteratively fill dash array, first with dashes, then
// with dots.
sal_Int32 nCurrEntry=0;
for( sal_Int32 i=0; i<rLineInfo.GetDashCount(); ++i )
{
const ::cppcanvas::internal::OutDevState& rState( rParms.mrStates.getState() );
// TODO(F1): Interpret OutDev::GetRefPoint() for the start of the dashing.
// interpret dash info only if explicitly enabled as
// style
const ::basegfx::B2DSize aDistance( rLineInfo.GetDistance(), 0 );
const double nDistance( (rState.mapModeTransform * aDistance).getX() );
const ::basegfx::B2DSize aDashLen( rLineInfo.GetDashLen(), 0 );
const double nDashLen( (rState.mapModeTransform * aDashLen).getX() );
const ::basegfx::B2DSize aDotLen( rLineInfo.GetDotLen(), 0 );
const double nDotLen( (rState.mapModeTransform * aDotLen).getX() );
const sal_Int32 nNumArryEntries( 2*rLineInfo.GetDashCount() +
2*rLineInfo.GetDotCount() );
o_rStrokeAttributes.DashArray.realloc( nNumArryEntries );
double* pDashArray = o_rStrokeAttributes.DashArray.getArray();
// iteratively fill dash array, first with dashes, then
// with dots.
sal_Int32 nCurrEntry=0;
for( sal_Int32 i=0; i<rLineInfo.GetDashCount(); ++i )
{
pDashArray[nCurrEntry++] = nDashLen;
pDashArray[nCurrEntry++] = nDistance;
}
for( sal_Int32 i=0; i<rLineInfo.GetDotCount(); ++i )
{
pDashArray[nCurrEntry++] = nDotLen;
pDashArray[nCurrEntry++] = nDistance;
}
pDashArray[nCurrEntry++] = nDashLen;
pDashArray[nCurrEntry++] = nDistance;
}
for( sal_Int32 i=0; i<rLineInfo.GetDotCount(); ++i )
{
pDashArray[nCurrEntry++] = nDotLen;
pDashArray[nCurrEntry++] = nDistance;
}
}
@ -1026,21 +1026,21 @@ namespace cppcanvas::internal
}
}
if( pTextAction )
if( !pTextAction )
return;
maActions.emplace_back(
pTextAction,
rParms.mrCurrActionIndex );
if ( pStrikeoutTextAction )
{
maActions.emplace_back(
pTextAction,
rParms.mrCurrActionIndex );
if ( pStrikeoutTextAction )
{
maActions.emplace_back(
pStrikeoutTextAction,
rParms.mrCurrActionIndex );
}
rParms.mrCurrActionIndex += pTextAction->getActionCount()-1;
pStrikeoutTextAction,
rParms.mrCurrActionIndex );
}
rParms.mrCurrActionIndex += pTextAction->getActionCount()-1;
}
void ImplRenderer::updateClipping( const ::basegfx::B2DPolyPolygon& rClipPoly,

View File

@ -90,21 +90,21 @@ namespace cppcanvas::internal
{
OSL_ENSURE( mxSprite.is(), "ImplSprite::move(): Invalid sprite");
if( mxSprite.is() )
{
rendering::ViewState aViewState;
rendering::RenderState aRenderState;
if( !mxSprite.is() )
return;
::canvas::tools::initViewState( aViewState );
::canvas::tools::initRenderState( aRenderState );
rendering::ViewState aViewState;
rendering::RenderState aRenderState;
::canvas::tools::setViewStateTransform( aViewState,
mpTransformArbiter->getTransformation() );
::canvas::tools::initViewState( aViewState );
::canvas::tools::initRenderState( aRenderState );
mxSprite->move( ::basegfx::unotools::point2DFromB2DPoint( rNewPos ),
aViewState,
aRenderState );
}
::canvas::tools::setViewStateTransform( aViewState,
mpTransformArbiter->getTransformation() );
mxSprite->move( ::basegfx::unotools::point2DFromB2DPoint( rNewPos ),
aViewState,
aRenderState );
}
void ImplSprite::transform( const ::basegfx::B2DHomMatrix& rMatrix )
@ -135,22 +135,22 @@ namespace cppcanvas::internal
OSL_ENSURE( mxGraphicDevice.is(), "ImplSprite::setClip(): Invalid canvas");
OSL_ENSURE( mxSprite.is(), "ImplSprite::transform(): Invalid sprite");
if( mxSprite.is() && mxGraphicDevice.is() )
{
::basegfx::B2DPolyPolygon aTransformedClipPoly( rClipPoly );
if( !(mxSprite.is() && mxGraphicDevice.is()) )
return;
// extract linear part of canvas view transformation (linear means:
// without translational components)
::basegfx::B2DHomMatrix aViewTransform( mpTransformArbiter->getTransformation() );
aViewTransform.set( 0, 2, 0.0 );
aViewTransform.set( 1, 2, 0.0 );
::basegfx::B2DPolyPolygon aTransformedClipPoly( rClipPoly );
// transform polygon from view to device coordinate space
aTransformedClipPoly.transform( aViewTransform );
// extract linear part of canvas view transformation (linear means:
// without translational components)
::basegfx::B2DHomMatrix aViewTransform( mpTransformArbiter->getTransformation() );
aViewTransform.set( 0, 2, 0.0 );
aViewTransform.set( 1, 2, 0.0 );
mxSprite->clip( ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon( mxGraphicDevice,
aTransformedClipPoly ) );
}
// transform polygon from view to device coordinate space
aTransformedClipPoly.transform( aViewTransform );
mxSprite->clip( ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon( mxGraphicDevice,
aTransformedClipPoly ) );
}
void ImplSprite::setClip()