summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2016-09-09 12:09:07 +0000
committerjabiertxof <info@marker.es>2016-09-09 12:09:07 +0000
commit1c5f5f06cff3fd162208e4e59c3b937cc7790f04 (patch)
tree36c01dc95ad6fa0219ba75d58bea540132b08b3a /src
parentImprove font editing dialog. (diff)
downloadinkscape-1c5f5f06cff3fd162208e4e59c3b937cc7790f04.tar.gz
inkscape-1c5f5f06cff3fd162208e4e59c3b937cc7790f04.zip
Fix bug: #1621213 in Pattern Along Path LPE
Fixed bugs: - https://launchpad.net/bugs/1621213 (bzr r15110)
Diffstat (limited to 'src')
-rw-r--r--src/live_effects/lpe-patternalongpath.cpp5
1 files changed, 3 insertions, 2 deletions
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 <algorithm>
using std::vector;
@@ -195,12 +196,12 @@ 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()){
- nbCopies = static_cast<int>(std::floor((uskeleton.domain().extent() - toffset)/(pattBndsX->extent()+xspace)));
+ 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());
// if not closed: no space at the end
}else{
- nbCopies = static_cast<int>(std::floor((uskeleton.domain().extent() - toffset + xspace)/(pattBndsX->extent()+xspace)));
+ nbCopies = std::max(1, static_cast<int>(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);
}