Code

convert all SPCurve's points and matrices arguments and return types to 2Geom
authorjohanengelen <johanengelen@users.sourceforge.net>
Thu, 17 Jul 2008 22:00:40 +0000 (22:00 +0000)
committerjohanengelen <johanengelen@users.sourceforge.net>
Thu, 17 Jul 2008 22:00:40 +0000 (22:00 +0000)
17 files changed:
src/box3d.cpp
src/connector-context.cpp
src/display/curve.cpp
src/display/curve.h
src/draw-context.cpp
src/dyna-draw-context.cpp
src/eraser-context.cpp
src/live_effects/lpe-copy_rotate.cpp
src/live_effects/lpe-mirror_symmetry.cpp
src/live_effects/lpe-offset.cpp
src/live_effects/lpe-parallel.cpp
src/nodepath.cpp
src/path-chemistry.cpp
src/pen-context.cpp
src/rubberband.cpp
src/sp-guide.cpp
src/sp-path.cpp

index cda482e738c3944c2a05044bcb594d4f5f5c36aa..3c972063dbefde6c0cfd1ce4d93abec94762f1b3 100644 (file)
@@ -1408,8 +1408,8 @@ box3d_convert_to_group(SPBox3D *box) {
 
 static inline void
 box3d_push_back_corner_pair(SPBox3D *box, std::list<std::pair<Geom::Point, Geom::Point> > &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
index 99fcb6659d7fb112b166404e4e3e38b536b6b269..3d109a69c0ccdd328cc32beb837852c913a3c9df 100644 (file)
@@ -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);
 
index b48c941ba27066039c6558ba3be2ab42232df1e6..075f7df9e5a36cbd4970c7ed7315164e841334e0 100644 (file)
 
 #include "display/curve.h"
 
-#include <string.h>
-#include "libnr/nr-point.h"
-#include "libnr/nr-rect.h"
-#include <libnr/nr-point-matrix-ops.h>
-#include <libnr/nr-convert2geom.h>
-#include <cstring>
-#include <string>
+#include <glib/gmessages.h>
 #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<Geom::D2<Geom::SBasis> > pwd2 = _pathv.front().toPwSb();
     Geom::Piecewise<Geom::SBasis> 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<Geom::SBasis> offsetx = (arclength*-1.+1)*A[0] + arclength*B[0];
     Geom::Piecewise<Geom::SBasis> offsety = (arclength*-1.+1)*A[1] + arclength*B[1];
     Geom::Piecewise<Geom::D2<Geom::SBasis> > offsetpath = Geom::sectionize( Geom::D2<Geom::Piecewise<Geom::SBasis> >(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);
 }
 
 /**
index ce0ae8ba1ee8afa4f0350601340daae9bc55f4ff..c3659de078d9616a5d9c95ebb2ac3ddd5f7a21a8 100644 (file)
@@ -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 <lauris@kaplinski.com>
 
 #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:
index 51938dc9eb800817e6ba3877f2ef42dccd48b120..19551dd6a6dbe38a0683a919b62f09415742fea0 100644 (file)
@@ -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);
index e90a6143cf79e431d1899f7836729b8503c740c8..75250c6048e8c4abfedaf69f4013c9388068705a 100644 (file)
@@ -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
index 49f86b03cdba897982f31e09e33496e142121faf..81025d2b2e3a06311f3e1a22dcaeddb918fdfda0 100644 (file)
@@ -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);
index 2f381d1d79f686537f3e68d56e9a456b80d125e8..1eedfa3a71bc0d85f3e7ac8f49ac908db2959e6c 100644 (file)
@@ -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);
 
index e41d4084ddb4c10cf1b0cb9877af74b4810552fb..8095e5360a5e59d805d1b92f491ab15efb7aba42 100644 (file)
@@ -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<D2<SBasis> > rline = Piecewise<D2<SBasis> >(D2<SBasis>(Linear(A[X], B[X]), Linear(A[Y], B[Y])));
     reflection_line.param_set_and_write_new_value(rline);
index 0d45fee2ac138e6638ee1a1be06623556ff0eb3c..68d61603d6ba8fa56086e1d7c5726ecc36987a66 100644 (file)
@@ -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<Geom::D2<Geom::SBasis> > &pwd2,
index 2f3a6d0cebdc1b2d26ee204fa67d888e3d2a6a3a..dba0f3a8db579b61ce917dc1db0b2645ae99c130 100644 (file)
@@ -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);
index e4b080f4fe4e08a96efd1444a47e7dcdf211180f..d7ca69112257d1e611070d603d5e95a90ab6555b 100644 (file)
@@ -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);
index 29c977e5d965e53fb74c6d4609572c295b5ee33d..9dfa760ea2c0280138bcf3e89aeea1f9f402fc15 100644 (file)
@@ -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();
         }
index e62d45192ddba178bbbed0b1c1e382f59403279a..46ae695fb14f2dcdc537f4a15e3d6f4270f91840 100644 (file)
@@ -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();
index 4b7b1c48f2bcef08418aa811bcffb29e453197a8..58f88bbfbf90ac75c8ea9c6f662b93767e4673b8 100644 (file)
@@ -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()
index 3ffd3eda2d88ff63d9bea1e95057041b62764818..aad26f050443749c0574d1d6422808248b72e737 100644 (file)
@@ -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);
 }
 
 /**
index 47d63b2b92e99724ce99d65c162b0bdb9f766615..0867cc3ad008cf40bd96073975d389e1da105dbb 100644 (file)
@@ -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