diff options
| author | Jabiertxof <jtx@jtx> | 2017-01-20 18:07:28 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx> | 2017-01-20 18:07:28 +0000 |
| commit | 8884e1097b5b5c11d9653ff1c9e4d9148fa579dd (patch) | |
| tree | 7d816f8b3934062c587b7de985bd51891d9cd9f0 | |
| parent | Fix bug 1657591. Crash on ungrouping in v0.92. A unnecesary call to update pa... (diff) | |
| download | inkscape-8884e1097b5b5c11d9653ff1c9e4d9148fa579dd.tar.gz inkscape-8884e1097b5b5c11d9653ff1c9e4d9148fa579dd.zip | |
Fix bug 1622388. Insane memory leak and crash with pattern along path
Fixed bugs:
- https://launchpad.net/bugs/1622388
(bzr r15425)
| -rw-r--r-- | src/live_effects/lpe-patternalongpath.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/live_effects/lpe-patternalongpath.cpp b/src/live_effects/lpe-patternalongpath.cpp index f404afe17..966e9020e 100644 --- a/src/live_effects/lpe-patternalongpath.cpp +++ b/src/live_effects/lpe-patternalongpath.cpp @@ -11,6 +11,7 @@ #include <2geom/bezier-to-sbasis.h> #include "knotholder.h" +#include <cmath> #include <algorithm> // TODO due to internal breakage in glibmm headers, this must be last: #include <glibmm/i18n.h> @@ -161,7 +162,7 @@ LPEPatternAlongPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > con // spacing.param_set_range(-pattBndsX.extent()*.9, Geom::infinity()); // } - y0+=noffset; + y0 += noffset; std::vector<Geom::Piecewise<Geom::D2<Geom::SBasis> > > paths_in; paths_in = split_at_discontinuities(pwd2_in); @@ -197,7 +198,7 @@ LPEPatternAlongPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > con case PAPCT_REPEATED_STRETCHED: // if uskeleton is closed: - if(path_i.segs.front().at0() == path_i.segs.back().at1()){ + if (are_near(path_i.segs.front().at0(), path_i.segs.back().at1())){ nbCopies = std::max(1, static_cast<int>(std::floor((uskeleton.domain().extent() - toffset)/(pattBndsX->extent()+xspace)))); pattBndsX = Interval(pattBndsX->min(),pattBndsX->max()+xspace); scaling = (uskeleton.domain().extent() - toffset)/(((double)nbCopies)*pattBndsX->extent()); @@ -213,11 +214,13 @@ LPEPatternAlongPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > con return pwd2_in; }; + //Ceil to 6 decimals + scaling = ceil(scaling * 1000000) / 1000000; double pattWidth = pattBndsX->extent() * scaling; - x*=scaling; + x *= scaling; if ( scale_y_rel.get_value() ) { - y*=(scaling * prop_scale); + y *= prop_scale * scaling; } else { y *= prop_scale; } @@ -235,7 +238,7 @@ LPEPatternAlongPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > con offs+=pattWidth; } } - if (fuse_tolerance > 0){ + if (fuse_tolerance > 0){ pre_output = fuse_nearby_ends(pre_output, fuse_tolerance); for (unsigned i=0; i<pre_output.size(); i++){ output.concat(pre_output[i]); |
