summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2012-03-23 19:44:33 +0000
committerJohan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl>2012-03-23 19:44:33 +0000
commitbe2093259f84b6ae9095b99e020c6fc5f2aec45d (patch)
treed295d9cb508bb429a11a3e588cc3648cf9b83d10 /src
parentclean up spiro code (diff)
downloadinkscape-be2093259f84b6ae9095b99e020c6fc5f2aec45d.tar.gz
inkscape-be2093259f84b6ae9095b99e020c6fc5f2aec45d.zip
more spiro cleanup
(bzr r11122)
Diffstat (limited to 'src')
-rw-r--r--src/live_effects/CMakeLists.txt2
-rw-r--r--src/live_effects/Makefile_insert2
-rw-r--r--src/live_effects/bezctx.cpp48
-rw-r--r--src/live_effects/bezctx.h6
-rw-r--r--src/live_effects/bezctx_intf.h25
-rw-r--r--src/live_effects/lpe-powerstroke-interpolators.h1
-rw-r--r--src/live_effects/spiro.cpp9
7 files changed, 6 insertions, 87 deletions
diff --git a/src/live_effects/CMakeLists.txt b/src/live_effects/CMakeLists.txt
index e066e7f43..f2e10c771 100644
--- a/src/live_effects/CMakeLists.txt
+++ b/src/live_effects/CMakeLists.txt
@@ -1,6 +1,5 @@
set(live_effects_SRC
- bezctx.cpp
effect.cpp
lpe-angle_bisector.cpp
lpe-bendpath.cpp
@@ -59,7 +58,6 @@ set(live_effects_SRC
# -------
# Headers
bezctx.h
- bezctx_intf.h
effect-enum.h
effect.h
lpe-angle_bisector.h
diff --git a/src/live_effects/Makefile_insert b/src/live_effects/Makefile_insert
index 74356f563..65a934c9c 100644
--- a/src/live_effects/Makefile_insert
+++ b/src/live_effects/Makefile_insert
@@ -51,8 +51,6 @@ ink_common_sources += \
live_effects/spiro.h \
live_effects/spiro.cpp \
live_effects/bezctx.h \
- live_effects/bezctx_intf.h \
- live_effects/bezctx.cpp \
live_effects/lpe-circle_with_radius.cpp \
live_effects/lpe-circle_with_radius.h \
live_effects/lpe-perspective_path.cpp \
diff --git a/src/live_effects/bezctx.cpp b/src/live_effects/bezctx.cpp
deleted file mode 100644
index 722f5dbaf..000000000
--- a/src/live_effects/bezctx.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
-ppedit - A pattern plate editor for Spiro splines.
-Copyright (C) 2007 Raph Levien
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301, USA.
-
-*/
-#include "bezctx.h"
-
-void bezctx_moveto(bezctx *bc, double x, double y, int is_open)
-{
- bc->moveto(bc, x, y, is_open);
-}
-
-void bezctx_lineto(bezctx *bc, double x, double y)
-{
- bc->lineto(bc, x, y);
-}
-
-void bezctx_quadto(bezctx *bc, double x1, double y1, double x2, double y2)
-{
- bc->quadto(bc, x1, y1, x2, y2);
-}
-
-void bezctx_curveto(bezctx *bc, double x1, double y1, double x2, double y2,
- double x3, double y3)
-{
- bc->curveto(bc, x1, y1, x2, y2, x3, y3);
-}
-
-void bezctx_mark_knot(bezctx *bc, int knot_idx)
-{
- if (bc->mark_knot)
- bc->mark_knot(bc, knot_idx);
-}
diff --git a/src/live_effects/bezctx.h b/src/live_effects/bezctx.h
index df074676e..d8eb38e8c 100644
--- a/src/live_effects/bezctx.h
+++ b/src/live_effects/bezctx.h
@@ -3,13 +3,13 @@
#include "bezctx_intf.h"
-struct _bezctx {
+class _bezctx {
+public:
void (*moveto)(bezctx *bc, double x, double y, int is_open);
void (*lineto)(bezctx *bc, double x, double y);
void (*quadto)(bezctx *bc, double x1, double y1, double x2, double y2);
void (*curveto)(bezctx *bc, double x1, double y1, double x2, double y2,
- double x3, double y3);
- void (*mark_knot)(bezctx *bc, int knot_idx);
+ double x3, double y3);
};
#endif
diff --git a/src/live_effects/bezctx_intf.h b/src/live_effects/bezctx_intf.h
deleted file mode 100644
index 05ea79a63..000000000
--- a/src/live_effects/bezctx_intf.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef INKSCAPE_SPIRO_bezctx_intf_H
-#define INKSCAPE_SPIRO_bezctx_intf_H
-
-typedef struct _bezctx bezctx;
-
-bezctx *
-new_bezctx(void);
-
-void
-bezctx_moveto(bezctx *bc, double x, double y, int is_open);
-
-void
-bezctx_lineto(bezctx *bc, double x, double y);
-
-void
-bezctx_quadto(bezctx *bc, double x1, double y1, double x2, double y2);
-
-void
-bezctx_curveto(bezctx *bc, double x1, double y1, double x2, double y2,
- double x3, double y3);
-
-void
-bezctx_mark_knot(bezctx *bc, int knot_idx);
-
-#endif
diff --git a/src/live_effects/lpe-powerstroke-interpolators.h b/src/live_effects/lpe-powerstroke-interpolators.h
index 7f9cb3ddb..224c56e89 100644
--- a/src/live_effects/lpe-powerstroke-interpolators.h
+++ b/src/live_effects/lpe-powerstroke-interpolators.h
@@ -237,7 +237,6 @@ private:
result->base.lineto = bezctx_ink_lineto;
result->base.quadto = bezctx_ink_quadto;
result->base.curveto = bezctx_ink_curveto;
- result->base.mark_knot = NULL;
result->path = path;
return &result->base;
}
diff --git a/src/live_effects/spiro.cpp b/src/live_effects/spiro.cpp
index b916a2cf7..e7824c297 100644
--- a/src/live_effects/spiro.cpp
+++ b/src/live_effects/spiro.cpp
@@ -28,7 +28,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
#include <stdlib.h>
#include <string.h>
-#include "bezctx_intf.h"
#include "display/curve.h"
#include <2geom/math-utils.h>
@@ -834,7 +833,7 @@ spiro_seg_to_bpath(const double ks[4],
fabs((1./48) * ks[3]);
if (!bend > 1e-8) {
- bezctx_lineto(bc, x1, y1);
+ bc->lineto(bc, x1, y1);
} else {
double seg_ch = hypot(x1 - x0, y1 - y0);
double seg_th = atan2(y1 - y0, x1 - x0);
@@ -857,7 +856,7 @@ spiro_seg_to_bpath(const double ks[4],
vl = (scale * (1./3)) * sin(th_even - th_odd);
ur = (scale * (1./3)) * cos(th_even + th_odd);
vr = (scale * (1./3)) * sin(th_even + th_odd);
- bezctx_curveto(bc, x0 + ul, y0 + vl, x1 - ur, y1 - vr, x1, y1);
+ bc->curveto(bc, x0 + ul, y0 + vl, x1 - ur, y1 - vr, x1, y1);
} else {
/* subdivide */
double ksub[4];
@@ -914,8 +913,7 @@ spiro_to_bpath(const spiro_seg *s, int n, bezctx *bc)
double y1 = s[i + 1].y;
if (i == 0)
- bezctx_moveto(bc, x0, y0, s[0].ty == '{');
- bezctx_mark_knot(bc, i);
+ bc->moveto(bc, x0, y0, s[0].ty == '{');
spiro_seg_to_bpath(s[i].ks, x0, y0, x1, y1, bc, 0);
}
}
@@ -1000,7 +998,6 @@ bezctx * new_bezctx_ink(SPCurve *curve)
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;
}