[Libreoffice-commits] core.git: basegfx/inc basegfx/source basegfx/test

Mario J. Rugiero mrugiero at gmail.com
Fri Oct 30 06:03:18 UTC 2015


 basegfx/inc/pch/precompiled_basegfx.hxx   |    1 
 basegfx/source/polygon/b2dpolypolygon.cxx |   21 +++++--------
 basegfx/source/polygon/b3dpolypolygon.cxx |   46 ++++++++++--------------------
 basegfx/source/range/b2drangeclipper.cxx  |   14 ++-------
 basegfx/test/boxclipper.cxx               |    6 +--
 5 files changed, 30 insertions(+), 58 deletions(-)

New commits:
commit 26d5407a5f653e55ec9255117760886bcec4fe15
Author: Mario J. Rugiero <mrugiero at gmail.com>
Date:   Fri Oct 30 01:13:55 2015 -0300

    basegfx tree cleanup
    
    - Eliminated an unnecessary boost/bind.hxx include.
    - Replaced simple old-style for loops that iterated over a container by ranged based for loops.
    - Replaced for_each by ranged based for loops wherever valid.
    
    Change-Id: Ib5c8291cf6d417047b350560f0428723efeccd1c
    Reviewed-on: https://gerrit.libreoffice.org/19679
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/basegfx/inc/pch/precompiled_basegfx.hxx b/basegfx/inc/pch/precompiled_basegfx.hxx
index c393169..b13cf78 100644
--- a/basegfx/inc/pch/precompiled_basegfx.hxx
+++ b/basegfx/inc/pch/precompiled_basegfx.hxx
@@ -15,7 +15,6 @@
 */
 
 #include <algorithm>
-#include <boost/bind.hpp>
 #include <boost/tuple/tuple.hpp>
 #include <boost/noncopyable.hpp>
 #include <com/sun/star/awt/Point.hpp>
diff --git a/basegfx/source/polygon/b2dpolypolygon.cxx b/basegfx/source/polygon/b2dpolypolygon.cxx
index a77652d..d640c53 100644
--- a/basegfx/source/polygon/b2dpolypolygon.cxx
+++ b/basegfx/source/polygon/b2dpolypolygon.cxx
@@ -113,31 +113,26 @@ public:
 
     void flip()
     {
-        std::for_each( maPolygons.begin(),
-                       maPolygons.end(),
-                       std::mem_fun_ref( &basegfx::B2DPolygon::flip ));
+        for (auto& aPolygon : maPolygons)
+            aPolygon.flip();
     }
 
     void removeDoublePoints()
     {
-        std::for_each( maPolygons.begin(),
-                       maPolygons.end(),
-                       std::mem_fun_ref( &basegfx::B2DPolygon::removeDoublePoints ));
+        for (auto& aPolygon : maPolygons)
+            aPolygon.removeDoublePoints();
     }
 
     void transform(const basegfx::B2DHomMatrix& rMatrix)
     {
-        for(size_t a(0L); a < maPolygons.size(); a++)
-        {
-            maPolygons[a].transform(rMatrix);
-        }
+        for (auto& aPolygon : maPolygons)
+            aPolygon.transform(rMatrix);
     }
 
     void makeUnique()
     {
-        std::for_each( maPolygons.begin(),
-                       maPolygons.end(),
-                       std::mem_fun_ref( &basegfx::B2DPolygon::makeUnique ));
+        for (auto& aPolygon : maPolygons)
+            aPolygon.makeUnique();
     }
 
     const basegfx::B2DPolygon* begin() const
diff --git a/basegfx/source/polygon/b3dpolypolygon.cxx b/basegfx/source/polygon/b3dpolypolygon.cxx
index 3c6e672..98bc7ca 100644
--- a/basegfx/source/polygon/b3dpolypolygon.cxx
+++ b/basegfx/source/polygon/b3dpolypolygon.cxx
@@ -107,64 +107,50 @@ public:
 
     void flip()
     {
-        std::for_each( maPolygons.begin(),
-                       maPolygons.end(),
-                       std::mem_fun_ref( &::basegfx::B3DPolygon::flip ));
+        for (auto& aPolygon : maPolygons)
+            aPolygon.flip();
     }
 
     void removeDoublePoints()
     {
-        std::for_each( maPolygons.begin(),
-                       maPolygons.end(),
-                       std::mem_fun_ref( &::basegfx::B3DPolygon::removeDoublePoints ));
+        for (auto& aPolygon : maPolygons)
+            aPolygon.removeDoublePoints();
     }
 
     void transform(const ::basegfx::B3DHomMatrix& rMatrix)
     {
-        for(size_t a(0L); a < maPolygons.size(); a++)
-        {
-            maPolygons[a].transform(rMatrix);
-        }
+        for (auto& aPolygon : maPolygons)
+            aPolygon.transform(rMatrix);
     }
 
     void clearBColors()
     {
-        for(size_t a(0L); a < maPolygons.size(); a++)
-        {
-            maPolygons[a].clearBColors();
-        }
+        for (auto& aPolygon : maPolygons)
+            aPolygon.clearBColors();
     }
 
     void transformNormals(const ::basegfx::B3DHomMatrix& rMatrix)
     {
-        for(size_t a(0L); a < maPolygons.size(); a++)
-        {
-            maPolygons[a].transformNormals(rMatrix);
-        }
+        for (auto& aPolygon : maPolygons)
+            aPolygon.transformNormals(rMatrix);
     }
 
     void clearNormals()
     {
-        for(size_t a(0L); a < maPolygons.size(); a++)
-        {
-            maPolygons[a].clearNormals();
-        }
+        for (auto& aPolygon : maPolygons)
+            aPolygon.clearNormals();
     }
 
     void transformTextureCoordinates(const ::basegfx::B2DHomMatrix& rMatrix)
     {
-        for(size_t a(0L); a < maPolygons.size(); a++)
-        {
-            maPolygons[a].transformTextureCoordinates(rMatrix);
-        }
+        for (auto& aPolygon : maPolygons)
+            aPolygon.transformTextureCoordinates(rMatrix);
     }
 
     void clearTextureCoordinates()
     {
-        for(size_t a(0L); a < maPolygons.size(); a++)
-        {
-            maPolygons[a].clearTextureCoordinates();
-        }
+        for (auto& aPolygon : maPolygons)
+            aPolygon.clearTextureCoordinates();
     }
 
     const basegfx::B3DPolygon* begin() const
diff --git a/basegfx/source/range/b2drangeclipper.cxx b/basegfx/source/range/b2drangeclipper.cxx
index 7ddc85c..254912e 100644
--- a/basegfx/source/range/b2drangeclipper.cxx
+++ b/basegfx/source/range/b2drangeclipper.cxx
@@ -493,9 +493,8 @@ namespace basegfx
             B2DPolygon getPolygon() const
             {
                 B2DPolygon aRes;
-                std::for_each( maPoints.begin(),
-                               maPoints.end(),
-                               [&aRes](const B2DPoint& aPoint) mutable { aRes.append(aPoint, 1); });
+                for (auto const& aPoint : maPoints)
+                    aRes.append(aPoint, 1);
                 aRes.setClosed( true );
                 return aRes;
             }
@@ -897,13 +896,8 @@ namespace basegfx
             // sometimes not enough, but a usable compromise
             aPolygonPool.reserve( rRanges.size() );
 
-            std::for_each( aSweepLineEvents.begin(),
-                           aSweepLineEvents.end(),
-                           [&](SweepLineEvent& aSweepLineEvent) mutable { handleSweepLineEvent(
-                               aSweepLineEvent,
-                               aActiveEdgeList,
-                               aPolygonPool,
-                               aRes); } );
+            for (auto& aSweepLineEvent : aSweepLineEvents)
+                handleSweepLineEvent(aSweepLineEvent, aActiveEdgeList, aPolygonPool, aRes);
 
             return aRes;
         }
diff --git a/basegfx/test/boxclipper.cxx b/basegfx/test/boxclipper.cxx
index 7e0bfa5..406f6b2 100644
--- a/basegfx/test/boxclipper.cxx
+++ b/basegfx/test/boxclipper.cxx
@@ -164,10 +164,8 @@ public:
         tools::importFromSvgD(
             randomPoly,
             OUString::createFromAscii(randomSvg), false, 0);
-        std::for_each(randomPoly.begin(),
-                      randomPoly.end(),
-                      [this](const B2DPolygon& aPolygon) mutable {
-                          this->aRandomIntersections.appendElement(aPolygon.getB2DRange(), B2VectorOrientation::Negative); } );
+        for (auto const& aPolygon : randomPoly)
+            aRandomIntersections.appendElement(aPolygon.getB2DRange(), B2VectorOrientation::Negative);
 #endif
     }
 


More information about the Libreoffice-commits mailing list