From: johanengelen Date: Thu, 17 Jul 2008 22:00:40 +0000 (+0000) Subject: convert all SPCurve's points and matrices arguments and return types to 2Geom X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=235e8e7977f17c6070b4691837b8a6cb2bd4cc35;p=inkscape.git convert all SPCurve's points and matrices arguments and return types to 2Geom --- diff --git a/src/box3d.cpp b/src/box3d.cpp index cda482e73..3c972063d 100644 --- a/src/box3d.cpp +++ b/src/box3d.cpp @@ -1408,8 +1408,8 @@ box3d_convert_to_group(SPBox3D *box) { static inline void box3d_push_back_corner_pair(SPBox3D *box, std::list > &pts, int c1, int c2) { - pts.push_back(std::make_pair(box3d_get_corner_screen(box, c1, false).to_2geom(), - box3d_get_corner_screen(box, c2, false).to_2geom())); + pts.push_back(std::make_pair(box3d_get_corner_screen(box, c1, false), + box3d_get_corner_screen(box, c2, false))); } void diff --git a/src/connector-context.cpp b/src/connector-context.cpp index 99fcb6659..3d109a69c 100644 --- a/src/connector-context.cpp +++ b/src/connector-context.cpp @@ -275,10 +275,10 @@ sp_connector_context_setup(SPEventContext *ec) sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(cc->red_bpath), 0x00000000, SP_WIND_RULE_NONZERO); /* Create red curve */ - cc->red_curve = new SPCurve(4); + cc->red_curve = new SPCurve(); /* Create green curve */ - cc->green_curve = new SPCurve(64); + cc->green_curve = new SPCurve(); // Notice the initial selection. cc_selection_changed(cc->selection, (gpointer) cc); @@ -613,7 +613,7 @@ connector_handle_motion_notify(SPConnectorContext *const cc, GdkEventMotion cons SPDesktop *const dt = cc->desktop; /* Find desktop coordinates */ - NR::Point p = dt->w2d(event_w); + Geom::Point p = to_2geom(dt->w2d(event_w)); switch (cc->state) { case SP_CONNECTOR_CONTEXT_DRAGGING: @@ -622,7 +622,7 @@ connector_handle_motion_notify(SPConnectorContext *const cc, GdkEventMotion cons if ( cc->npoints > 0 ) { cc->selection->clear(); - spcc_connector_set_subsequent_point(cc, p); + spcc_connector_set_subsequent_point(cc, from_2geom(p)); ret = TRUE; } break; @@ -632,16 +632,16 @@ connector_handle_motion_notify(SPConnectorContext *const cc, GdkEventMotion cons g_assert( SP_IS_PATH(cc->clickeditem)); // Update the hidden path - NR::Matrix i2d = from_2geom(sp_item_i2d_affine(cc->clickeditem)); - NR::Matrix d2i = i2d.inverse(); + Geom::Matrix i2d = sp_item_i2d_affine(cc->clickeditem); + Geom::Matrix d2i = i2d.inverse(); SPPath *path = SP_PATH(cc->clickeditem); SPCurve *curve = (SP_SHAPE(path))->curve; if (cc->clickedhandle == cc->endpt_handle[0]) { - NR::Point o = cc->endpt_handle[1]->pos; + Geom::Point o = to_2geom(cc->endpt_handle[1]->pos); curve->stretch_endpoints(p * d2i, o * d2i); } else { - NR::Point o = cc->endpt_handle[0]->pos; + Geom::Point o = to_2geom(cc->endpt_handle[0]->pos); curve->stretch_endpoints(o * d2i, p * d2i); } sp_conn_adjust_path(path); @@ -857,7 +857,7 @@ spcc_connector_set_subsequent_point(SPConnectorContext *const cc, NR::Point cons NR::Point p(route.ps[i].x, route.ps[i].y); cc->red_curve->lineto(p); } - cc->red_curve->transform(dt->doc2dt()); + cc->red_curve->transform(to_2geom(dt->doc2dt())); sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(cc->red_bpath), cc->red_curve); } @@ -871,7 +871,7 @@ static void spcc_concat_colors_and_flush(SPConnectorContext *cc) { SPCurve *c = cc->green_curve; - cc->green_curve = new SPCurve(64); + cc->green_curve = new SPCurve(); cc->red_curve->reset(); sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(cc->red_bpath), NULL); @@ -908,7 +908,7 @@ spcc_flush_white(SPConnectorContext *cc, SPCurve *gc) } /* Now we have to go back to item coordinates at last */ - c->transform(sp_desktop_dt2root_affine(SP_EVENT_CONTEXT_DESKTOP(cc))); + c->transform(to_2geom(sp_desktop_dt2root_affine(SP_EVENT_CONTEXT_DESKTOP(cc)))); SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(cc); SPDocument *doc = sp_desktop_document(desktop); @@ -1078,7 +1078,7 @@ endpt_handler(SPKnot */*knot*/, GdkEvent *event, SPConnectorContext *cc) // Show the red path for dragging. cc->red_curve = SP_PATH(cc->clickeditem)->curve->copy(); - NR::Matrix i2d = from_2geom(sp_item_i2d_affine(cc->clickeditem)); + Geom::Matrix i2d = sp_item_i2d_affine(cc->clickeditem); cc->red_curve->transform(i2d); sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(cc->red_bpath), cc->red_curve); diff --git a/src/display/curve.cpp b/src/display/curve.cpp index b48c941ba..075f7df9e 100644 --- a/src/display/curve.cpp +++ b/src/display/curve.cpp @@ -19,36 +19,21 @@ #include "display/curve.h" -#include -#include "libnr/nr-point.h" -#include "libnr/nr-rect.h" -#include -#include -#include -#include +#include #include <2geom/pathvector.h> #include <2geom/sbasis-geometric.h> #include <2geom/sbasis-to-bezier.h> -#include "svg/svg.h" #include <2geom/point.h> /* Constructors */ /** * The returned curve's state is as if SPCurve::reset has just been called on it. - * \param length Initial number of NArtBpath elements allocated for bpath (including NR_END - * element). - * 2GEOMproof */ -SPCurve::SPCurve(guint length) +SPCurve::SPCurve() : _refcount(1), _pathv() { - if (length <= 0) { - g_error("SPCurve::SPCurve called with invalid length parameter"); - throw; - } - _pathv.clear(); } @@ -63,7 +48,7 @@ SPCurve::new_from_rect(Geom::Rect const &rect) { SPCurve *c = new SPCurve(); - NR::Point p = rect.corner(0); + Geom::Point p = rect.corner(0); c->moveto(p); for (int i=3; i>=0; i--) { @@ -182,25 +167,18 @@ SPCurve::split() const return l; } - -void -SPCurve::transform(NR::Matrix const &m) -{ - transform(to_2geom(m)); -}; - - /** * Transform all paths in curve using matrix. */ void SPCurve::transform(Geom::Matrix const &m) { - _pathv = _pathv * m; + _pathv *= m; } /** * Set curve to empty curve. + * In more detail: this clears the internal pathvector from all its paths. */ void SPCurve::reset() @@ -218,24 +196,16 @@ SPCurve::reset() void SPCurve::moveto(gdouble x, gdouble y) { - moveto(NR::Point(x, y)); -} -/** - * Calls SPCurve::moveto() with point made of given coordinates. - */ -void -SPCurve::moveto(Geom::Point const &p) -{ - moveto(from_2geom(p)); + moveto(Geom::Point(x, y)); } /** * Perform a moveto to a point, thus starting a new subpath. */ void -SPCurve::moveto(NR::Point const &p) +SPCurve::moveto(Geom::Point const &p) { _pathv.push_back( Geom::Path() ); // for some reason Geom::Path(p) does not work... - _pathv.back().start(to_2geom(p)); + _pathv.back().start(p); } /** @@ -246,14 +216,6 @@ SPCurve::lineto(Geom::Point const &p) { lineto(p[Geom::X], p[Geom::Y]); } -/** - * Calls SPCurve::lineto() with a point's coordinates. - */ -void -SPCurve::lineto(NR::Point const &p) -{ - lineto(p[NR::X], p[NR::Y]); -} /** * Adds a line to the current subpath. */ @@ -276,21 +238,8 @@ SPCurve::curveto(Geom::Point const &p0, Geom::Point const &p1, Geom::Point const p1[X], p1[Y], p2[X], p2[Y] ); } -/** - * Calls SPCurve::curveto() with coordinates of three points. - */ -void -SPCurve::curveto(NR::Point const &p0, NR::Point const &p1, NR::Point const &p2) -{ - using NR::X; - using NR::Y; - curveto( p0[X], p0[Y], - p1[X], p1[Y], - p2[X], p2[Y] ); -} /** * Adds a bezier segment to the current subpath. - * 2GEOMified */ void SPCurve::curveto(gdouble x0, gdouble y0, gdouble x1, gdouble y1, gdouble x2, gdouble y2) @@ -413,13 +362,13 @@ SPCurve::first_path() const /** * Return first point of first subpath or (0,0). TODO: shouldn't this be (NR_HUGE, NR_HUGE) to be able to tell it apart from normal (0,0) ? */ -NR::Point +Geom::Point SPCurve::first_point() const { if (is_empty()) - return NR::Point(0, 0); + return Geom::Point(0, 0); - return from_2geom( _pathv.front().initialPoint() ); + return _pathv.front().initialPoint(); } /** @@ -430,11 +379,11 @@ SPCurve::first_point() const * * FIXME: for empty paths shouldn't this return (NR_HUGE,NR_HUGE) */ -NR::Point +Geom::Point SPCurve::second_point() const { if (is_empty()) { - return NR::Point(0,0); + return Geom::Point(0,0); } else if (_pathv.front().empty()) { // first path is only a moveto @@ -452,25 +401,24 @@ SPCurve::second_point() const /** * TODO: fix comment: Return the second-last point of last subpath or _movePos if curve too short. */ -NR::Point +Geom::Point SPCurve::penultimate_point() const { Geom::Curve const& back = _pathv.back().back_default(); - Geom::Point p = back.initialPoint(); - return from_2geom(p); + return back.initialPoint(); } /** * Return last point of last subpath or (0,0). TODO: shouldn't this be (NR_HUGE, NR_HUGE) to be able to tell it apart from normal (0,0) ? * If the last path is only a moveto, then return that point. */ -NR::Point +Geom::Point SPCurve::last_point() const { if (is_empty()) - return NR::Point(0, 0); + return Geom::Point(0, 0); - return from_2geom( _pathv.back().finalPoint() ); + return _pathv.back().finalPoint(); } /** @@ -587,14 +535,14 @@ SPCurve::backspace() * TODO: add comments about what this method does and what assumptions are made and requirements are put on SPCurve */ void -SPCurve::stretch_endpoints(NR::Point const &new_p0, NR::Point const &new_p1) +SPCurve::stretch_endpoints(Geom::Point const &new_p0, Geom::Point const &new_p1) { if (is_empty()) { return; } - NR::Point const offset0( new_p0 - first_point() ); - NR::Point const offset1( new_p1 - last_point() ); + Geom::Point const offset0( new_p0 - first_point() ); + Geom::Point const offset1( new_p1 - last_point() ); Geom::Piecewise > pwd2 = _pathv.front().toPwSb(); Geom::Piecewise arclength = Geom::arcLengthSb(pwd2); @@ -603,8 +551,8 @@ SPCurve::stretch_endpoints(NR::Point const &new_p0, NR::Point const &new_p1) throw; } arclength *= 1./arclength.lastValue(); - Geom::Point const A( to_2geom(offset0) ); - Geom::Point const B( to_2geom(offset1) ); + Geom::Point const A( offset0 ); + Geom::Point const B( offset1 ); Geom::Piecewise offsetx = (arclength*-1.+1)*A[0] + arclength*B[0]; Geom::Piecewise offsety = (arclength*-1.+1)*A[1] + arclength*B[1]; Geom::Piecewise > offsetpath = Geom::sectionize( Geom::D2 >(offsetx, offsety) ); @@ -616,13 +564,13 @@ SPCurve::stretch_endpoints(NR::Point const &new_p0, NR::Point const &new_p1) * sets start of first path to new_p0, and end of first path to new_p1 */ void -SPCurve::move_endpoints(NR::Point const &new_p0, NR::Point const &new_p1) +SPCurve::move_endpoints(Geom::Point const &new_p0, Geom::Point const &new_p1) { if (is_empty()) { return; } - _pathv.front().setInitial(to_2geom(new_p0)); - _pathv.front().setFinal(to_2geom(new_p1)); + _pathv.front().setInitial(new_p0); + _pathv.front().setFinal(new_p1); } /** diff --git a/src/display/curve.h b/src/display/curve.h index ce0ae8ba1..c3659de07 100644 --- a/src/display/curve.h +++ b/src/display/curve.h @@ -2,7 +2,7 @@ #define SEEN_DISPLAY_CURVE_H /** \file - * Wrapper around an array of NArtBpath objects. + * Wrapper around a Geom::PathVector objects. * * Author: * Lauris Kaplinski @@ -20,72 +20,59 @@ #include <2geom/forward.h> -#include "libnr/nr-forward.h" - -#define SP_CURVE_LENSTEP 32 - -struct SPObject; - -/// Wrapper around Geom::PathVector. class SPCurve { public: /* Constructors */ - explicit SPCurve(guint length = SP_CURVE_LENSTEP); + explicit SPCurve(); explicit SPCurve(Geom::PathVector const& pathv); static SPCurve * new_from_rect(Geom::Rect const &rect); virtual ~SPCurve(); void set_pathvector(Geom::PathVector const & new_pathv); - NArtBpath const * get_bpath() const; Geom::PathVector const & get_pathvector() const; - guint get_segment_count() const; - guint nodes_in_path() const; - SPCurve * ref(); SPCurve * unref(); SPCurve * copy() const; - GSList * split() const; - void transform(NR::Matrix const &m); - void transform(Geom::Matrix const &m); - void stretch_endpoints(NR::Point const &, NR::Point const &); - void move_endpoints(NR::Point const &, NR::Point const &); - void last_point_additive_move(Geom::Point const & p); + guint get_segment_count() const; + guint nodes_in_path() const; + + bool is_empty() const; + bool is_closed() const; + Geom::Curve const * last_segment() const; + Geom::Path const * last_path() const; + Geom::Curve const * first_segment() const; + Geom::Path const * first_path() const; + Geom::Point first_point() const; + Geom::Point last_point() const; + Geom::Point second_point() const; + Geom::Point penultimate_point() const; void reset(); void moveto(Geom::Point const &p); - void moveto(NR::Point const &p); void moveto(gdouble x, gdouble y); void lineto(Geom::Point const &p); - void lineto(NR::Point const &p); void lineto(gdouble x, gdouble y); void curveto(Geom::Point const &p0, Geom::Point const &p1, Geom::Point const &p2); - void curveto(NR::Point const &p0, NR::Point const &p1, NR::Point const &p2); void curveto(gdouble x0, gdouble y0, gdouble x1, gdouble y1, gdouble x2, gdouble y2); void closepath(); void closepath_current(); + void backspace(); - SPCurve * append_continuous(SPCurve const *c1, gdouble tolerance); - - bool is_empty() const; - bool is_closed() const; - Geom::Curve const * last_segment() const; - Geom::Path const * last_path() const; - Geom::Curve const * first_segment() const; - Geom::Path const * first_path() const; - NR::Point first_point() const; - NR::Point last_point() const; - NR::Point second_point() const; - NR::Point penultimate_point() const; + void transform(Geom::Matrix const &m); + void stretch_endpoints(Geom::Point const &, Geom::Point const &); + void move_endpoints(Geom::Point const &, Geom::Point const &); + void last_point_additive_move(Geom::Point const & p); void append(SPCurve const *curve2, bool use_lineto); + SPCurve * append_continuous(SPCurve const *c1, gdouble tolerance); SPCurve * create_reverse() const; - void backspace(); + GSList * split() const; static SPCurve * concat(GSList const *list); protected: diff --git a/src/draw-context.cpp b/src/draw-context.cpp index 51938dc9e..19551dd6a 100644 --- a/src/draw-context.cpp +++ b/src/draw-context.cpp @@ -171,16 +171,16 @@ sp_draw_context_setup(SPEventContext *ec) dc->red_bpath = sp_canvas_bpath_new(sp_desktop_sketch(ec->desktop), NULL); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(dc->red_bpath), dc->red_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); /* Create red curve */ - dc->red_curve = new SPCurve(4); + dc->red_curve = new SPCurve(); /* Create blue bpath */ dc->blue_bpath = sp_canvas_bpath_new(sp_desktop_sketch(ec->desktop), NULL); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(dc->blue_bpath), dc->blue_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); /* Create blue curve */ - dc->blue_curve = new SPCurve(8); + dc->blue_curve = new SPCurve(); /* Create green curve */ - dc->green_curve = new SPCurve(64); + dc->green_curve = new SPCurve(); /* No green anchor by default */ dc->green_anchor = NULL; dc->green_closed = FALSE; @@ -387,7 +387,7 @@ spdc_attach_selection(SPDrawContext *dc, Inkscape::Selection */*sel*/) /* Curve list */ /* We keep it in desktop coordinates to eliminate calculation errors */ SPCurve *norm = sp_path_get_curve_for_edit (SP_PATH(item)); - norm->transform(from_2geom(sp_item_i2d_affine(dc->white_item))); + norm->transform(sp_item_i2d_affine(dc->white_item)); g_return_if_fail( norm != NULL ); dc->white_curves = g_slist_reverse(norm->split()); norm->unref(); @@ -496,7 +496,7 @@ spdc_concat_colors_and_flush(SPDrawContext *dc, gboolean forceclosed) SPCurve *c = dc->green_curve; /* Green */ - dc->green_curve = new SPCurve(64); + dc->green_curve = new SPCurve(); while (dc->green_bpaths) { gtk_object_destroy(GTK_OBJECT(dc->green_bpaths->data)); dc->green_bpaths = g_slist_remove(dc->green_bpaths, dc->green_bpaths->data); @@ -610,8 +610,8 @@ spdc_flush_white(SPDrawContext *dc, SPCurve *gc) /* Now we have to go back to item coordinates at last */ c->transform(( dc->white_item - ? from_2geom(sp_item_dt2i_affine(dc->white_item)) - : sp_desktop_dt2root_affine(SP_EVENT_CONTEXT_DESKTOP(dc)) )); + ? sp_item_dt2i_affine(dc->white_item) + : to_2geom(sp_desktop_dt2root_affine(SP_EVENT_CONTEXT_DESKTOP(dc))) )); SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(dc); SPDocument *doc = sp_desktop_document(desktop); diff --git a/src/dyna-draw-context.cpp b/src/dyna-draw-context.cpp index e90a6143c..75250c604 100644 --- a/src/dyna-draw-context.cpp +++ b/src/dyna-draw-context.cpp @@ -194,11 +194,11 @@ sp_dyna_draw_context_setup(SPEventContext *ec) if (((SPEventContextClass *) dd_parent_class)->setup) ((SPEventContextClass *) dd_parent_class)->setup(ec); - ddc->accumulated = new SPCurve(32); - ddc->currentcurve = new SPCurve(4); + ddc->accumulated = new SPCurve(); + ddc->currentcurve = new SPCurve(); - ddc->cal1 = new SPCurve(32); - ddc->cal2 = new SPCurve(32); + ddc->cal1 = new SPCurve(); + ddc->cal2 = new SPCurve(); ddc->currentshape = sp_canvas_item_new(sp_desktop_sketch(ec->desktop), SP_TYPE_CANVAS_BPATH, NULL); sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(ddc->currentshape), DDC_RED_RGBA, SP_WIND_RULE_EVENODD); @@ -1021,7 +1021,7 @@ add_cap(SPCurve *curve, double mag = NR::L2(vel); NR::Point v = mag * NR::rot90( to - from ) / NR::L2( to - from ); - curve->curveto(from + v, to + v, to); + curve->curveto(to_2geom(from + v), to_2geom(to + v), to_2geom(to)); } } @@ -1121,8 +1121,8 @@ fit_and_split(SPDynaDrawContext *dc, gboolean release) dc->cal1->reset(); dc->cal2->reset(); - dc->cal1->moveto(dc->point1[0]); - dc->cal2->moveto(dc->point2[0]); + dc->cal1->moveto(to_2geom(dc->point1[0])); + dc->cal2->moveto(to_2geom(dc->point2[0])); } NR::Point b1[BEZIER_MAX_LENGTH]; @@ -1143,14 +1143,13 @@ fit_and_split(SPDynaDrawContext *dc, gboolean release) /* CanvasShape */ if (! release) { dc->currentcurve->reset(); - dc->currentcurve->moveto(b1[0]); + dc->currentcurve->moveto(to_2geom(b1[0])); for (NR::Point *bp1 = b1; bp1 < b1 + BEZIER_SIZE * nb1; bp1 += BEZIER_SIZE) { - dc->currentcurve->curveto(bp1[1], - bp1[2], bp1[3]); + dc->currentcurve->curveto(to_2geom(bp1[1]), to_2geom(bp1[2]), to_2geom(bp1[3])); } dc->currentcurve->lineto(b2[BEZIER_SIZE*(nb2-1) + 3]); for (NR::Point *bp2 = b2 + BEZIER_SIZE * ( nb2 - 1 ); bp2 >= b2; bp2 -= BEZIER_SIZE) { - dc->currentcurve->curveto(bp2[2], bp2[1], bp2[0]); + dc->currentcurve->curveto(to_2geom(bp2[2]), to_2geom(bp2[1]), to_2geom(bp2[0])); } // FIXME: dc->segments is always NULL at this point?? if (!dc->segments) { // first segment diff --git a/src/eraser-context.cpp b/src/eraser-context.cpp index 49f86b03c..81025d2b2 100644 --- a/src/eraser-context.cpp +++ b/src/eraser-context.cpp @@ -163,11 +163,11 @@ sp_eraser_context_setup(SPEventContext *ec) if (((SPEventContextClass *) eraser_parent_class)->setup) ((SPEventContextClass *) eraser_parent_class)->setup(ec); - erc->accumulated = new SPCurve(32); - erc->currentcurve = new SPCurve(4); + erc->accumulated = new SPCurve(); + erc->currentcurve = new SPCurve(); - erc->cal1 = new SPCurve(32); - erc->cal2 = new SPCurve(32); + erc->cal1 = new SPCurve(); + erc->cal2 = new SPCurve(); erc->currentshape = sp_canvas_item_new(sp_desktop_sketch(ec->desktop), SP_TYPE_CANVAS_BPATH, NULL); sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(erc->currentshape), ERC_RED_RGBA, SP_WIND_RULE_EVENODD); diff --git a/src/live_effects/lpe-copy_rotate.cpp b/src/live_effects/lpe-copy_rotate.cpp index 2f381d1d7..1eedfa3a7 100644 --- a/src/live_effects/lpe-copy_rotate.cpp +++ b/src/live_effects/lpe-copy_rotate.cpp @@ -69,8 +69,8 @@ LPECopyRotate::doOnApply(SPLPEItem *lpeitem) { SPCurve *curve = SP_SHAPE(lpeitem)->curve; - A = curve->first_point().to_2geom(); - B = curve->last_point().to_2geom(); + A = curve->first_point(); + B = curve->last_point(); origin.param_setValue(A); diff --git a/src/live_effects/lpe-mirror_symmetry.cpp b/src/live_effects/lpe-mirror_symmetry.cpp index e41d4084d..8095e5360 100644 --- a/src/live_effects/lpe-mirror_symmetry.cpp +++ b/src/live_effects/lpe-mirror_symmetry.cpp @@ -46,8 +46,8 @@ LPEMirrorSymmetry::acceptParamPath (SPPath *param_path) { using namespace Geom; SPCurve* curve = sp_path_get_curve_for_edit (param_path); - Geom::Point A(curve->first_point().to_2geom()); - Geom::Point B(curve->last_point().to_2geom()); + Geom::Point A(curve->first_point()); + Geom::Point B(curve->last_point()); Piecewise > rline = Piecewise >(D2(Linear(A[X], B[X]), Linear(A[Y], B[Y]))); reflection_line.param_set_and_write_new_value(rline); diff --git a/src/live_effects/lpe-offset.cpp b/src/live_effects/lpe-offset.cpp index 0d45fee2a..68d61603d 100644 --- a/src/live_effects/lpe-offset.cpp +++ b/src/live_effects/lpe-offset.cpp @@ -41,7 +41,7 @@ LPEOffset::~LPEOffset() void LPEOffset::doOnApply(SPLPEItem *lpeitem) { - offset_pt.param_set_and_write_new_value(SP_SHAPE(lpeitem)->curve->first_point().to_2geom()); + offset_pt.param_set_and_write_new_value(SP_SHAPE(lpeitem)->curve->first_point()); } static void append_half_circle(Geom::Piecewise > &pwd2, diff --git a/src/live_effects/lpe-parallel.cpp b/src/live_effects/lpe-parallel.cpp index 2f3a6d0ce..dba0f3a8d 100644 --- a/src/live_effects/lpe-parallel.cpp +++ b/src/live_effects/lpe-parallel.cpp @@ -71,8 +71,8 @@ LPEParallel::doOnApply (SPLPEItem *lpeitem) { SPCurve *curve = SP_SHAPE(lpeitem)->curve; - A = curve->first_point().to_2geom(); - B = curve->last_point().to_2geom(); + A = curve->first_point(); + B = curve->last_point(); dir = unit_vector(B - A); offset_pt.param_set_and_write_new_value((A + B)/2 + dir.ccw() * 100); diff --git a/src/nodepath.cpp b/src/nodepath.cpp index e4b080f4f..d7ca69112 100644 --- a/src/nodepath.cpp +++ b/src/nodepath.cpp @@ -158,7 +158,7 @@ static void sp_nodepath_draw_helper_curve(Inkscape::NodePath::Path *np, SPDeskto // Draw helper curve if (np->show_helperpath) { SPCurve *helper_curve = np->curve->copy(); - helper_curve->transform(np->i2d ); + helper_curve->transform(to_2geom(np->i2d)); np->helper_path = sp_canvas_bpath_new(sp_desktop_controls(desktop), helper_curve); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(np->helper_path), np->helperpath_rgba, np->helperpath_width, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(np->helper_path), 0, SP_WIND_RULE_NONZERO); @@ -573,7 +573,7 @@ static void update_object(Inkscape::NodePath::Path *np) if (np->show_helperpath) { SPCurve * helper_curve = np->curve->copy(); - helper_curve->transform(np->i2d ); + helper_curve->transform(to_2geom(np->i2d)); sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(np->helper_path), helper_curve); helper_curve->unref(); } @@ -614,7 +614,7 @@ static void update_repr_internal(Inkscape::NodePath::Path *np) if (np->show_helperpath) { SPCurve * helper_curve = np->curve->copy(); - helper_curve->transform(np->i2d ); + helper_curve->transform(to_2geom(np->i2d)); sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(np->helper_path), helper_curve); helper_curve->unref(); } @@ -4798,7 +4798,7 @@ void sp_nodepath_show_helperpath(Inkscape::NodePath::Path *np, bool show) { if (show) { SPCurve *helper_curve = np->curve->copy(); - helper_curve->transform(np->i2d ); + helper_curve->transform(to_2geom(np->i2d)); if (!np->helper_path) { np->helper_path = sp_canvas_bpath_new(sp_desktop_controls(np->desktop), helper_curve); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(np->helper_path), np->helperpath_rgba, np->helperpath_width, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index 29c977e5d..9dfa760ea 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -115,7 +115,7 @@ sp_selected_path_combine(void) //c->transform(item->transform); curve = c; } else { - c->transform(item->getRelativeTransform(SP_OBJECT(first))); + c->transform(to_2geom(item->getRelativeTransform(SP_OBJECT(first)))); curve->append(c, false); c->unref(); } diff --git a/src/pen-context.cpp b/src/pen-context.cpp index e62d45192..46ae695fb 100644 --- a/src/pen-context.cpp +++ b/src/pen-context.cpp @@ -1104,7 +1104,7 @@ pen_handle_key_press(SPPenContext *const pc, GdkEvent *event) pc->p[1] = pc->p[0]; } NR::Point const pt(( pc->npoints < 4 - ? crv->finalPoint() + ? from_2geom(crv->finalPoint()) : pc->p[3] )); pc->npoints = 2; pc->green_curve->backspace(); diff --git a/src/rubberband.cpp b/src/rubberband.cpp index 4b7b1c48f..58f88bbfb 100644 --- a/src/rubberband.cpp +++ b/src/rubberband.cpp @@ -28,7 +28,7 @@ Inkscape::Rubberband::Rubberband() { _points.clear(); _mode = RUBBERBAND_MODE_RECT; - _touchpath_curve = new SPCurve(2000); + _touchpath_curve = new SPCurve(); } void Inkscape::Rubberband::delete_canvas_items() diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp index 3ffd3eda2..aad26f050 100644 --- a/src/sp-guide.cpp +++ b/src/sp-guide.cpp @@ -339,7 +339,7 @@ Geom::Point sp_guide_position_from_pt(SPGuide const *guide, NR::Point const &pt) double sp_guide_distance_from_pt(SPGuide const *guide, Geom::Point const &pt) { - return dot(pt - guide->point_on_line, guide->normal_to_line); + return Geom::dot(pt - guide->point_on_line, guide->normal_to_line); } /** diff --git a/src/sp-path.cpp b/src/sp-path.cpp index 47d63b2b9..0867cc3ad 100644 --- a/src/sp-path.cpp +++ b/src/sp-path.cpp @@ -361,10 +361,10 @@ sp_path_set_transform(SPItem *item, NR::Matrix const &xform) // Transform the original-d path or the (ordinary) path if (path->original_curve) { - path->original_curve->transform(xform); + path->original_curve->transform(to_2geom(xform)); sp_lpe_item_update_patheffect(path, true, true); } else { - shape->curve->transform(xform); + shape->curve->transform(to_2geom(xform)); } // Adjust stroke