diff options
| author | Marc Jeanmougin <marc@jeanmougin.fr> | 2019-01-02 09:52:13 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marc@jeanmougin.fr> | 2019-01-02 09:52:13 +0000 |
| commit | 3d15e9e5d472920043498e741c52333db2d60415 (patch) | |
| tree | 91783db00e3c6339f10465569efa2228314f0056 /src/live_effects | |
| parent | modernize loops (diff) | |
| download | inkscape-3d15e9e5d472920043498e741c52333db2d60415.tar.gz inkscape-3d15e9e5d472920043498e741c52333db2d60415.zip | |
modernize loops (2)
Diffstat (limited to 'src/live_effects')
| -rw-r--r-- | src/live_effects/lpe-embrodery-stitch-ordering.cpp | 3 | ||||
| -rw-r--r-- | src/live_effects/lpe-fill-between-many.cpp | 13 | ||||
| -rw-r--r-- | src/live_effects/lpe-perspective-envelope.cpp | 8 | ||||
| -rw-r--r-- | src/live_effects/lpe-pts2ellipse.cpp | 4 | ||||
| -rw-r--r-- | src/live_effects/lpe-rough-hatches.cpp | 8 | ||||
| -rw-r--r-- | src/live_effects/parameter/satellitesarray.cpp | 6 |
6 files changed, 20 insertions, 22 deletions
diff --git a/src/live_effects/lpe-embrodery-stitch-ordering.cpp b/src/live_effects/lpe-embrodery-stitch-ordering.cpp index 1c3548420..3858accc6 100644 --- a/src/live_effects/lpe-embrodery-stitch-ordering.cpp +++ b/src/live_effects/lpe-embrodery-stitch-ordering.cpp @@ -784,8 +784,7 @@ bool FindShortestReconnect(std::vector<OrderingSegment> &segments, std::vector<O void AssertIsTour(std::vector<OrderingGroup *> &groups, std::vector<OrderingGroupConnection *> &connections, OrderingGroupConnection *longestConnection) { for (auto & connection : connections) { - for (int i = 0; i < 2; i++) { - OrderingGroupPoint *pnt = connection->points[i]; + for (auto pnt : connection->points) { assert(pnt->connection == connection); assert(pnt->connection->points[pnt->indexInConnection] == pnt); assert(pnt->group->endpoints[pnt->indexInGroup] == pnt); diff --git a/src/live_effects/lpe-fill-between-many.cpp b/src/live_effects/lpe-fill-between-many.cpp index c5121c37a..06c25b69d 100644 --- a/src/live_effects/lpe-fill-between-many.cpp +++ b/src/live_effects/lpe-fill-between-many.cpp @@ -115,13 +115,12 @@ void LPEFillBetweenMany::doEffect (SPCurve * curve) unsigned int counter = 0; Geom::Point current = Geom::Point(); std::vector<unsigned int> done; - for (std::vector<PathAndDirectionAndVisible *>::iterator iter = linked_paths._vector.begin(); - iter != linked_paths._vector.end(); ++iter) { + for (auto & iter : linked_paths._vector) { SPObject *obj; - if ((*iter)->ref.isAttached() && (obj = (*iter)->ref.getObject()) && SP_IS_ITEM(obj) && - !(*iter)->_pathvector.empty() && (*iter)->visibled) { + if (iter->ref.isAttached() && (obj = iter->ref.getObject()) && SP_IS_ITEM(obj) && + !iter->_pathvector.empty() && iter->visibled) { Geom::Path linked_path; - if ((*iter)->_pathvector.front().closed() && linked_paths._vector.size() > 1) { + if (iter->_pathvector.front().closed() && linked_paths._vector.size() > 1) { counter++; continue; } @@ -129,8 +128,8 @@ void LPEFillBetweenMany::doEffect (SPCurve * curve) SP_ITEM(obj)->doWriteTransform(transf); } if (counter == 0) { - current = (*iter)->_pathvector.front().finalPoint(); - Geom::Path initial_path = (*iter)->_pathvector.front(); + current = iter->_pathvector.front().finalPoint(); + Geom::Path initial_path = iter->_pathvector.front(); done.push_back(0); if (close && !join) { initial_path.close(); diff --git a/src/live_effects/lpe-perspective-envelope.cpp b/src/live_effects/lpe-perspective-envelope.cpp index 6d0cd707f..541055bdb 100644 --- a/src/live_effects/lpe-perspective-envelope.cpp +++ b/src/live_effects/lpe-perspective-envelope.cpp @@ -205,8 +205,8 @@ void LPEPerspectiveEnvelope::doEffect(SPCurve *curve) } int h = 0; for(auto & i : solmatrix) { - for( int j = 0; j < 8; j++ ) { - gslSolmatrix[h] = i[j]; + for(double j : i) { + gslSolmatrix[h] = j; h++; } } @@ -221,12 +221,12 @@ void LPEPerspectiveEnvelope::doEffect(SPCurve *curve) gsl_linalg_LU_solve (&m.matrix, p, &b.vector, x); h = 0; for(auto & i : projmatrix) { - for( int j = 0; j < 3; j++ ) { + for(double & j : i) { if(h==8) { projmatrix[2][2] = 1.0; continue; } - i[j] = gsl_vector_get(x, h); + j = gsl_vector_get(x, h); h++; } } diff --git a/src/live_effects/lpe-pts2ellipse.cpp b/src/live_effects/lpe-pts2ellipse.cpp index 0d3f70314..48655b25a 100644 --- a/src/live_effects/lpe-pts2ellipse.cpp +++ b/src/live_effects/lpe-pts2ellipse.cpp @@ -265,8 +265,8 @@ LPEPts2Ellipse::doEffect_path (Geom::PathVector const & path_in) // extract first point of this path pts.push_back(pit.initialPoint()); // iterate over all curves - for (Geom::Path::const_iterator cit = pit.begin(); cit != pit.end(); ++cit) { - pts.push_back(cit->finalPoint()); + for (const auto & cit : pit) { + pts.push_back(cit.finalPoint()); } } diff --git a/src/live_effects/lpe-rough-hatches.cpp b/src/live_effects/lpe-rough-hatches.cpp index b93e0a94e..e121045f7 100644 --- a/src/live_effects/lpe-rough-hatches.cpp +++ b/src/live_effects/lpe-rough-hatches.cpp @@ -90,11 +90,11 @@ public: for (const auto & time : times){ LevelCrossings lcs; - for (unsigned j=0; j<time.size(); j++){ + for (double j : time){ LevelCrossing lc; - lc.pt = f.valueAt(time[j]); - lc.t = time[j]; - lc.sign = ( dx.valueAt(time[j])>0 ); + lc.pt = f.valueAt(j); + lc.t = j; + lc.sign = ( dx.valueAt(j)>0 ); lc.used = false; lcs.push_back(lc); } diff --git a/src/live_effects/parameter/satellitesarray.cpp b/src/live_effects/parameter/satellitesarray.cpp index a82df2d27..e2d5bb2cb 100644 --- a/src/live_effects/parameter/satellitesarray.cpp +++ b/src/live_effects/parameter/satellitesarray.cpp @@ -159,9 +159,9 @@ void SatellitesArrayParam::param_transform_multiply(Geom::Affine const &postmul, if (prefs->getBool("/options/transform/rectcorners", true)) { for (auto & i : _vector) { - for (size_t j = 0; j < i.size(); ++j) { - if (!i[j].is_time && i[j].amount > 0) { - i[j].amount = i[j].amount * ((postmul.expansionX() + postmul.expansionY()) / 2); + for (auto & j : i) { + if (!j.is_time && j.amount > 0) { + j.amount = j.amount * ((postmul.expansionX() + postmul.expansionY()) / 2); } } } |
