summaryrefslogtreecommitdiffstats
path: root/src/live_effects
diff options
context:
space:
mode:
authorsu_v <suv-sf@users.sourceforge.net>2014-07-19 21:22:12 +0000
committer~suv <suv-sf@users.sourceforge.net>2014-07-19 21:22:12 +0000
commitdb8282d8518263885625d9c19aefad1bdbb175d4 (patch)
tree911a397de0ac4588c2475e6bc3d9310ad3e92d2a /src/live_effects
parentupdate to trunk (r13425) (diff)
parentWarnings cleaup. (diff)
downloadinkscape-db8282d8518263885625d9c19aefad1bdbb175d4.tar.gz
inkscape-db8282d8518263885625d9c19aefad1bdbb175d4.zip
update to trunk (r13454)
(bzr r13398.1.4)
Diffstat (limited to 'src/live_effects')
-rw-r--r--src/live_effects/lpe-knot.cpp24
-rw-r--r--src/live_effects/lpe-knot.h1
-rw-r--r--src/live_effects/parameter/powerstrokepointarray.cpp5
3 files changed, 17 insertions, 13 deletions
diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp
index 581c632f5..cac3a9347 100644
--- a/src/live_effects/lpe-knot.cpp
+++ b/src/live_effects/lpe-knot.cpp
@@ -353,7 +353,11 @@ LPEKnot::LPEKnot(LivePathEffectObject *lpeobject) :
add_other_stroke_width(_("_Crossing path stroke width"), _("Add crossed stroke width to the interruption size"), "add_other_stroke_width", &wr, this, true),
switcher_size(_("S_witcher size:"), _("Orientation indicator/switcher size"), "switcher_size", &wr, this, 15),
crossing_points_vector(_("Crossing Signs"), _("Crossings signs"), "crossing_points_vector", &wr, this),
- gpaths(),gstroke_widths()
+ crossing_points(),
+ gpaths(),
+ gstroke_widths(),
+ selectedCrossing(0),
+ switcher(0.,0.)
{
// register all your parameters here, so Inkscape knows which parameters this effect has:
registerParameter( dynamic_cast<Parameter *>(&interruption_width) );
@@ -363,10 +367,6 @@ LPEKnot::LPEKnot(LivePathEffectObject *lpeobject) :
registerParameter( dynamic_cast<Parameter *>(&switcher_size) );
registerParameter( dynamic_cast<Parameter *>(&crossing_points_vector) );
- crossing_points = LPEKnotNS::CrossingPoints();
- selectedCrossing = 0;
- switcher = Geom::Point(0,0);
-
_provides_knotholder_entities = true;
}
@@ -386,9 +386,7 @@ LPEKnot::updateSwitcher(){
//std::cout<<"placing switcher at "<<switcher<<" \n";
}else{
//std::cout<<"hiding switcher!\n";
- //TODO: is there a way to properly hide the helper.
- //switcher = Geom::Point(Geom::infinity(),Geom::infinity());
- switcher = Geom::Point(1e10,1e10);
+ switcher = Geom::Point(Geom::infinity(),Geom::infinity());
}
}
@@ -539,8 +537,9 @@ LPEKnot::doBeforeEffect (SPLPEItem const* lpeitem)
using namespace Geom;
original_bbox(lpeitem);
- gpaths = std::vector<Geom::Path>();
- gstroke_widths = std::vector<double>();
+ gpaths.clear();
+ gstroke_widths.clear();
+
collectPathsAndWidths(lpeitem, gpaths, gstroke_widths);
// std::cout<<"\nPaths on input:\n";
@@ -586,7 +585,10 @@ LPEKnot::doBeforeEffect (SPLPEItem const* lpeitem)
// std::cout<<crossing_points[toto].sign<<"),";
// }
crossing_points.inherit_signs(old_crdata);
- crossing_points_vector.param_set_and_write_new_value(crossing_points.to_vector());
+
+ // Don't write to XML here, only store it in the param itself. Will be written to SVG later
+ crossing_points_vector.param_setValue(crossing_points.to_vector());
+
updateSwitcher();
}
diff --git a/src/live_effects/lpe-knot.h b/src/live_effects/lpe-knot.h
index b937f9021..f926bf085 100644
--- a/src/live_effects/lpe-knot.h
+++ b/src/live_effects/lpe-knot.h
@@ -74,7 +74,6 @@ private:
BoolParam add_stroke_width;
BoolParam add_other_stroke_width;
ScalarParam switcher_size;
- double stroke_width;
ArrayParam<double> crossing_points_vector;//svg storage of crossing_points
LPEKnotNS::CrossingPoints crossing_points;//topology representation of the knot.
diff --git a/src/live_effects/parameter/powerstrokepointarray.cpp b/src/live_effects/parameter/powerstrokepointarray.cpp
index fecdfeda8..647986da6 100644
--- a/src/live_effects/parameter/powerstrokepointarray.cpp
+++ b/src/live_effects/parameter/powerstrokepointarray.cpp
@@ -176,7 +176,10 @@ PowerStrokePointArrayParamKnotHolderEntity::knot_get() const
Piecewise<D2<SBasis> > const & n = _pparam->get_pwd2_normal();
Point offset_point = _pparam->_vector.at(_index);
-
+ if (offset_point[X] > pwd2.size() || offset_point[X] < 0) {
+ g_warning("Broken powerstroke point at %f, I won't try to add that", offset_point[X]);
+ return Geom::Point(infinity(), infinity());
+ }
Point canvas_point = pwd2.valueAt(offset_point[X]) + offset_point[Y] * n.valueAt(offset_point[X]);
return canvas_point;
}