Code

remove many unnecessary to_2geom and from_2geom calls
[inkscape.git] / src / dyna-draw-context.cpp
index e90a6143cf79e431d1899f7836729b8503c740c8..c56ba7a4c197092d932ae979f8108b648530d833 100644 (file)
@@ -48,8 +48,6 @@
 #include "message-context.h"
 #include "prefs-utils.h"
 #include "pixmaps/cursor-calligraphy.xpm"
-#include "libnr/n-art-bpath.h"
-#include "libnr/nr-path.h"
 #include "libnr/nr-matrix-ops.h"
 #include "libnr/nr-scale-translate-ops.h"
 #include "libnr/nr-convert2geom.h"
@@ -194,11 +192,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);
@@ -605,11 +603,11 @@ sp_dyna_draw_context_root_handler(SPEventContext *event_context,
                     }
 
                     // calculate pointer point in the guide item's coords
-                    motion_to_curve = from_2geom(sp_item_dt2i_affine(selected) * sp_item_i2doc_affine(selected));
+                    motion_to_curve = sp_item_dt2i_affine(selected) * sp_item_i2doc_affine(selected);
                     pointer = motion_dt * motion_to_curve;
 
                     // calculate the nearest point on the guide path
-                    NR::Maybe<Path::cut_position> position = get_nearest_position_on_Path(dc->hatch_livarot_path, pointer);
+                    boost::optional<Path::cut_position> position = get_nearest_position_on_Path(dc->hatch_livarot_path, pointer);
                     nearest = get_point_on_Path(dc->hatch_livarot_path, position->piece, position->t);
 
 
@@ -984,7 +982,7 @@ set_to_accumulated(SPDynaDrawContext *dc, bool unionize)
             item->transform = SP_ITEM(desktop->currentRoot())->getRelativeTransform(desktop->currentLayer());
             item->updateRepr();
         }
-        Geom::PathVector pathv = dc->accumulated->get_pathvector() * to_2geom(sp_desktop_dt2root_affine(desktop));
+        Geom::PathVector pathv = dc->accumulated->get_pathvector() * sp_desktop_dt2root_affine(desktop);
         gchar *str = sp_svg_write_path(pathv);
         g_assert( str != NULL );
         dc->repr->setAttribute("d", str);
@@ -1145,8 +1143,7 @@ fit_and_split(SPDynaDrawContext *dc, gboolean release)
                 dc->currentcurve->reset();
                 dc->currentcurve->moveto(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(bp1[1], bp1[2], 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) {