diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2007-09-04 18:53:01 +0000 |
|---|---|---|
| committer | johanengelen <johanengelen@users.sourceforge.net> | 2007-09-04 18:53:01 +0000 |
| commit | 7b51b20d1cccdd85e7ad54100fbae1dc755185af (patch) | |
| tree | 68ccc4af1fbae73c6ebd3740f08d8ea8e20df1c4 /src/live_effects/effect.cpp | |
| parent | Updated to match API changes in style.h (diff) | |
| download | inkscape-7b51b20d1cccdd85e7ad54100fbae1dc755185af.tar.gz inkscape-7b51b20d1cccdd85e7ad54100fbae1dc755185af.zip | |
LPE: add Paste LPE verb + menu item. add scale ratios to curve stitch and path-along-path. remove trailing space in verbs.cpp. Fix initialization of BoolParam
(bzr r3675)
Diffstat (limited to 'src/live_effects/effect.cpp')
| -rw-r--r-- | src/live_effects/effect.cpp | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 30a90d834..29f9cb7ef 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -25,6 +25,8 @@ #include <2geom/sbasis-to-bezier.h>
#include <gtkmm.h>
+#include <exception>
+
// include effects:
#include "live_effects/lpe-skeletalstrokes.h"
#include "live_effects/lpe-slant.h"
@@ -114,7 +116,7 @@ Effect::doEffect (SPCurve * curve) {
NArtBpath *new_bpath = doEffect(SP_CURVE_BPATH(curve));
- if (new_bpath) { // FIXME, add function to SPCurve to change bpath? or a copy function?
+ if (new_bpath && new_bpath != SP_CURVE_BPATH(curve)) { // FIXME, add function to SPCurve to change bpath? or a copy function?
if (curve->_bpath) {
g_free(curve->_bpath); //delete old bpath
}
@@ -125,13 +127,30 @@ Effect::doEffect (SPCurve * curve) NArtBpath *
Effect::doEffect (NArtBpath * path_in)
{
- std::vector<Geom::Path> orig_pathv = BPath_to_2GeomPath(path_in);
+ try {
+ std::vector<Geom::Path> orig_pathv = BPath_to_2GeomPath(path_in);
- std::vector<Geom::Path> result_pathv = doEffect(orig_pathv);
+ std::vector<Geom::Path> result_pathv = doEffect(orig_pathv);
- NArtBpath *new_bpath = BPath_from_2GeomPath(result_pathv);
+ NArtBpath *new_bpath = BPath_from_2GeomPath(result_pathv);
- return new_bpath;
+ return new_bpath;
+ }
+ catch (std::exception e) {
+ g_warning("An exception occurred during execution of an LPE - %s", e.what());
+ // return here
+ NArtBpath *path_out;
+
+ unsigned ret = 0;
+ while ( path_in[ret].code != NR_END ) {
+ ++ret;
+ }
+ unsigned len = ++ret;
+
+ path_out = g_new(NArtBpath, len);
+ memcpy(path_out, path_in, len * sizeof(NArtBpath));
+ return path_out;
+ }
}
std::vector<Geom::Path>
|
