diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2009-01-27 17:12:48 +0000 |
|---|---|---|
| committer | johanengelen <johanengelen@users.sourceforge.net> | 2009-01-27 17:12:48 +0000 |
| commit | d21a2344567098ed042b414254836f99a2572f66 (patch) | |
| tree | 0287b020ac008e3037b8e2b8c71b2e8bf7c933f1 /src/pencil-context.cpp | |
| parent | fix crash when drawing very quickly while still loading inkscape. (diff) | |
| download | inkscape-d21a2344567098ed042b414254836f99a2572f66.tar.gz inkscape-d21a2344567098ed042b414254836f99a2572f66.zip | |
simplify sketch result to fix crash
(bzr r7191)
Diffstat (limited to 'src/pencil-context.cpp')
| -rw-r--r-- | src/pencil-context.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/pencil-context.cpp b/src/pencil-context.cpp index a29e13e22..de286ea5a 100644 --- a/src/pencil-context.cpp +++ b/src/pencil-context.cpp @@ -42,6 +42,7 @@ #include "desktop-style.h" #include "macros.h" #include "display/curve.h" +#include "livarot/Path.h" static void sp_pencil_context_class_init(SPPencilContextClass *klass); static void sp_pencil_context_init(SPPencilContext *pc); @@ -824,6 +825,14 @@ sketch_interpolate(SPPencilContext *pc) t = 0.5; } pc->sketch_interpolation = Geom::lerp(t, fit_pwd2, pc->sketch_interpolation); + // simplify path, to eliminate small segments + Path *path = new Path; + path->LoadPathVector(Geom::path_from_piecewise(pc->sketch_interpolation, 0.01)); + path->Simplify(0.5); + Geom::PathVector *pathv = path->MakePathVector(); + pc->sketch_interpolation = (*pathv)[0].toPwSb(); + delete path; + delete pathv; } else { pc->sketch_interpolation = fit_pwd2; } |
