From 1c5f5f06cff3fd162208e4e59c3b937cc7790f04 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Fri, 9 Sep 2016 14:09:07 +0200 Subject: Fix bug: #1621213 in Pattern Along Path LPE Fixed bugs: - https://launchpad.net/bugs/1621213 (bzr r15110) --- src/live_effects/lpe-patternalongpath.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/live_effects/lpe-patternalongpath.cpp b/src/live_effects/lpe-patternalongpath.cpp index 0814ce0da..f90ac2b70 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 using std::vector; @@ -195,12 +196,12 @@ LPEPatternAlongPath::doEffect_pwd2 (Geom::Piecewise > con case PAPCT_REPEATED_STRETCHED: // if uskeleton is closed: if(path_i.segs.front().at0() == path_i.segs.back().at1()){ - nbCopies = static_cast(std::floor((uskeleton.domain().extent() - toffset)/(pattBndsX->extent()+xspace))); + nbCopies = std::max(1, static_cast(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()); // if not closed: no space at the end }else{ - nbCopies = static_cast(std::floor((uskeleton.domain().extent() - toffset + xspace)/(pattBndsX->extent()+xspace))); + nbCopies = std::max(1, static_cast(std::floor((uskeleton.domain().extent() - toffset + xspace)/(pattBndsX->extent()+xspace)))); pattBndsX = Interval(pattBndsX->min(),pattBndsX->max()+xspace); scaling = (uskeleton.domain().extent() - toffset)/(((double)nbCopies)*pattBndsX->extent() - xspace); } -- cgit v1.2.3