[Libreoffice-commits] .: basegfx/source

Julien Nabet serval2412 at kemper.freedesktop.org
Wed Jun 6 13:42:04 PDT 2012


 basegfx/source/polygon/b2dlinegeometry.cxx       |    2 +-
 basegfx/source/polygon/b2dpolygoncutandtouch.cxx |    4 ++--
 basegfx/source/polygon/b2dpolygontools.cxx       |    2 +-
 basegfx/source/polygon/b2dpolypolygoncutter.cxx  |    4 ++--
 basegfx/source/range/b2drangeclipper.cxx         |    5 ++---
 basegfx/source/workbench/bezierclip.cxx          |    3 ++-
 6 files changed, 10 insertions(+), 10 deletions(-)

New commits:
commit c9e4cc279371a87495bfbc7c52f56686f9ab42c9
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Wed Jun 6 22:40:37 2012 +0200

    Some cppcheck cleaning
    
    Change-Id: I7a5f34715faecd689900b5d41eae9c782e99b47b

diff --git a/basegfx/source/polygon/b2dlinegeometry.cxx b/basegfx/source/polygon/b2dlinegeometry.cxx
index cf28c90..b68cd6f 100644
--- a/basegfx/source/polygon/b2dlinegeometry.cxx
+++ b/basegfx/source/polygon/b2dlinegeometry.cxx
@@ -619,7 +619,6 @@ namespace basegfx
             if(nPointCount)
             {
                 B2DPolyPolygon aRetval;
-                const bool bEventuallyCreateLineJoin(B2DLINEJOIN_NONE != eJoin);
                 const bool bIsClosed(aCandidate.isClosed());
                 const sal_uInt32 nEdgeCount(bIsClosed ? nPointCount : nPointCount - 1);
 
@@ -628,6 +627,7 @@ namespace basegfx
                     B2DCubicBezier aEdge;
                     B2DCubicBezier aPrev;
 
+                    const bool bEventuallyCreateLineJoin(B2DLINEJOIN_NONE != eJoin);
                     // prepare edge
                     aEdge.setStartPoint(aCandidate.getB2DPoint(0));
 
diff --git a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx
index 73a01be..ca3f7c6 100644
--- a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx
+++ b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx
@@ -563,7 +563,6 @@ namespace basegfx
                             {
                                 rCandidate.getBezierSegment(b, aCubicB);
                                 aCubicB.testAndSolveTrivialBezier();
-                                const bool bEdgeBIsCurve(aCubicB.isBezier());
                                 const B2DRange aRangeB(aCubicB.getRange());
 
                                 // only overlapping segments need to be tested
@@ -575,6 +574,7 @@ namespace basegfx
                                     bOverlap = aRangeA.overlapsMore(aRangeB);
                                 if( bOverlap)
                                 {
+                                    const bool bEdgeBIsCurve(aCubicB.isBezier());
                                     if(bEdgeAIsCurve && bEdgeBIsCurve)
                                     {
                                         // test for bezier-bezier cuts
@@ -816,7 +816,6 @@ namespace basegfx
                             {
                                 rCandidateB.getBezierSegment(b, aCubicB);
                                 aCubicB.testAndSolveTrivialBezier();
-                                const bool bEdgeBIsCurve(aCubicB.isBezier());
                                 const B2DRange aRangeB(aCubicB.getRange());
 
                                 // consecutive segments touch of course
@@ -827,6 +826,7 @@ namespace basegfx
                                     bOverlap = aRangeA.overlapsMore(aRangeB);
                                 if( bOverlap)
                                 {
+                                    const bool bEdgeBIsCurve(aCubicB.isBezier());
                                     if(bEdgeAIsCurve && bEdgeBIsCurve)
                                     {
                                         // test for bezier-bezier cuts
diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx
index babc779..baae69a 100644
--- a/basegfx/source/polygon/b2dpolygontools.cxx
+++ b/basegfx/source/polygon/b2dpolygontools.cxx
@@ -3066,10 +3066,10 @@ namespace basegfx
             }
 
             const bool bHasWidth(!fTools::equalZero(fWaveWidth));
-            const bool bHasHeight(!fTools::equalZero(fWaveHeight));
 
             if(bHasWidth)
             {
+                const bool bHasHeight(!fTools::equalZero(fWaveHeight));
                 if(bHasHeight)
                 {
                     // width and height, create waveline. First subdivide to reduce input to line segments
diff --git a/basegfx/source/polygon/b2dpolypolygoncutter.cxx b/basegfx/source/polygon/b2dpolypolygoncutter.cxx
index b5a0868..522bc37 100644
--- a/basegfx/source/polygon/b2dpolypolygoncutter.cxx
+++ b/basegfx/source/polygon/b2dpolypolygoncutter.cxx
@@ -903,7 +903,7 @@ namespace basegfx
 
             // first step: prepareForPolygonOperation and simple merge of non-overlapping
             // PolyPolygons for speedup; this is possible for the wanted OR-operation
-            if(aInput.size())
+            if(!aInput.empty())
             {
                 std::vector< basegfx::B2DPolyPolygon > aResult;
                 aResult.reserve(aInput.size());
@@ -912,7 +912,7 @@ namespace basegfx
                 {
                     const basegfx::B2DPolyPolygon aCandidate(prepareForPolygonOperation(aInput[a]));
 
-                    if(aResult.size())
+                    if(!aResult.empty())
                     {
                         const B2DRange aCandidateRange(aCandidate.getB2DRange());
                         bool bCouldMergeSimple(false);
diff --git a/basegfx/source/range/b2drangeclipper.cxx b/basegfx/source/range/b2drangeclipper.cxx
index 1deede8..273b4ab 100644
--- a/basegfx/source/range/b2drangeclipper.cxx
+++ b/basegfx/source/range/b2drangeclipper.cxx
@@ -329,11 +329,10 @@ namespace basegfx
                 // unconditionally
                 append(aIntersectionPoint);
 
-                const bool isSweepLineEnteringRect(
-                    rEvent.getEdgeType() == SweepLineEvent::STARTING_EDGE);
                 if( isFinishingEdge )
                 {
-                    if( isSweepLineEnteringRect )
+                    // isSweepLineEnteringRect ?
+                    if( rEvent.getEdgeType() == SweepLineEvent::STARTING_EDGE)
                         handleFinalOwnRightEdge(rActiveEdge);
                     else
                         handleFinalOwnLeftEdge(rActiveEdge,
diff --git a/basegfx/source/workbench/bezierclip.cxx b/basegfx/source/workbench/bezierclip.cxx
index 2070e76..68c8e3f 100644
--- a/basegfx/source/workbench/bezierclip.cxx
+++ b/basegfx/source/workbench/bezierclip.cxx
@@ -232,7 +232,7 @@ bool Impl_calcSafeParams( double&           t1,
         {
             // calc intersection of convex hull segment with
             // one of the horizontal bounds lines
-            const double r_x( p1.x - p0.x );
+            // to optimize a bit, r_x is calculated only in else case
             const double r_y( p1.y - p0.y );
 
             if( tolZero(r_y) )
@@ -252,6 +252,7 @@ bool Impl_calcSafeParams( double&           t1,
             {
                 // check against lower and higher bounds
                 // =====================================
+                const double r_x( p1.x - p0.x );
 
                 // calc intersection with horizontal dMin line
                 const double currTLow( (lowerYBound - p0.y) * r_x / r_y + p0.x );


More information about the Libreoffice-commits mailing list