diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2008-06-14 16:54:35 +0000 |
|---|---|---|
| committer | johanengelen <johanengelen@users.sourceforge.net> | 2008-06-14 16:54:35 +0000 |
| commit | f8d289fa1bb52dbb1b442ad2084f705523aefa79 (patch) | |
| tree | 7a0fe991852c11c04e5178fb9840715507df7675 /src | |
| parent | put exception catch block around all doEffect calls. (so in SP_LPE_ITEM) (diff) | |
| download | inkscape-f8d289fa1bb52dbb1b442ad2084f705523aefa79.tar.gz inkscape-f8d289fa1bb52dbb1b442ad2084f705523aefa79.zip | |
catch cases where LPE Spiro generates non-continuous paths
(bzr r5939)
Diffstat (limited to 'src')
| -rw-r--r-- | src/live_effects/lpe-spiro.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/live_effects/lpe-spiro.cpp b/src/live_effects/lpe-spiro.cpp index e43efc01a..6c3b71af4 100644 --- a/src/live_effects/lpe-spiro.cpp +++ b/src/live_effects/lpe-spiro.cpp @@ -13,6 +13,13 @@ #include "live_effects/bezctx_intf.h" #include "live_effects/spiro.h" +// For handling un-continuous paths: +#include <2geom/pathvector.h> +#include <2geom/matrix.h> +#include "message-stack.h" +#include "inkscape.h" +#include "desktop.h" + typedef struct { bezctx base; SPCurve *curve; @@ -94,6 +101,8 @@ LPESpiro::setup_nodepath(Inkscape::NodePath::Path *np) void LPESpiro::doEffect(SPCurve * curve) { + Geom::PathVector original_pathv = curve->get_pathvector(); + SPCurve *csrc = curve->copy(); curve->reset(); bezctx *bc = new_bezctx_ink(curve); @@ -192,6 +201,18 @@ LPESpiro::doEffect(SPCurve * curve) ib++; } g_free (path); + + // FIXME: refactor the spiro code such that it cannot generate non-continous paths! + // sometimes, the code above generates a path that is not continuous. if so, undo the effect by resetting the original path. + try { + curve->get_pathvector() * Geom::identity(); // tests for continuity, this makes LPE Spiro slower of course :-( + } + catch (std::exception & e) { + g_warning("Exception during LPE Spiro execution. \n %s", e.what()); + SP_ACTIVE_DESKTOP->messageStack()->flash( Inkscape::WARNING_MESSAGE, + _("An exception occurred during execution of the Spiro Path Effect.") ); + curve->set_pathv(original_pathv); + } } }; //namespace LivePathEffect |
