summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: dec5d31)
raw | patch | inline | side by side (parent: dec5d31)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Sun, 29 Jun 2008 13:40:21 +0000 (13:40 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Sun, 29 Jun 2008 13:40:21 +0000 (13:40 +0000) |
src/pen-context.cpp | patch | blob | history |
diff --git a/src/pen-context.cpp b/src/pen-context.cpp
index 9509efc69dc93c68738e39e01861ba6f9ccd6cdb..53aff5295713d3595a6ff50d848107aab9178038 100644 (file)
--- a/src/pen-context.cpp
+++ b/src/pen-context.cpp
sp_canvas_item_hide (pc->cl1);
}
- NArtBpath const * bpath = pc->green_curve->last_bpath();
- if (bpath) {
- if (bpath->code == NR_CURVETO && NR::Point(bpath->x2, bpath->y2) != pc->p[0]) {
- SP_CTRL(pc->c0)->moveto(NR::Point(bpath->x2, bpath->y2));
- sp_ctrlline_set_coords(SP_CTRLLINE(pc->cl0), NR::Point(bpath->x2, bpath->y2), pc->p[0]);
+ Geom::Curve const * last_seg = pc->green_curve->last_segment();
+ if (last_seg) {
+ Geom::CubicBezier const * cubic = dynamic_cast<Geom::CubicBezier const *>( last_seg );
+ if ( cubic &&
+ (*cubic)[2] != to_2geom(pc->p[0]) )
+ {
+ NR::Point p2 = from_2geom((*cubic)[2]);
+ SP_CTRL(pc->c0)->moveto(p2);
+ sp_ctrlline_set_coords(SP_CTRLLINE(pc->cl0), p2, pc->p[0]);
sp_canvas_item_show (pc->c0);
sp_canvas_item_show (pc->cl0);
} else {
if (pc->npoints != 5)
return;
- // red
- NArtBpath const * bpath = pc->green_curve->last_bpath();
- if (bpath && bpath->code == NR_CURVETO) {
- pc->p[1] = pc->p[0] + (NR::Point(bpath->x3, bpath->y3) - NR::Point(bpath->x2, bpath->y2));
+ Geom::CubicBezier const * cubic = dynamic_cast<Geom::CubicBezier const *>( pc->green_curve->last_segment() );
+ if ( cubic ) {
+ pc->p[1] = pc->p[0] + from_2geom( (*cubic)[3] - (*cubic)[2] );
} else {
pc->p[1] = pc->p[0] + (1./3)*(pc->p[3] - pc->p[0]);
}