summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJosh Andler <scislac@gmail.com>2009-10-14 21:53:02 +0000
committerscislac <scislac@users.sourceforge.net>2009-10-14 21:53:02 +0000
commitec444a1a2619f5b984170583e42c2980afe787e9 (patch)
tree2d73b1852064b47d7320220a6deb285025db8bb6 /src
parentFrench translation update. (diff)
downloadinkscape-ec444a1a2619f5b984170583e42c2980afe787e9.tar.gz
inkscape-ec444a1a2619f5b984170583e42c2980afe787e9.zip
Patch by Tavmjong for 451588
(bzr r8771)
Diffstat (limited to 'src')
-rw-r--r--src/extension/internal/pov-out.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/extension/internal/pov-out.cpp b/src/extension/internal/pov-out.cpp
index f30cbc317..f8916655d 100644
--- a/src/extension/internal/pov-out.cpp
+++ b/src/extension/internal/pov-out.cpp
@@ -306,10 +306,12 @@ bool PovOutput::doCurve(SPItem *item, const String &id)
//Count the NR_CURVETOs/LINETOs (including closing line segment)
int segmentCount = 0;
for(Geom::PathVector::const_iterator it = pathv.begin(); it != pathv.end(); ++it)
- {
+ {
segmentCount += (*it).size();
- if (it->closed())
- segmentCount += 1;
+
+ // If segment not closed, add space for a closing segment.
+ if (!it->closed()) segmentCount += 1;
+
}
out("/*###################################################\n");
@@ -340,10 +342,14 @@ bool PovOutput::doCurve(SPItem *item, const String &id)
cminmax.expandTo(pit->initialPoint());
/**
- * For all segments in the subpath
+ * For all segments in the subpath, including extra closing segment defined by 2geom
*/
for (Geom::Path::const_iterator cit = pit->begin(); cit != pit->end_closed(); ++cit)
- {
+ {
+
+ // If path is closed, we don't need extra closing segment.
+ if( pit->closed() && cit == pit->end() )
+ continue;
if( is_straight_curve(*cit) )
{
@@ -374,6 +380,11 @@ bool PovOutput::doCurve(SPItem *item, const String &id)
out(",\n");
else
out("\n");
+ if (segmentNr > segmentCount)
+ {
+ err("Too many segments");
+ return false;
+ }
cminmax.expandTo(cit->finalPoint());