diff options
Diffstat (limited to 'src/live_effects/lpe-spiro.cpp')
| -rw-r--r-- | src/live_effects/lpe-spiro.cpp | 85 |
1 files changed, 2 insertions, 83 deletions
diff --git a/src/live_effects/lpe-spiro.cpp b/src/live_effects/lpe-spiro.cpp index 22974fe13..8b4274ab2 100644 --- a/src/live_effects/lpe-spiro.cpp +++ b/src/live_effects/lpe-spiro.cpp @@ -15,8 +15,6 @@ #include "helper/geom-nodetype.h" #include "helper/geom-curves.h" -#include "live_effects/bezctx.h" -#include "live_effects/bezctx_intf.h" #include "live_effects/spiro.h" // For handling un-continuous paths: @@ -24,82 +22,6 @@ #include "inkscape.h" #include "desktop.h" -#define SPIRO_SHOW_INFINITE_COORDINATE_CALLS - -typedef struct { - bezctx base; - SPCurve *curve; - int is_open; -} bezctx_ink; - -void bezctx_ink_moveto(bezctx *bc, double x, double y, int /*is_open*/) -{ - bezctx_ink *bi = (bezctx_ink *) bc; - if ( IS_FINITE(x) && IS_FINITE(y) ) { - bi->curve->moveto(x, y); - } -#ifdef SPIRO_SHOW_INFINITE_COORDINATE_CALLS - else { - g_message("lpe moveto not finite"); - } -#endif -} - -void bezctx_ink_lineto(bezctx *bc, double x, double y) -{ - bezctx_ink *bi = (bezctx_ink *) bc; - if ( IS_FINITE(x) && IS_FINITE(y) ) { - bi->curve->lineto(x, y); - } -#ifdef SPIRO_SHOW_INFINITE_COORDINATE_CALLS - else { - g_message("lpe lineto not finite"); - } -#endif -} - -void bezctx_ink_quadto(bezctx *bc, double xm, double ym, double x3, double y3) -{ - bezctx_ink *bi = (bezctx_ink *) bc; - - if ( IS_FINITE(xm) && IS_FINITE(ym) && IS_FINITE(x3) && IS_FINITE(y3) ) { - bi->curve->quadto(xm, ym, x3, y3); - } -#ifdef SPIRO_SHOW_INFINITE_COORDINATE_CALLS - else { - g_message("lpe quadto not finite"); - } -#endif -} - -void bezctx_ink_curveto(bezctx *bc, double x1, double y1, double x2, double y2, - double x3, double y3) -{ - bezctx_ink *bi = (bezctx_ink *) bc; - if ( IS_FINITE(x1) && IS_FINITE(y1) && IS_FINITE(x2) && IS_FINITE(y2) ) { - bi->curve->curveto(x1, y1, x2, y2, x3, y3); - } -#ifdef SPIRO_SHOW_INFINITE_COORDINATE_CALLS - else { - g_message("lpe curveto not finite"); - } -#endif -} - -bezctx * -new_bezctx_ink(SPCurve *curve) { - bezctx_ink *result = g_new(bezctx_ink, 1); - result->base.moveto = bezctx_ink_moveto; - result->base.lineto = bezctx_ink_lineto; - result->base.quadto = bezctx_ink_quadto; - result->base.curveto = bezctx_ink_curveto; - result->base.mark_knot = NULL; - result->curve = curve; - return &result->base; -} - - - namespace Inkscape { namespace LivePathEffect { @@ -124,8 +46,7 @@ LPESpiro::doEffect(SPCurve * curve) guint len = curve->get_segment_count() + 2; curve->reset(); - bezctx *bc = new_bezctx_ink(curve); - spiro_cp *path = g_new (spiro_cp, len); + Spiro::spiro_cp *path = g_new (Spiro::spiro_cp, len); int ip = 0; for(Geom::PathVector::const_iterator path_it = original_pathv.begin(); path_it != original_pathv.end(); ++path_it) { @@ -218,9 +139,7 @@ LPESpiro::doEffect(SPCurve * curve) // run subpath through spiro int sp_len = ip; - spiro_seg *s = run_spiro(path, sp_len); - spiro_to_bpath(s, sp_len, bc); - free(s); + Spiro::spiro_run(path, sp_len, *curve); ip = 0; } |
