Code

remove many unnecessary to_2geom and from_2geom calls
[inkscape.git] / src / sp-shape.cpp
index 5509b7c77ed33d9a72ec9057aaf13bc3c0a14a07..96b52fd46aff2f19573562578fb59a24412d4dfc 100644 (file)
@@ -272,7 +272,7 @@ sp_shape_update (SPObject *object, SPCtx *ctx, unsigned int flags)
        if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_PARENT_MODIFIED_FLAG)) {
                /* This is suboptimal, because changing parent style schedules recalculation */
                /* But on the other hand - how can we know that parent does not tie style and transform */
-                NR::Maybe<NR::Rect> paintbox = SP_ITEM(object)->getBounds(NR::identity());
+                boost::optional<NR::Rect> paintbox = SP_ITEM(object)->getBounds(NR::identity());
                for (SPItemView *v = SP_ITEM (shape)->display; v != NULL; v = v->next) {
                     NRArenaShape * const s = NR_ARENA_SHAPE(v->arenaitem);
                     if (flags & SP_OBJECT_MODIFIED_FLAG) {
@@ -471,7 +471,7 @@ static void sp_shape_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &tr
 
         NRRect  cbbox;
 
-        Geom::Rect geombbox = bounds_exact_transformed(shape->curve->get_pathvector(), to_2geom(transform));
+        Geom::Rect geombbox = bounds_exact_transformed(shape->curve->get_pathvector(), transform);
         cbbox.x0 = geombbox[0][0];
         cbbox.y0 = geombbox[1][0];
         cbbox.x1 = geombbox[0][1];
@@ -502,7 +502,7 @@ static void sp_shape_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &tr
                         SPMarker* marker = SP_MARKER (shape->marker[SP_MARKER_LOC_START]);
                         SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (shape->marker[SP_MARKER_LOC_START]));
 
-                        NR::Matrix tr(from_2geom(sp_shape_marker_get_transform_at_start(path_it->front())));
+                        NR::Matrix tr(sp_shape_marker_get_transform_at_start(path_it->front()));
 
                         if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) {
                             tr = NR::scale(style->stroke_width.computed) * tr;
@@ -530,7 +530,7 @@ static void sp_shape_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &tr
                             SPMarker* marker = SP_MARKER (shape->marker[SP_MARKER_LOC_MID]);
                             SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (shape->marker[SP_MARKER_LOC_MID]));
 
-                            NR::Matrix tr(from_2geom(sp_shape_marker_get_transform(*curve_it1, *curve_it2)));
+                            NR::Matrix tr(sp_shape_marker_get_transform(*curve_it1, *curve_it2));
 
                             if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) {
                                 tr = NR::scale(style->stroke_width.computed) * tr;
@@ -554,7 +554,7 @@ static void sp_shape_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &tr
                         SPMarker* marker = SP_MARKER (shape->marker[SP_MARKER_LOC_END]);
                         SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (shape->marker[SP_MARKER_LOC_END]));
 
-                        NR::Matrix tr(from_2geom(sp_shape_marker_get_transform_at_end(path_it->back_default())));
+                        NR::Matrix tr(sp_shape_marker_get_transform_at_end(path_it->back_default()));
 
                         if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) {
                             tr = NR::scale(style->stroke_width.computed) * tr;
@@ -608,7 +608,7 @@ sp_shape_print (SPItem *item, SPPrintContext *ctx)
        dbox.x1 = sp_document_width (SP_OBJECT_DOCUMENT (item));
        dbox.y1 = sp_document_height (SP_OBJECT_DOCUMENT (item));
        sp_item_bbox_desktop (item, &bbox);
-       NR::Matrix const i2d = from_2geom(sp_item_i2d_affine(item));
+       NR::Matrix const i2d(sp_item_i2d_affine(item));
 
         SPStyle* style = SP_OBJECT_STYLE (item);
 
@@ -627,7 +627,7 @@ sp_shape_print (SPItem *item, SPPrintContext *ctx)
             SPMarker* marker = SP_MARKER (shape->marker[SP_MARKER_LOC_START]);
             SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (shape->marker[SP_MARKER_LOC_START]));
 
-            NR::Matrix tr(from_2geom(sp_shape_marker_get_transform_at_start(path_it->front())));
+            NR::Matrix tr(sp_shape_marker_get_transform_at_start(path_it->front()));
 
             if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) {
                 tr = NR::scale(style->stroke_width.computed) * tr;
@@ -653,7 +653,7 @@ sp_shape_print (SPItem *item, SPPrintContext *ctx)
                 SPMarker* marker = SP_MARKER (shape->marker[SP_MARKER_LOC_MID]);
                 SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (shape->marker[SP_MARKER_LOC_MID]));
 
-                NR::Matrix tr(from_2geom(sp_shape_marker_get_transform(*curve_it1, *curve_it2)));
+                NR::Matrix tr(sp_shape_marker_get_transform(*curve_it1, *curve_it2));
 
                 if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) {
                     tr = NR::scale(style->stroke_width.computed) * tr;
@@ -675,7 +675,7 @@ sp_shape_print (SPItem *item, SPPrintContext *ctx)
             SPMarker* marker = SP_MARKER (shape->marker[SP_MARKER_LOC_END]);
             SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (shape->marker[SP_MARKER_LOC_END]));
 
-            NR::Matrix tr(from_2geom(sp_shape_marker_get_transform_at_end(path_it->back_default())));
+            NR::Matrix tr(sp_shape_marker_get_transform_at_end(path_it->back_default()));
 
             if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) {
                 tr = NR::scale(style->stroke_width.computed) * tr;
@@ -711,7 +711,7 @@ sp_shape_show (SPItem *item, NRArena *arena, unsigned int /*key*/, unsigned int
         NRArenaShape * const s = NR_ARENA_SHAPE(arenaitem);
        nr_arena_shape_set_style(s, object->style);
        nr_arena_shape_set_path(s, shape->curve, false);
-        NR::Maybe<NR::Rect> paintbox = item->getBounds(NR::identity());
+        boost::optional<NR::Rect> paintbox = item->getBounds(NR::identity());
         if (paintbox) {
             s->setPaintBox(*paintbox);
         }