summaryrefslogtreecommitdiffstats
path: root/src/pencil-context.cpp
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2008-12-06 01:20:12 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2008-12-06 01:20:12 +0000
commit36c34646c5310c5d7413fb79d9c719fb5c2fe9f4 (patch)
tree3a7b325d6ce13d69ba04072e2ec2c1b0376fd93a /src/pencil-context.cpp
parentNR -> 2Geom few more files (diff)
downloadinkscape-36c34646c5310c5d7413fb79d9c719fb5c2fe9f4.tar.gz
inkscape-36c34646c5310c5d7413fb79d9c719fb5c2fe9f4.zip
simplify interpolating the curve in pencil-context.
(bzr r6960)
Diffstat (limited to 'src/pencil-context.cpp')
-rw-r--r--src/pencil-context.cpp25
1 files changed, 6 insertions, 19 deletions
diff --git a/src/pencil-context.cpp b/src/pencil-context.cpp
index 88fa3a2d4..a80f565fa 100644
--- a/src/pencil-context.cpp
+++ b/src/pencil-context.cpp
@@ -667,6 +667,7 @@ interpolate(SPPencilContext *pc)
guint n_points = pc->ps.size();
pc->green_curve->reset();
pc->red_curve->reset();
+ pc->red_curve_is_valid = false;
Geom::Point * b = g_new(Geom::Point, 4*n_points);
Geom::Point * points = g_new(Geom::Point, 4*n_points);
@@ -683,20 +684,18 @@ interpolate(SPPencilContext *pc)
if ( n_segs > 0)
{
/* Fit and draw and reset state */
- pc->red_curve->reset();
- pc->red_curve->moveto(b[0]);
+ pc->green_curve->moveto(b[0]);
for (int c = 0; c < n_segs; c++) {
- pc->red_curve->curveto(b[4*c+1], b[4*c+2], b[4*c+3]);
+ pc->green_curve->curveto(b[4*c+1], b[4*c+2], b[4*c+3]);
}
- sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), pc->red_curve);
- pc->red_curve_is_valid = true;
+ sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), pc->green_curve);
/* Fit and draw and copy last point */
- g_assert(!pc->red_curve->is_empty());
+ g_assert(!pc->green_curve->is_empty());
/* Set up direction of next curve. */
{
- Geom::CubicBezier const * last_seg = dynamic_cast<Geom::CubicBezier const *>(pc->red_curve->last_segment());
+ Geom::CubicBezier const * last_seg = dynamic_cast<Geom::CubicBezier const *>(pc->green_curve->last_segment());
g_assert( last_seg ); // Relevance: validity of (*last_seg)[2]
pc->p[0] = last_seg->finalPoint();
pc->npoints = 1;
@@ -705,18 +704,6 @@ interpolate(SPPencilContext *pc)
? Geom::Point(0, 0)
: Geom::unit_vector(req_vec) );
}
-
- pc->green_curve->append_continuous(pc->red_curve, 0.0625);
- SPCurve *curve = pc->red_curve->copy();
-
- /// \todo fixme:
- SPCanvasItem *cshape = sp_canvas_bpath_new(sp_desktop_sketch(pc->desktop), curve);
- curve->unref();
- sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(cshape), pc->green_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
-
- pc->green_bpaths = g_slist_prepend(pc->green_bpaths, cshape);
-
- pc->red_curve_is_valid = false;
}
g_free(b);
g_free(points);