[Libreoffice-commits] core.git: cppcanvas/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Fri Apr 17 16:21:12 UTC 2020


 cppcanvas/source/mtfrenderer/implrenderer.cxx |  106 +++++++++++++-------------
 cppcanvas/source/wrapper/implsprite.cxx       |   50 ++++++------
 2 files changed, 78 insertions(+), 78 deletions(-)

New commits:
commit f7f7fa8fe313b03e0ee683b2154a1bf49ee9d741
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Apr 17 15:46:19 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Apr 17 18:20:32 2020 +0200

    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 at collabora.co.uk>

diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index db2edcd3bde1..c856a237f8bc 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -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() )
-        {
-            const ::cppcanvas::internal::OutDevState& rState( rParms.mrStates.getState() );
+        if( LineStyle::Dash != rLineInfo.GetStyle() )
+            return;
 
-            // TODO(F1): Interpret OutDev::GetRefPoint() for the start of the dashing.
+        const ::cppcanvas::internal::OutDevState& rState( rParms.mrStates.getState() );
 
-            // interpret dash info only if explicitly enabled as
-            // style
-            const ::basegfx::B2DSize aDistance( rLineInfo.GetDistance(), 0 );
-            const double nDistance( (rState.mapModeTransform * aDistance).getX() );
+        // TODO(F1): Interpret OutDev::GetRefPoint() for the start of the dashing.
 
-            const ::basegfx::B2DSize aDashLen( rLineInfo.GetDashLen(), 0 );
-            const double nDashLen( (rState.mapModeTransform * aDashLen).getX() );
+        // 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 aDotLen( rLineInfo.GetDotLen(), 0 );
-            const double nDotLen( (rState.mapModeTransform * aDotLen).getX() );
+        const ::basegfx::B2DSize aDashLen( rLineInfo.GetDashLen(), 0 );
+        const double nDashLen( (rState.mapModeTransform * aDashLen).getX() );
 
-            const sal_Int32 nNumArryEntries( 2*rLineInfo.GetDashCount() +
-                                             2*rLineInfo.GetDotCount() );
+        const ::basegfx::B2DSize aDotLen( rLineInfo.GetDotLen(), 0 );
+        const double nDotLen( (rState.mapModeTransform * aDotLen).getX() );
 
-            o_rStrokeAttributes.DashArray.realloc( nNumArryEntries );
-            double* pDashArray = o_rStrokeAttributes.DashArray.getArray();
+        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.
 
+        // 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;
-            }
+        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;
         }
     }
 
@@ -1026,21 +1026,21 @@ namespace cppcanvas::internal
                 }
             }
 
-            if( pTextAction )
-            {
-                maActions.emplace_back(
-                        pTextAction,
-                        rParms.mrCurrActionIndex );
+            if( !pTextAction )
+                return;
 
-                if ( pStrikeoutTextAction )
-                {
-                    maActions.emplace_back(
-                        pStrikeoutTextAction,
-                        rParms.mrCurrActionIndex );
-                }
+            maActions.emplace_back(
+                    pTextAction,
+                    rParms.mrCurrActionIndex );
 
-                rParms.mrCurrActionIndex += pTextAction->getActionCount()-1;
+            if ( pStrikeoutTextAction )
+            {
+                maActions.emplace_back(
+                    pStrikeoutTextAction,
+                    rParms.mrCurrActionIndex );
             }
+
+            rParms.mrCurrActionIndex += pTextAction->getActionCount()-1;
         }
 
         void ImplRenderer::updateClipping( const ::basegfx::B2DPolyPolygon& rClipPoly,
diff --git a/cppcanvas/source/wrapper/implsprite.cxx b/cppcanvas/source/wrapper/implsprite.cxx
index a7458d27a05a..c3e1cbab3b9b 100644
--- a/cppcanvas/source/wrapper/implsprite.cxx
+++ b/cppcanvas/source/wrapper/implsprite.cxx
@@ -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()


More information about the Libreoffice-commits mailing list