diff options
| author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2018-06-18 19:48:07 +0000 |
|---|---|---|
| committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2018-06-18 19:48:07 +0000 |
| commit | fcf93adf1e766fbc69b05e598ee0aeb9b36b1c70 (patch) | |
| tree | 724178e38d88307e7b4129479006dc2ec122c410 /src/live_effects | |
| parent | Run clang-tidy’s modernize-use-noexcept pass. (diff) | |
| download | inkscape-fcf93adf1e766fbc69b05e598ee0aeb9b36b1c70.tar.gz inkscape-fcf93adf1e766fbc69b05e598ee0aeb9b36b1c70.zip | |
Run clang-tidy’s modernize-use-emplace pass.
This reduces the boilerplate required to add a new element to a
container.
Diffstat (limited to 'src/live_effects')
| -rw-r--r-- | src/live_effects/lpe-embrodery-stitch-ordering.cpp | 2 | ||||
| -rw-r--r-- | src/live_effects/lpe-knot.cpp | 2 | ||||
| -rw-r--r-- | src/live_effects/lpe-measure-segments.cpp | 10 | ||||
| -rw-r--r-- | src/live_effects/lpe-powerstroke.cpp | 16 | ||||
| -rw-r--r-- | src/live_effects/parameter/powerstrokepointarray.cpp | 4 |
5 files changed, 17 insertions, 17 deletions
diff --git a/src/live_effects/lpe-embrodery-stitch-ordering.cpp b/src/live_effects/lpe-embrodery-stitch-ordering.cpp index 86abf2d68..7cd69e1b6 100644 --- a/src/live_effects/lpe-embrodery-stitch-ordering.cpp +++ b/src/live_effects/lpe-embrodery-stitch-ordering.cpp @@ -543,7 +543,7 @@ void OrderingGroup::AddNeighbors(OrderingGroup *nghb) { for (int iThis = 0; iThis < nEndPoints; iThis++) { for (int iNghb = 0; iNghb < nghb->nEndPoints; iNghb++) { - endpoints[iThis]->nearest.push_back(OrderingGroupNeighbor(endpoints[iThis], nghb->endpoints[iNghb])); + endpoints[iThis]->nearest.emplace_back(endpoints[iThis], nghb->endpoints[iNghb]); } } } diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp index 3640e8e43..07a6dc8fb 100644 --- a/src/live_effects/lpe-knot.cpp +++ b/src/live_effects/lpe-knot.cpp @@ -406,7 +406,7 @@ LPEKnot::doEffect_path (Geom::PathVector const &path_in) if (i0 == gpaths.size() ) {THROW_EXCEPTION("lpe-knot error: group member not recognized");}// this should not happen... std::vector<Interval> dom; - dom.push_back(Interval(0., size_nondegenerate(gpaths[i0]))); + dom.emplace_back(0., size_nondegenerate(gpaths[i0])); for (unsigned p = 0; p < crossing_points.size(); p++){ if ( (crossing_points[p].i == i0) || (crossing_points[p].j == i0) ) { unsigned i = crossing_points[p].i; diff --git a/src/live_effects/lpe-measure-segments.cpp b/src/live_effects/lpe-measure-segments.cpp index fd016f24c..f92e14b4a 100644 --- a/src/live_effects/lpe-measure-segments.cpp +++ b/src/live_effects/lpe-measure-segments.cpp @@ -882,7 +882,7 @@ LPEMeasureSegments::doBeforeEffect (SPLPEItem const* lpeitem) Geom::Point point = (*iter); double dproj = Inkscape::Util::Quantity::convert(distance_projection, display_unit.c_str(), unit.get_abbreviation()); Geom::Coord xpos = maxdistance + dproj; - result.push_back(Geom::Point(xpos, point[Geom::Y])); + result.emplace_back(xpos, point[Geom::Y]); } std::sort (result.begin(), result.end(), sortPoints); Geom::Path path; @@ -1083,11 +1083,11 @@ LPEMeasureSegments::doBeforeEffect (SPLPEItem const* lpeitem) items.push_back(texton); if (!hide_arrows) { if (arrows_outside) { - items.push_back(Glib::ustring("ArrowDINout-start")); - items.push_back(Glib::ustring("ArrowDINout-end")); + items.emplace_back("ArrowDINout-start"); + items.emplace_back("ArrowDINout-end"); } else { - items.push_back(Glib::ustring("ArrowDIN-start")); - items.push_back(Glib::ustring("ArrowDIN-end")); + items.emplace_back("ArrowDIN-start"); + items.emplace_back("ArrowDIN-end"); } } if (((Geom::are_near(prev, prev_stored, 0.01) && Geom::are_near(next, next_stored, 0.01)) || diff --git a/src/live_effects/lpe-powerstroke.cpp b/src/live_effects/lpe-powerstroke.cpp index 32f9a6b82..c20476922 100644 --- a/src/live_effects/lpe-powerstroke.cpp +++ b/src/live_effects/lpe-powerstroke.cpp @@ -245,18 +245,18 @@ LPEPowerStroke::doOnApply(SPLPEItem const* lpeitem) item->updateRepr(); if (pathv.empty()) { - points.push_back( Geom::Point(0.2,width) ); - points.push_back( Geom::Point(0.5,width) ); - points.push_back( Geom::Point(0.8,width) ); + points.emplace_back(0.2,width ); + points.emplace_back(0.5,width ); + points.emplace_back(0.8,width ); } else { Geom::Path const &path = pathv.front(); Geom::Path::size_type const size = path.size_default(); if (!path.closed()) { - points.push_back( Geom::Point(0.2,width) ); + points.emplace_back(0.2,width ); } - points.push_back( Geom::Point(0.5*size,width) ); + points.emplace_back(0.5*size,width ); if (!path.closed()) { - points.push_back( Geom::Point(size - 0.2,width) ); + points.emplace_back(size - 0.2,width ); } } offset_points.set_scale_width(scale_width); @@ -631,8 +631,8 @@ LPEPowerStroke::doEffect_path (Geom::PathVector const & path_in) // depending on cap type, these first and last points have width zero or take the width from the closest width point. ts.insert(ts.begin(), Point( pwd2_in.domain().min(), (start_linecap==LINECAP_ZERO_WIDTH) ? 0. : ts.front()[Geom::Y]) ); - ts.push_back( Point( pwd2_in.domain().max(), - (end_linecap==LINECAP_ZERO_WIDTH) ? 0. : ts.back()[Geom::Y]) ); + ts.emplace_back( pwd2_in.domain().max(), + (end_linecap==LINECAP_ZERO_WIDTH) ? 0. : ts.back()[Geom::Y] ); } // do the interpolation in a coordinate system that is more alike to the on-canvas knots, diff --git a/src/live_effects/parameter/powerstrokepointarray.cpp b/src/live_effects/parameter/powerstrokepointarray.cpp index 12f72a143..4afe35e47 100644 --- a/src/live_effects/parameter/powerstrokepointarray.cpp +++ b/src/live_effects/parameter/powerstrokepointarray.cpp @@ -54,7 +54,7 @@ void PowerStrokePointArrayParam::param_transform_multiply(Geom::Affine const &po { // scale each width knot with the average scaling in X and Y Geom::Coord const A = (*point_it)[Geom::Y] * ((postmul.expansionX() + postmul.expansionY()) / 2); - result.push_back(Geom::Point((*point_it)[Geom::X], A)); + result.emplace_back((*point_it)[Geom::X], A); } param_set_and_write_new_value(result); } @@ -98,7 +98,7 @@ PowerStrokePointArrayParam::reverse_controlpoints(bool write) for (unsigned int i = 0; i < _vector.size(); ++i) { Geom::Point control_pos = last_pwd2.valueAt(_vector[i][Geom::X]); double new_pos = Geom::nearest_time(control_pos, pwd2_in_reverse); - controlpoints.push_back(Geom::Point(new_pos,_vector[i][Geom::Y])); + controlpoints.emplace_back(new_pos,_vector[i][Geom::Y]); _vector[i][Geom::X] = new_pos; } if (write) { |
