From 940bebdae2081d4455e26f2edfd0d8e9adb76542 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sat, 12 Feb 2011 23:43:10 +0100 Subject: calligraphy tool does not need to know the type of the end curves to add the cap. (bzr r10049) --- src/dyna-draw-context.cpp | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) (limited to 'src/dyna-draw-context.cpp') diff --git a/src/dyna-draw-context.cpp b/src/dyna-draw-context.cpp index 6f0898d43..2988aea49 100644 --- a/src/dyna-draw-context.cpp +++ b/src/dyna-draw-context.cpp @@ -1086,32 +1086,20 @@ accumulate_calligraphic(SPDynaDrawContext *dc) return false; // failure } - Geom::CubicBezier const * dc_cal1_firstseg = dynamic_cast( dc->cal1->first_segment() ); - Geom::CubicBezier const * rev_cal2_firstseg = dynamic_cast( rev_cal2->first_segment() ); - Geom::CubicBezier const * dc_cal1_lastseg = dynamic_cast( dc->cal1->last_segment() ); - Geom::CubicBezier const * rev_cal2_lastseg = dynamic_cast( rev_cal2->last_segment() ); - - if ( - !dc_cal1_firstseg || - !rev_cal2_firstseg || - !dc_cal1_lastseg || - !rev_cal2_lastseg - ) { - rev_cal2->unref(); - dc->cal1->reset(); - dc->cal2->reset(); - return false; // failure - } + Geom::Curve const * dc_cal1_firstseg = dc->cal1->first_segment(); + Geom::Curve const * rev_cal2_firstseg = rev_cal2->first_segment(); + Geom::Curve const * dc_cal1_lastseg = dc->cal1->last_segment(); + Geom::Curve const * rev_cal2_lastseg = rev_cal2->last_segment(); dc->accumulated->reset(); /* Is this required ?? */ dc->accumulated->append(dc->cal1, false); - add_cap(dc->accumulated, (*dc_cal1_lastseg)[3], (*rev_cal2_firstseg)[0], dc->cap_rounding); + add_cap(dc->accumulated, dc_cal1_lastseg->finalPoint(), rev_cal2_firstseg->initialPoint(), dc->cap_rounding); dc->accumulated->append(rev_cal2, true); - add_cap(dc->accumulated, (*rev_cal2_lastseg)[3], (*dc_cal1_firstseg)[0], dc->cap_rounding); + add_cap(dc->accumulated, rev_cal2_lastseg->finalPoint(), dc_cal1_firstseg->initialPoint(), dc->cap_rounding); dc->accumulated->closepath(); -- cgit v1.2.3