From 26b62dfb088a00b6debad350538a64c2af145f50 Mon Sep 17 00:00:00 2001 From: johanengelen Date: Fri, 8 Aug 2008 17:32:43 +0000 Subject: [PATCH] remove many unnecessary to_2geom and from_2geom calls --- src/arc-context.cpp | 2 +- src/box3d.cpp | 4 +- src/conn-avoid-ref.cpp | 2 +- src/connector-context.cpp | 14 +++---- src/desktop-style.cpp | 10 ++--- src/dialogs/clonetiler.cpp | 2 +- src/dialogs/export.cpp | 2 +- src/dialogs/stroke-style.cpp | 2 +- src/dialogs/tiledialog.cpp | 18 ++++----- src/dialogs/unclump.cpp | 12 +++--- src/display/canvas-bpath.cpp | 8 ++-- src/display/inkscape-cairo.cpp | 4 +- src/display/nr-arena-glyphs.cpp | 2 +- src/display/nr-arena-shape.cpp | 18 ++++----- src/draw-context.cpp | 6 +-- src/dyna-draw-context.cpp | 16 ++++---- src/eraser-context.cpp | 2 +- src/extension/internal/cairo-renderer.cpp | 16 ++++---- src/extension/internal/emf-win32-print.cpp | 2 +- src/extension/internal/latex-pstricks.cpp | 2 +- src/extension/internal/odf.cpp | 4 +- src/extension/internal/pdf-cairo.cpp | 4 +- src/extension/internal/ps.cpp | 2 +- src/filter-chemistry.cpp | 4 +- src/flood-context.cpp | 2 +- src/gradient-chemistry.cpp | 4 +- src/helper/pixbuf-ops.cpp | 2 +- src/helper/png-write.cpp | 2 +- src/interface.cpp | 2 +- src/knot-holder-entity.cpp | 6 +-- src/knotholder.cpp | 2 +- src/libnrtype/Layout-TNG-Output.cpp | 6 +-- src/livarot/PathCutting.cpp | 10 ++--- src/live_effects/lpe-mirror_symmetry.cpp | 2 +- src/live_effects/lpegroupbbox.cpp | 2 +- src/live_effects/parameter/point.cpp | 2 +- src/main.cpp | 6 +-- src/marker.cpp | 4 +- src/nodepath.cpp | 28 +++++++------- src/object-snapper.cpp | 26 ++++++------- src/path-chemistry.cpp | 4 +- src/pen-context.cpp | 8 ++-- src/selection-chemistry.cpp | 28 +++++++------- src/selection.cpp | 2 +- src/seltrans.cpp | 8 ++-- src/shape-editor.cpp | 6 +-- src/snap.cpp | 2 +- src/sp-conn-end-pair.cpp | 2 +- src/sp-conn-end.cpp | 6 +-- src/sp-ellipse.cpp | 2 +- src/sp-flowregion.cpp | 6 +-- src/sp-flowtext.cpp | 2 +- src/sp-image.cpp | 2 +- src/sp-item-notify-moveto.cpp | 2 +- src/sp-item-transform.cpp | 10 ++--- src/sp-item.cpp | 44 +++++++--------------- src/sp-item.h | 1 - src/sp-path.cpp | 7 ++-- src/sp-rect.cpp | 4 +- src/sp-shape.cpp | 16 ++++---- src/sp-text.cpp | 2 +- src/sp-tspan.cpp | 2 +- src/sp-use-reference.cpp | 2 +- src/splivarot.cpp | 10 ++--- src/svg/svg-affine.cpp | 4 +- src/text-chemistry.cpp | 2 +- src/text-context.cpp | 2 +- src/text-editing.cpp | 10 ++--- src/tweak-context.cpp | 8 ++-- src/ui/cache/svg_preview_cache.cpp | 2 +- src/ui/clipboard.cpp | 4 +- src/ui/dialog/filedialogimpl-win32.cpp | 4 +- src/ui/dialog/transformation.cpp | 4 +- src/widgets/font-selector.cpp | 2 +- src/widgets/icon.cpp | 10 +++-- 75 files changed, 240 insertions(+), 254 deletions(-) diff --git a/src/arc-context.cpp b/src/arc-context.cpp index 322334dbd..f3e46e029 100644 --- a/src/arc-context.cpp +++ b/src/arc-context.cpp @@ -450,7 +450,7 @@ static void sp_arc_drag(SPArcContext *ac, NR::Point pt, guint state) NR::Point c = r.midpoint(); if (!ctrl_save) { if (fabs(dir[NR::X]) > 1E-6 && fabs(dir[NR::Y]) > 1E-6) { - NR::Matrix const i2d (from_2geom(sp_item_i2d_affine (ac->item))); + NR::Matrix const i2d (sp_item_i2d_affine (ac->item)); NR::Point new_dir = pt * i2d - c; new_dir[NR::X] *= dir[NR::Y] / dir[NR::X]; double lambda = NR::L2(new_dir) / dir[NR::Y]; diff --git a/src/box3d.cpp b/src/box3d.cpp index 3c972063d..a517ea0a2 100644 --- a/src/box3d.cpp +++ b/src/box3d.cpp @@ -409,7 +409,7 @@ box3d_get_corner_screen (SPBox3D const *box, guint id, bool item_coords) { if (!box3d_get_perspective(box)) { return NR::Point (NR_HUGE, NR_HUGE); } - NR::Matrix const i2d (from_2geom(sp_item_i2d_affine (SP_ITEM(box)))); + NR::Matrix const i2d (sp_item_i2d_affine (SP_ITEM(box))); if (item_coords) { return box3d_get_perspective(box)->tmat.image(proj_corner).affine() * i2d.inverse(); } else { @@ -433,7 +433,7 @@ box3d_get_center_screen (SPBox3D *box) { if (!box3d_get_perspective(box)) { return NR::Point (NR_HUGE, NR_HUGE); } - NR::Matrix const i2d (from_2geom(sp_item_i2d_affine (SP_ITEM(box)))); + NR::Matrix const i2d (sp_item_i2d_affine (SP_ITEM(box))); return box3d_get_perspective(box)->tmat.image(proj_center).affine() * i2d.inverse(); } diff --git a/src/conn-avoid-ref.cpp b/src/conn-avoid-ref.cpp index 2eb1f441e..a64708332 100644 --- a/src/conn-avoid-ref.cpp +++ b/src/conn-avoid-ref.cpp @@ -193,7 +193,7 @@ static Avoid::Polygn avoid_item_poly(SPItem const *item) // by the sp_*_update functions, e.g., text. sp_document_ensure_up_to_date(item->document); - boost::optional rHull = item->getBounds(from_2geom(sp_item_i2doc_affine(item))); + boost::optional rHull = item->getBounds(sp_item_i2doc_affine(item)); if (!rHull) { return Avoid::newPoly(0); } diff --git a/src/connector-context.cpp b/src/connector-context.cpp index 871110275..d58c8a871 100644 --- a/src/connector-context.cpp +++ b/src/connector-context.cpp @@ -613,7 +613,7 @@ connector_handle_motion_notify(SPConnectorContext *const cc, GdkEventMotion cons SPDesktop *const dt = cc->desktop; /* Find desktop coordinates */ - Geom::Point p = to_2geom(dt->w2d(event_w)); + Geom::Point p = 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, from_2geom(p)); + spcc_connector_set_subsequent_point(cc, p); ret = TRUE; } break; @@ -637,11 +637,11 @@ connector_handle_motion_notify(SPConnectorContext *const cc, GdkEventMotion cons SPPath *path = SP_PATH(cc->clickeditem); SPCurve *curve = (SP_SHAPE(path))->curve; if (cc->clickedhandle == cc->endpt_handle[0]) { - Geom::Point o = to_2geom(cc->endpt_handle[1]->pos); + Geom::Point o = cc->endpt_handle[1]->pos; curve->stretch_endpoints(p * d2i, o * d2i); } else { - Geom::Point o = to_2geom(cc->endpt_handle[0]->pos); + Geom::Point o = 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(to_2geom(dt->doc2dt())); + cc->red_curve->transform(dt->doc2dt()); sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(cc->red_bpath), cc->red_curve); } @@ -908,7 +908,7 @@ spcc_flush_white(SPConnectorContext *cc, SPCurve *gc) } /* Now we have to go back to item coordinates at last */ - c->transform(to_2geom(sp_desktop_dt2root_affine(SP_EVENT_CONTEXT_DESKTOP(cc)))); + c->transform(sp_desktop_dt2root_affine(SP_EVENT_CONTEXT_DESKTOP(cc))); SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(cc); SPDocument *doc = sp_desktop_document(desktop); @@ -930,7 +930,7 @@ spcc_flush_white(SPConnectorContext *cc, SPCurve *gc) cc->newconn = SP_ITEM(desktop->currentLayer()->appendChildRepr(repr)); cc->selection->set(repr); Inkscape::GC::release(repr); - cc->newconn->transform = from_2geom(i2i_affine(desktop->currentRoot(), desktop->currentLayer())); + cc->newconn->transform = i2i_affine(desktop->currentRoot(), desktop->currentLayer()); cc->newconn->updateRepr(); bool connection = false; diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index 5eaa902fd..b8af828ad 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -120,7 +120,7 @@ sp_desktop_apply_css_recursive(SPObject *o, SPCSSAttr *css, bool skip_lines) // Scale the style by the inverse of the accumulated parent transform in the paste context. { - NR::Matrix const local(from_2geom(sp_item_i2doc_affine(SP_ITEM(o)))); + NR::Matrix const local(sp_item_i2doc_affine(SP_ITEM(o))); double const ex(NR::expansion(local)); if ( ( ex != 0. ) && ( ex != 1. ) ) { @@ -405,7 +405,7 @@ stroke_average_width (GSList const *objects) if (!SP_IS_ITEM (l->data)) continue; - NR::Matrix i2d = from_2geom(sp_item_i2d_affine (SP_ITEM(l->data))); + NR::Matrix i2d = sp_item_i2d_affine (SP_ITEM(l->data)); SPObject *object = SP_OBJECT(l->data); @@ -671,7 +671,7 @@ objects_query_strokewidth (GSList *objects, SPStyle *style_res) n_stroked ++; - NR::Matrix i2d = from_2geom(sp_item_i2d_affine (SP_ITEM(obj))); + NR::Matrix i2d = sp_item_i2d_affine (SP_ITEM(obj)); double sw = style->stroke_width.computed * NR::expansion(i2d); if (prev_sw != -1 && fabs(sw - prev_sw) > 1e-3) @@ -887,7 +887,7 @@ objects_query_fontnumbers (GSList *objects, SPStyle *style_res) if (!style) continue; texts ++; - size += style->font_size.computed * NR::expansion(from_2geom(sp_item_i2d_affine(SP_ITEM(obj)))); /// \todo FIXME: we assume non-% units here + size += style->font_size.computed * NR::expansion(sp_item_i2d_affine(SP_ITEM(obj))); /// \todo FIXME: we assume non-% units here if (style->letter_spacing.normal) { if (!different && (letterspacing_prev == 0 || letterspacing_prev == letterspacing)) @@ -1222,7 +1222,7 @@ objects_query_blur (GSList *objects, SPStyle *style_res) if (!style) continue; if (!SP_IS_ITEM(obj)) continue; - NR::Matrix i2d = from_2geom(sp_item_i2d_affine (SP_ITEM(obj))); + NR::Matrix i2d = sp_item_i2d_affine (SP_ITEM(obj)); items ++; diff --git a/src/dialogs/clonetiler.cpp b/src/dialogs/clonetiler.cpp index 07b146fca..048635bb9 100644 --- a/src/dialogs/clonetiler.cpp +++ b/src/dialogs/clonetiler.cpp @@ -1242,7 +1242,7 @@ clonetiler_apply( GtkWidget */*widget*/, void * ) int prefs_bbox = prefs_get_int_attribute("tools", "bounding_box", 0); SPItem::BBoxType bbox_type = (prefs_bbox ==0)? SPItem::APPROXIMATE_BBOX : SPItem::GEOMETRIC_BBOX; - boost::optional r = SP_ITEM(obj)->getBounds(from_2geom(sp_item_i2doc_affine(SP_ITEM(obj))), + boost::optional r = SP_ITEM(obj)->getBounds(sp_item_i2doc_affine(SP_ITEM(obj)), bbox_type); if (r) { w = r->dimensions()[NR::X]; diff --git a/src/dialogs/export.cpp b/src/dialogs/export.cpp index bd4493eae..ddf62f371 100644 --- a/src/dialogs/export.cpp +++ b/src/dialogs/export.cpp @@ -1106,7 +1106,7 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base) } NRRect area; - sp_item_invoke_bbox(item, &area, from_2geom(sp_item_i2r_affine((SPItem *) item)), TRUE); + sp_item_invoke_bbox(item, &area, sp_item_i2r_affine((SPItem *) item), TRUE); gint width = (gint) ((area.x1 - area.x0) * dpi / PX_PER_IN + 0.5); gint height = (gint) ((area.y1 - area.y0) * dpi / PX_PER_IN + 0.5); diff --git a/src/dialogs/stroke-style.cpp b/src/dialogs/stroke-style.cpp index ae387e5f8..373ee5832 100644 --- a/src/dialogs/stroke-style.cpp +++ b/src/dialogs/stroke-style.cpp @@ -615,7 +615,7 @@ sp_marker_prev_new(unsigned psize, gchar const *mname, // Find object's bbox in document Geom::Matrix const i2doc(sp_item_i2doc_affine(SP_ITEM(object))); - boost::optional dbox = SP_ITEM(object)->getBounds(from_2geom(i2doc)); + boost::optional dbox = SP_ITEM(object)->getBounds(i2doc); if (!dbox) { return NULL; diff --git a/src/dialogs/tiledialog.cpp b/src/dialogs/tiledialog.cpp index f9bde3c0b..63732df0b 100644 --- a/src/dialogs/tiledialog.cpp +++ b/src/dialogs/tiledialog.cpp @@ -49,8 +49,8 @@ sp_compare_x_position(SPItem *first, SPItem *second) using NR::X; using NR::Y; - boost::optional a = first->getBounds(from_2geom(sp_item_i2doc_affine(first))); - boost::optional b = second->getBounds(from_2geom(sp_item_i2doc_affine(second))); + boost::optional a = first->getBounds(sp_item_i2doc_affine(first)); + boost::optional b = second->getBounds(sp_item_i2doc_affine(second)); if ( !a || !b ) { // FIXME? @@ -89,8 +89,8 @@ sp_compare_x_position(SPItem *first, SPItem *second) int sp_compare_y_position(SPItem *first, SPItem *second) { - boost::optional a = first->getBounds(from_2geom(sp_item_i2doc_affine(first))); - boost::optional b = second->getBounds(from_2geom(sp_item_i2doc_affine(second))); + boost::optional a = first->getBounds(sp_item_i2doc_affine(first)); + boost::optional b = second->getBounds(sp_item_i2doc_affine(second)); if ( !a || !b ) { // FIXME? @@ -169,7 +169,7 @@ void TileDialog::Grid_Arrange () cnt=0; for (; items != NULL; items = items->next) { SPItem *item = SP_ITEM(items->data); - boost::optional b = item->getBounds(from_2geom(sp_item_i2doc_affine(item))); + boost::optional b = item->getBounds(sp_item_i2doc_affine(item)); if (!b) { continue; } @@ -211,7 +211,7 @@ void TileDialog::Grid_Arrange () const GSList *sizes = sorted; for (; sizes != NULL; sizes = sizes->next) { SPItem *item = SP_ITEM(sizes->data); - boost::optional b = item->getBounds(from_2geom(sp_item_i2doc_affine(item))); + boost::optional b = item->getBounds(sp_item_i2doc_affine(item)); if (b) { width = b->dimensions()[NR::X]; height = b->dimensions()[NR::Y]; @@ -318,7 +318,7 @@ g_print("\n row = %f col = %f selection x= %f selection y = %f", total_row_h for (; current_row != NULL; current_row = current_row->next) { SPItem *item=SP_ITEM(current_row->data); Inkscape::XML::Node *repr = SP_OBJECT_REPR(item); - boost::optional b = item->getBounds(from_2geom(sp_item_i2doc_affine(item))); + boost::optional b = item->getBounds(sp_item_i2doc_affine(item)); NR::Point min; if (b) { width = b->dimensions()[NR::X]; @@ -337,8 +337,8 @@ g_print("\n row = %f col = %f selection x= %f selection y = %f", total_row_h // signs are inverted between x and y due to y inversion NR::Point move = NR::Point(new_x - min[NR::X], min[NR::Y] - new_y); - NR::Matrix const &affine = NR::Matrix(NR::translate(move)); - sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * to_2geom(affine)); + Geom::Matrix const affine = Geom::Matrix(Geom::Translate(move)); + sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * affine); sp_item_write_transform(item, repr, item->transform, NULL); SP_OBJECT (current_row->data)->updateRepr(); cnt +=1; diff --git a/src/dialogs/unclump.cpp b/src/dialogs/unclump.cpp index 923c44add..77c18aa64 100644 --- a/src/dialogs/unclump.cpp +++ b/src/dialogs/unclump.cpp @@ -35,7 +35,7 @@ unclump_center (SPItem *item) return i->second; } - boost::optional r = item->getBounds(from_2geom(sp_item_i2d_affine(item))); + boost::optional r = item->getBounds(sp_item_i2d_affine(item)); if (r) { NR::Point const c = r->midpoint(); c_cache[SP_OBJECT_ID(item)] = c; @@ -54,7 +54,7 @@ unclump_wh (SPItem *item) if ( i != wh_cache.end() ) { wh = i->second; } else { - boost::optional r = item->getBounds(from_2geom(sp_item_i2d_affine(item))); + boost::optional r = item->getBounds(sp_item_i2d_affine(item)); if (r) { wh = r->dimensions(); wh_cache[SP_OBJECT_ID(item)] = wh; @@ -289,7 +289,7 @@ unclump_push (SPItem *from, SPItem *what, double dist) NR::Point p = unclump_center (from); NR::Point by = dist * NR::unit_vector (- (p - it)); - NR::Matrix move = NR::Matrix (NR::translate (by)); + Geom::Matrix move = Geom::Translate (by); std::map::iterator i = c_cache.find(SP_OBJECT_ID(what)); if ( i != c_cache.end() ) { @@ -298,7 +298,7 @@ unclump_push (SPItem *from, SPItem *what, double dist) //g_print ("push %s at %g,%g from %g,%g by %g,%g, dist %g\n", SP_OBJECT_ID(what), it[NR::X],it[NR::Y], p[NR::X],p[NR::Y], by[NR::X],by[NR::Y], dist); - sp_item_set_i2d_affine(what, sp_item_i2d_affine(what) * to_2geom(move)); + sp_item_set_i2d_affine(what, sp_item_i2d_affine(what) * move); sp_item_write_transform(what, SP_OBJECT_REPR(what), what->transform, NULL); } @@ -312,7 +312,7 @@ unclump_pull (SPItem *to, SPItem *what, double dist) NR::Point p = unclump_center (to); NR::Point by = dist * NR::unit_vector (p - it); - NR::Matrix move = NR::Matrix (NR::translate (by)); + Geom::Matrix move = Geom::Translate (by); std::map::iterator i = c_cache.find(SP_OBJECT_ID(what)); if ( i != c_cache.end() ) { @@ -321,7 +321,7 @@ unclump_pull (SPItem *to, SPItem *what, double dist) //g_print ("pull %s at %g,%g to %g,%g by %g,%g, dist %g\n", SP_OBJECT_ID(what), it[NR::X],it[NR::Y], p[NR::X],p[NR::Y], by[NR::X],by[NR::Y], dist); - sp_item_set_i2d_affine(what, sp_item_i2d_affine(what) * to_2geom(move)); + sp_item_set_i2d_affine(what, sp_item_i2d_affine(what) * move); sp_item_write_transform(what, SP_OBJECT_REPR(what), what->transform, NULL); } diff --git a/src/display/canvas-bpath.cpp b/src/display/canvas-bpath.cpp index 5f1262ced..0daf6e69a 100644 --- a/src/display/canvas-bpath.cpp +++ b/src/display/canvas-bpath.cpp @@ -144,7 +144,7 @@ sp_canvas_bpath_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned i cbp->affine = affine; - Geom::Rect bbox = bounds_exact_transformed(cbp->curve->get_pathvector(), to_2geom(affine)); + Geom::Rect bbox = bounds_exact_transformed(cbp->curve->get_pathvector(), affine); item->x1 = (int)bbox.min()[Geom::X] - 1; item->y1 = (int)bbox.min()[Geom::Y] - 1; @@ -178,9 +178,9 @@ sp_canvas_bpath_render (SPCanvasItem *item, SPCanvasBuf *buf) cairo_new_path(buf->ct); if (!dofill) - feed_pathvector_to_cairo (buf->ct, cbp->curve->get_pathvector(), to_2geom(cbp->affine), area, true, 1); + feed_pathvector_to_cairo (buf->ct, cbp->curve->get_pathvector(), cbp->affine, area, true, 1); else - feed_pathvector_to_cairo (buf->ct, cbp->curve->get_pathvector(), to_2geom(cbp->affine), area, false, 1); + feed_pathvector_to_cairo (buf->ct, cbp->curve->get_pathvector(), cbp->affine, area, false, 1); if (dofill) { // RGB / BGR @@ -218,7 +218,7 @@ sp_canvas_bpath_point (SPCanvasItem *item, NR::Point p, SPCanvasItem **actual_it Geom::Rect viewbox = to_2geom(item->canvas->getViewbox()); viewbox.expandBy (width); double dist = NR_HUGE; - pathv_matrix_point_bbox_wind_distance(cbp->curve->get_pathvector(), to_2geom(cbp->affine), to_2geom(p), NULL, NULL, &dist, 0.5, &viewbox); + pathv_matrix_point_bbox_wind_distance(cbp->curve->get_pathvector(), cbp->affine, p, NULL, NULL, &dist, 0.5, &viewbox); if (dist <= 1.0) { *actual_item = item; diff --git a/src/display/inkscape-cairo.cpp b/src/display/inkscape-cairo.cpp index 33a84d508..4895418f0 100644 --- a/src/display/inkscape-cairo.cpp +++ b/src/display/inkscape-cairo.cpp @@ -178,10 +178,10 @@ feed_path_to_cairo (cairo_t *ct, Geom::Path const &path, Geom::Matrix trans, boo return; // Transform all coordinates to coords within "area" - Geom::Point shift = to_2geom(area->min()); + Geom::Point shift = area->min(); NR::Rect view = *area; view.growBy (stroke_width); - view = view * from_2geom(Geom::Translate(-shift)); + view = view * (NR::Matrix)Geom::Translate(-shift); // Pass transformation to feed_curve, so that we don't need to create a whole new path. Geom::Matrix transshift(trans * Geom::Translate(-shift)); diff --git a/src/display/nr-arena-glyphs.cpp b/src/display/nr-arena-glyphs.cpp index a1a14ef1a..0216fe4f9 100644 --- a/src/display/nr-arena-glyphs.cpp +++ b/src/display/nr-arena-glyphs.cpp @@ -465,7 +465,7 @@ nr_arena_glyphs_group_render(cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPi Geom::PathVector const * pathv = g->font->PathVector(g->glyph); cairo_new_path(ct); - Geom::Matrix transform = to_2geom(g->g_transform * group->ctm); + Geom::Matrix transform = g->g_transform * group->ctm; feed_pathvector_to_cairo (ct, *pathv, transform, (pb->area).upgrade(), false, 0); cairo_fill(ct); pb->empty = FALSE; diff --git a/src/display/nr-arena-shape.cpp b/src/display/nr-arena-shape.cpp index 60795becf..554ea2dc9 100644 --- a/src/display/nr-arena-shape.cpp +++ b/src/display/nr-arena-shape.cpp @@ -255,7 +255,7 @@ nr_arena_shape_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, g shape->ctm = gc->transform; if (state & NR_ARENA_ITEM_STATE_BBOX) { if (shape->curve) { - boundingbox = bounds_exact_transformed(shape->curve->get_pathvector(), to_2geom(gc->transform)); + boundingbox = bounds_exact_transformed(shape->curve->get_pathvector(), gc->transform); item->bbox.x0 = (gint32)(boundingbox[0][0] - 1.0F); item->bbox.y0 = (gint32)(boundingbox[1][0] - 1.0F); item->bbox.x1 = (gint32)(boundingbox[0][1] + 1.9999F); @@ -278,7 +278,7 @@ nr_arena_shape_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, g bool outline = (NR_ARENA_ITEM(shape)->arena->rendermode == Inkscape::RENDERMODE_OUTLINE); if (shape->curve) { - boundingbox = bounds_exact_transformed(shape->curve->get_pathvector(), to_2geom(gc->transform)); + boundingbox = bounds_exact_transformed(shape->curve->get_pathvector(), gc->transform); if (shape->_stroke.paint.type() != NRArenaShape::Paint::NONE || outline) { float width, scale; @@ -465,7 +465,7 @@ nr_arena_shape_update_fill(NRArenaShape *shape, NRGC *gc, NRRectL *area, bool fo Path* thePath=new Path; Shape* theShape=new Shape; { - Geom::Matrix tempMat(to_2geom(gc->transform)); + Geom::Matrix tempMat(gc->transform); thePath->LoadPathVector(shape->curve->get_pathvector(), tempMat, true); } @@ -580,7 +580,7 @@ nr_arena_shape_update_stroke(NRArenaShape *shape,NRGC* gc, NRRectL *area) Path* thePath = new Path; Shape* theShape = new Shape; { - Geom::Matrix tempMat( to_2geom(gc->transform) ); + Geom::Matrix tempMat( gc->transform ); thePath->LoadPathVector(shape->curve->get_pathvector(), tempMat, true); } @@ -732,7 +732,7 @@ cairo_arena_shape_render_outline(cairo_t *ct, NRArenaItem *item, boost::optional cairo_set_tolerance(ct, 1.25); // low quality, but good enough for outline mode cairo_new_path(ct); - feed_pathvector_to_cairo (ct, shape->curve->get_pathvector(), to_2geom(shape->ctm), area, true, 0); + feed_pathvector_to_cairo (ct, shape->curve->get_pathvector(), shape->ctm, area, true, 0); cairo_stroke(ct); @@ -813,7 +813,7 @@ cairo_arena_shape_render_stroke(NRArenaItem *item, NRRectL *area, NRPixBlock *pb cairo_set_tolerance(ct, 0.1); cairo_new_path(ct); - feed_pathvector_to_cairo (ct, shape->curve->get_pathvector(), to_2geom(shape->ctm), area->upgrade(), true, style_width); + feed_pathvector_to_cairo (ct, shape->curve->get_pathvector(), shape->ctm, area->upgrade(), true, style_width); cairo_stroke(ct); @@ -988,7 +988,7 @@ cairo_arena_shape_clip(NRArenaItem *item, NRRectL *area, NRPixBlock *pb) cairo_new_path(ct); - feed_pathvector_to_cairo (ct, shape->curve->get_pathvector(), to_2geom(shape->ctm), (area)->upgrade(), false, 0); + feed_pathvector_to_cairo (ct, shape->curve->get_pathvector(), shape->ctm, (area)->upgrade(), false, 0); cairo_fill(ct); @@ -1096,9 +1096,9 @@ nr_arena_shape_pick(NRArenaItem *item, NR::Point p, double delta, unsigned int / if (item->arena->canvasarena) { Geom::Rect viewbox = to_2geom(item->arena->canvasarena->item.canvas->getViewbox()); viewbox.expandBy (width); - pathv_matrix_point_bbox_wind_distance(shape->curve->get_pathvector(), to_2geom(shape->ctm), to_2geom(p), NULL, needfill? &wind : NULL, &dist, 0.5, &viewbox); + pathv_matrix_point_bbox_wind_distance(shape->curve->get_pathvector(), shape->ctm, p, NULL, needfill? &wind : NULL, &dist, 0.5, &viewbox); } else { - pathv_matrix_point_bbox_wind_distance(shape->curve->get_pathvector(), to_2geom(shape->ctm), to_2geom(p), NULL, needfill? &wind : NULL, &dist, 0.5, NULL); + pathv_matrix_point_bbox_wind_distance(shape->curve->get_pathvector(), shape->ctm, p, NULL, needfill? &wind : NULL, &dist, 0.5, NULL); } g_get_current_time (&tfinish); diff --git a/src/draw-context.cpp b/src/draw-context.cpp index b1e97e44b..b321f0f50 100644 --- a/src/draw-context.cpp +++ b/src/draw-context.cpp @@ -619,9 +619,9 @@ spdc_flush_white(SPDrawContext *dc, SPCurve *gc) } /* Now we have to go back to item coordinates at last */ - c->transform(( dc->white_item + c->transform( dc->white_item ? sp_item_dt2i_affine(dc->white_item) - : to_2geom(sp_desktop_dt2root_affine(SP_EVENT_CONTEXT_DESKTOP(dc))) )); + : to_2geom(sp_desktop_dt2root_affine(SP_EVENT_CONTEXT_DESKTOP(dc))) ); SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(dc); SPDocument *doc = sp_desktop_document(desktop); @@ -654,7 +654,7 @@ spdc_flush_white(SPDrawContext *dc, SPCurve *gc) SPItem *item = SP_ITEM(desktop->currentLayer()->appendChildRepr(repr)); dc->selection->set(repr); Inkscape::GC::release(repr); - item->transform = from_2geom(i2i_affine(desktop->currentRoot(), desktop->currentLayer())); + item->transform = i2i_affine(desktop->currentRoot(), desktop->currentLayer()); item->updateRepr(); } diff --git a/src/dyna-draw-context.cpp b/src/dyna-draw-context.cpp index abe4d7dce..c56ba7a4c 100644 --- a/src/dyna-draw-context.cpp +++ b/src/dyna-draw-context.cpp @@ -603,7 +603,7 @@ 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 @@ -982,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); @@ -1019,7 +1019,7 @@ add_cap(SPCurve *curve, double mag = NR::L2(vel); NR::Point v = mag * NR::rot90( to - from ) / NR::L2( to - from ); - curve->curveto(to_2geom(from + v), to_2geom(to + v), to_2geom(to)); + curve->curveto(from + v, to + v, to); } } @@ -1119,8 +1119,8 @@ fit_and_split(SPDynaDrawContext *dc, gboolean release) dc->cal1->reset(); dc->cal2->reset(); - dc->cal1->moveto(to_2geom(dc->point1[0])); - dc->cal2->moveto(to_2geom(dc->point2[0])); + dc->cal1->moveto(dc->point1[0]); + dc->cal2->moveto(dc->point2[0]); } NR::Point b1[BEZIER_MAX_LENGTH]; @@ -1141,13 +1141,13 @@ fit_and_split(SPDynaDrawContext *dc, gboolean release) /* CanvasShape */ if (! release) { dc->currentcurve->reset(); - dc->currentcurve->moveto(to_2geom(b1[0])); + dc->currentcurve->moveto(b1[0]); for (NR::Point *bp1 = b1; bp1 < b1 + BEZIER_SIZE * nb1; bp1 += BEZIER_SIZE) { - dc->currentcurve->curveto(to_2geom(bp1[1]), to_2geom(bp1[2]), to_2geom(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) { - dc->currentcurve->curveto(to_2geom(bp2[2]), to_2geom(bp2[1]), to_2geom(bp2[0])); + dc->currentcurve->curveto(bp2[2], bp2[1], 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 7f662f526..559ce2866 100644 --- a/src/eraser-context.cpp +++ b/src/eraser-context.cpp @@ -730,7 +730,7 @@ set_to_accumulated(SPEraserContext *dc) 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); diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index 48fe3bec2..3a4748b8a 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -190,7 +190,7 @@ static void sp_shape_render (SPItem *item, CairoRenderContext *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; @@ -216,7 +216,7 @@ static void sp_shape_render (SPItem *item, CairoRenderContext *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; @@ -238,7 +238,7 @@ static void sp_shape_render (SPItem *item, CairoRenderContext *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; @@ -409,9 +409,9 @@ static void sp_asbitmap_render(SPItem *item, CairoRenderContext *ctx) Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document); // Get the bounding box of the selection - //boost::optional _bbox = item->getBounds(from_2geom(sp_item_i2d_affine(item))); - // NRRect bbox = item->getBounds(from_2geom(sp_item_i2d_affine(item))); - NRRect bbox(item->getBounds(from_2geom(sp_item_i2d_affine(item)))); + //boost::optional _bbox = item->getBounds(sp_item_i2d_affine(item)); + // NRRect bbox = item->getBounds(sp_item_i2d_affine(item)); + NRRect bbox(item->getBounds(sp_item_i2d_affine(item))); // List of the items to show; all others will be hidden @@ -464,7 +464,7 @@ static void sp_asbitmap_render(SPItem *item, CairoRenderContext *ctx) } */ // Calculate the matrix that will be applied to the image so that it exactly overlaps the source objects - NR::Matrix eek = from_2geom(sp_item_i2d_affine (SP_ITEM(parent_object))); + NR::Matrix eek = sp_item_i2d_affine (SP_ITEM(parent_object)); NR::Matrix t; double shift_x = bbox.x0; @@ -632,7 +632,7 @@ CairoRenderer::setupDocument(CairoRenderContext *ctx, SPDocument *doc) d.y1 = ceil(ctx->_height); } else { SPItem* doc_item = SP_ITEM(sp_document_root(doc)); - sp_item_invoke_bbox(doc_item, &d, from_2geom(sp_item_i2r_affine(doc_item)), TRUE); + sp_item_invoke_bbox(doc_item, &d, sp_item_i2r_affine(doc_item), TRUE); if (ctx->_vector_based_target) { // convert from px to pt d.x0 *= PT_PER_PX; diff --git a/src/extension/internal/emf-win32-print.cpp b/src/extension/internal/emf-win32-print.cpp index 69277440f..6e0a7bf0b 100644 --- a/src/extension/internal/emf-win32-print.cpp +++ b/src/extension/internal/emf-win32-print.cpp @@ -156,7 +156,7 @@ PrintEmfWin32::begin (Inkscape::Extension::Print *mod, SPDocument *doc) d.y1 = _height; } else { SPItem* doc_item = SP_ITEM(sp_document_root(doc)); - sp_item_invoke_bbox(doc_item, &d, from_2geom(sp_item_i2r_affine(doc_item)), TRUE); + sp_item_invoke_bbox(doc_item, &d, sp_item_i2r_affine(doc_item), TRUE); } d.x0 *= IN_PER_PX; diff --git a/src/extension/internal/latex-pstricks.cpp b/src/extension/internal/latex-pstricks.cpp index c1dcec361..eeda6f187 100644 --- a/src/extension/internal/latex-pstricks.cpp +++ b/src/extension/internal/latex-pstricks.cpp @@ -281,7 +281,7 @@ PrintLatex::print_pathvector(SVGOStringStream &os, Geom::PathVector const &pathv // NR::Matrix tf=*transform; // why was this here? NR::Matrix tf_stack=m_tr_stack.top(); // and why is transform argument not used? - Geom::PathVector pathv = pathv_in * to_2geom(tf_stack); // generates new path, which is a bit slow, but this doesn't have to be performance optimized + Geom::PathVector pathv = pathv_in * tf_stack; // generates new path, which is a bit slow, but this doesn't have to be performance optimized os << "\\newpath\n"; diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp index 959070b50..8ad9b5031 100644 --- a/src/extension/internal/odf.cpp +++ b/src/extension/internal/odf.cpp @@ -945,7 +945,7 @@ static Glib::ustring formatTransform(NR::Matrix &tf) static NR::Matrix getODFTransform(const SPItem *item) { //### Get SVG-to-ODF transform - NR::Matrix tf = from_2geom(sp_item_i2d_affine(item)); + NR::Matrix tf (sp_item_i2d_affine(item)); //Flip Y into document coordinates double doc_height = sp_document_height(SP_ACTIVE_DOCUMENT); NR::Matrix doc2dt_tf = NR::Matrix(NR::scale(1.0, -1.0)); @@ -2041,7 +2041,7 @@ bool OdfOutput::writeTree(Writer &couts, Writer &souts, couts.printf(" svg:d=\""); int nrPoints = writePath(couts, curve->get_pathvector(), - to_2geom(tf), bbox_x, bbox_y); + tf, bbox_x, bbox_y); couts.printf("\""); couts.printf(">\n"); diff --git a/src/extension/internal/pdf-cairo.cpp b/src/extension/internal/pdf-cairo.cpp index 0ff571275..2b3c93824 100644 --- a/src/extension/internal/pdf-cairo.cpp +++ b/src/extension/internal/pdf-cairo.cpp @@ -334,7 +334,7 @@ PrintCairoPDF::begin(Inkscape::Extension::Print *mod, SPDocument *doc) d.y1 = _height; } else { // if not page, use our base, which is either root or the item we want to export - sp_item_invoke_bbox(doc_item, &d, from_2geom(sp_item_i2doc_affine (doc_item)), TRUE); + sp_item_invoke_bbox(doc_item, &d, sp_item_i2doc_affine (doc_item), TRUE); // convert from px to pt d.x0 *= PT_PER_PX; d.x1 *= PT_PER_PX; @@ -348,7 +348,7 @@ PrintCairoPDF::begin(Inkscape::Extension::Print *mod, SPDocument *doc) // object itself, ignoring its ancestors // complete transform, including doc_item's own transform - t = from_2geom(sp_item_i2doc_affine (doc_item)); + t = sp_item_i2doc_affine (doc_item); // subreact doc_item's transform (comes first) from it t = NR::Matrix(doc_item->transform).inverse() * t; diff --git a/src/extension/internal/ps.cpp b/src/extension/internal/ps.cpp index 6f1405de2..15b0bd8f4 100644 --- a/src/extension/internal/ps.cpp +++ b/src/extension/internal/ps.cpp @@ -412,7 +412,7 @@ PrintPS::begin(Inkscape::Extension::Print *mod, SPDocument *doc) d.y1 = ceil(_height); } else { SPItem* doc_item = SP_ITEM(sp_document_root(doc)); - sp_item_invoke_bbox(doc_item, &d, from_2geom(sp_item_i2r_affine(doc_item)), TRUE); + sp_item_invoke_bbox(doc_item, &d, sp_item_i2r_affine(doc_item), TRUE); // convert from px to pt d.x0 *= PT_PER_PX; d.x1 *= PT_PER_PX; diff --git a/src/filter-chemistry.cpp b/src/filter-chemistry.cpp index af8cfbfa1..0c516aa27 100644 --- a/src/filter-chemistry.cpp +++ b/src/filter-chemistry.cpp @@ -330,7 +330,7 @@ new_filter_simple_from_item (SPDocument *document, SPItem *item, const char *mod width = height = 0; } - NR::Matrix i2d = from_2geom(sp_item_i2d_affine (item) ); + NR::Matrix i2d (sp_item_i2d_affine (item) ); return (new_filter_blend_gaussian_blur (document, mode, radius, NR::expansion(i2d), NR::expansionX(i2d), NR::expansionY(i2d), width, height)); } @@ -367,7 +367,7 @@ modify_filter_gaussian_blur_from_item(SPDocument *document, SPItem *item, } // Determine the required standard deviation value - NR::Matrix i2d = from_2geom(sp_item_i2d_affine (item)); + NR::Matrix i2d (sp_item_i2d_affine (item)); double expansion = NR::expansion(i2d); double stdDeviation = radius; if (expansion != 0) diff --git a/src/flood-context.cpp b/src/flood-context.cpp index 0c284db68..634ee4732 100644 --- a/src/flood-context.cpp +++ b/src/flood-context.cpp @@ -510,7 +510,7 @@ static void do_trace(bitmap_coords_info bci, guchar *trace_px, SPDesktop *deskto sp_item_write_transform(SP_ITEM(reprobj), pathRepr, transform, NULL); // premultiply the item transform by the accumulated parent transform in the paste layer - NR::Matrix local = from_2geom(sp_item_i2doc_affine(SP_GROUP(desktop->currentLayer()))); + NR::Matrix local (sp_item_i2doc_affine(SP_GROUP(desktop->currentLayer()))); if (!local.test_identity()) { gchar const *t_str = pathRepr->attribute("transform"); NR::Matrix item_t (NR::identity()); diff --git a/src/gradient-chemistry.cpp b/src/gradient-chemistry.cpp index c6dd26712..afbf16009 100644 --- a/src/gradient-chemistry.cpp +++ b/src/gradient-chemistry.cpp @@ -824,7 +824,7 @@ sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, NR:: gradient = sp_gradient_convert_to_userspace (gradient, item, fill_or_stroke? "fill" : "stroke"); - NR::Matrix i2d = from_2geom(sp_item_i2d_affine (item)); + NR::Matrix i2d (sp_item_i2d_affine (item)); NR::Point p = p_w * i2d.inverse(); p *= (gradient->gradientTransform).inverse(); // now p is in gradient's original coordinates @@ -1101,7 +1101,7 @@ sp_item_gradient_get_coords (SPItem *item, guint point_type, guint point_i, bool bbox->min()[NR::X], bbox->min()[NR::Y]); } } - p *= NR::Matrix(gradient->gradientTransform) * from_2geom(sp_item_i2d_affine(item)); + p *= NR::Matrix(gradient->gradientTransform) * (NR::Matrix)sp_item_i2d_affine(item); return p; } diff --git a/src/helper/pixbuf-ops.cpp b/src/helper/pixbuf-ops.cpp index 00ba4508b..94976da27 100644 --- a/src/helper/pixbuf-ops.cpp +++ b/src/helper/pixbuf-ops.cpp @@ -122,7 +122,7 @@ sp_generate_internal_bitmap(SPDocument *doc, gchar const */*filename*/, /* Create ArenaItems and set transform */ NRArenaItem *root = sp_item_invoke_show(SP_ITEM(sp_document_root(doc)), arena, dkey, SP_ITEM_SHOW_DISPLAY); - nr_arena_item_set_transform(NR_ARENA_ITEM(root), from_2geom(affine)); + nr_arena_item_set_transform(NR_ARENA_ITEM(root), affine); NRGC gc(NULL); gc.transform.set_identity(); diff --git a/src/helper/png-write.cpp b/src/helper/png-write.cpp index a08f9a939..84816ad9c 100644 --- a/src/helper/png-write.cpp +++ b/src/helper/png-write.cpp @@ -362,7 +362,7 @@ sp_export_png_file(SPDocument *doc, gchar const *filename, /* Create ArenaItems and set transform */ ebp.root = sp_item_invoke_show(SP_ITEM(sp_document_root(doc)), arena, dkey, SP_ITEM_SHOW_DISPLAY); - nr_arena_item_set_transform(NR_ARENA_ITEM(ebp.root), from_2geom(affine)); + nr_arena_item_set_transform(NR_ARENA_ITEM(ebp.root), affine); // We show all and then hide all items we don't want, instead of showing only requested items, // because that would not work if the shown item references something in defs diff --git a/src/interface.cpp b/src/interface.cpp index 0ec73d81b..0259ecb66 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -1189,7 +1189,7 @@ sp_ui_drag_data_received(GtkWidget *widget, ( !SP_OBJECT_STYLE(item)->stroke.isNone() ? desktop->current_zoom() * SP_OBJECT_STYLE (item)->stroke_width.computed * - NR::expansion(from_2geom(sp_item_i2d_affine(item))) * 0.5 + NR::expansion(sp_item_i2d_affine(item)) * 0.5 : 0.0) + prefs_get_int_attribute_limited("options.dragtolerance", "value", 0, 0, 100); diff --git a/src/knot-holder-entity.cpp b/src/knot-holder-entity.cpp index 82ec9cf90..99aa67052 100644 --- a/src/knot-holder-entity.cpp +++ b/src/knot-holder-entity.cpp @@ -104,13 +104,13 @@ KnotHolderEntity::snap_knot_position(Geom::Point const &p) static gdouble sp_pattern_extract_theta(SPPattern *pat) { - Geom::Matrix transf = to_2geom(pat->patternTransform); + Geom::Matrix transf = pat->patternTransform; return Geom::atan2(transf.xAxis()); } static Geom::Point sp_pattern_extract_scale(SPPattern *pat) { - Geom::Matrix transf = to_2geom(pat->patternTransform); + Geom::Matrix transf = pat->patternTransform; return Geom::Point( transf.expansionX(), transf.expansionY() ); } @@ -215,7 +215,7 @@ PatternKnotHolderEntityScale::knot_set(Geom::Point const &p, Geom::Point const & scl = Geom::Scale(d[NR::X] / pat_x, d[NR::Y] / pat_y); } - NR::Matrix rot = from_2geom(scl) * NR::Matrix(NR::rotate(theta)); + Geom::Matrix rot = (Geom::Matrix)scl * Geom::Rotate(theta); Geom::Point const t = sp_pattern_extract_trans(pat); rot[4] = t[NR::X]; diff --git a/src/knotholder.cpp b/src/knotholder.cpp index f4892b008..f7935c7c3 100644 --- a/src/knotholder.cpp +++ b/src/knotholder.cpp @@ -78,7 +78,7 @@ KnotHolder::~KnotHolder() { void KnotHolder::update_knots() { - NR::Matrix const i2d(from_2geom(sp_item_i2d_affine(item))); + NR::Matrix const i2d(sp_item_i2d_affine(item)); for(std::list::iterator i = entity.begin(); i != entity.end(); ++i) { KnotHolderEntity *e = *i; diff --git a/src/libnrtype/Layout-TNG-Output.cpp b/src/libnrtype/Layout-TNG-Output.cpp index 36c882d44..b2de090a0 100644 --- a/src/libnrtype/Layout-TNG-Output.cpp +++ b/src/libnrtype/Layout-TNG-Output.cpp @@ -158,7 +158,7 @@ void Layout::print(SPPrintContext *ctx, Geom::PathVector const * pv = span.font->PathVector(_glyphs[glyph_index].glyph); if (pv) { _getGlyphTransformMatrix(glyph_index, &glyph_matrix); - Geom::PathVector temp_pv = (*pv) * to_2geom(glyph_matrix); + Geom::PathVector temp_pv = (*pv) * glyph_matrix; if (!text_source->style->fill.isNone()) sp_print_fill(ctx, temp_pv, &ctm, text_source->style, pbox, dbox, bbox); if (!text_source->style->stroke.isNone()) @@ -232,7 +232,7 @@ void Layout::showGlyphs(CairoRenderContext *ctx) const if (clip_mode) { Geom::PathVector const *pathv = span.font->PathVector(_glyphs[glyph_index].glyph); if (pathv) { - Geom::PathVector pathv_trans = (*pathv) * to_2geom(glyph_matrix); + Geom::PathVector pathv_trans = (*pathv) * glyph_matrix; SPStyle const *style = text_source->style; ctx->renderPathVector(pathv_trans, style, NULL); } @@ -547,7 +547,7 @@ SPCurve *Layout::convertToCurves(iterator const &from_glyph, iterator const &to_ Geom::PathVector const * pathv = span.font->PathVector(_glyphs[glyph_index].glyph); if (pathv) { - Geom::PathVector pathv_trans = (*pathv) * to_2geom(glyph_matrix); + Geom::PathVector pathv_trans = (*pathv) * glyph_matrix; SPCurve *c = new SPCurve(pathv_trans); if (c) cc = g_slist_prepend(cc, c); } diff --git a/src/livarot/PathCutting.cpp b/src/livarot/PathCutting.cpp index 47956031f..b5905778b 100644 --- a/src/livarot/PathCutting.cpp +++ b/src/livarot/PathCutting.cpp @@ -303,7 +303,7 @@ Path::MakePathVector() { /* TODO: add testcase for this descr_arcto case */ PathDescrArcTo *nData = dynamic_cast(descr_cmd[i]); - currentpath->appendNew( nData->rx, nData->ry, nData->angle, nData->large, !nData->clockwise, to_2geom(nData->p) ); + currentpath->appendNew( nData->rx, nData->ry, nData->angle, nData->large, !nData->clockwise, nData->p ); lastP = nData->p; } break; @@ -382,7 +382,7 @@ void Path::AddCurve(Geom::Curve const &c) { if( is_straight_curve(c) ) { - LineTo( from_2geom(c.finalPoint()) ); + LineTo( c.finalPoint() ); } /* else if(Geom::QuadraticBezier const *quadratic_bezier = dynamic_cast(c)) { @@ -393,10 +393,10 @@ void Path::AddCurve(Geom::Curve const &c) Geom::Point tmp = (*cubic_bezier)[3]; Geom::Point tms = 3 * ((*cubic_bezier)[1] - (*cubic_bezier)[0]); Geom::Point tme = 3 * ((*cubic_bezier)[3] - (*cubic_bezier)[2]); - CubicTo (from_2geom(tmp), from_2geom(tms), from_2geom(tme)); + CubicTo (tmp, tms, tme); } else if(Geom::SVGEllipticalArc const *svg_elliptical_arc = dynamic_cast(&c)) { - ArcTo( from_2geom(svg_elliptical_arc->finalPoint()), + ArcTo( svg_elliptical_arc->finalPoint(), svg_elliptical_arc->ray(0), svg_elliptical_arc->ray(1), svg_elliptical_arc->rotation_angle(), svg_elliptical_arc->large_arc_flag(), !svg_elliptical_arc->sweep_flag() ); @@ -426,7 +426,7 @@ void Path::LoadPath(Geom::Path const &path, Geom::Matrix const &tr, bool doTran // directly on the curve parameters Geom::Path const pathtr = doTransformation ? path * tr : path; - MoveTo( from_2geom(pathtr.initialPoint()) ); + MoveTo( pathtr.initialPoint() ); for(Geom::Path::const_iterator cit = pathtr.begin(); cit != pathtr.end_open(); ++cit) { AddCurve(*cit); diff --git a/src/live_effects/lpe-mirror_symmetry.cpp b/src/live_effects/lpe-mirror_symmetry.cpp index 834877f36..bb2b908de 100644 --- a/src/live_effects/lpe-mirror_symmetry.cpp +++ b/src/live_effects/lpe-mirror_symmetry.cpp @@ -47,7 +47,7 @@ LPEMirrorSymmetry::doOnApply (SPLPEItem *lpeitem) SPItem *item = SP_ITEM(lpeitem); Geom::Matrix t = sp_item_i2d_affine(item); - Geom::Rect bbox = item->getBounds(t); + Geom::Rect bbox = to_2geom(*item->getBounds(t)); // fixme: what happens if getBounds does not return a valid rect? Point A(bbox.left(), bbox.bottom()); Point B(bbox.left(), bbox.top()); diff --git a/src/live_effects/lpegroupbbox.cpp b/src/live_effects/lpegroupbbox.cpp index bd4b5d093..c11e99ecd 100644 --- a/src/live_effects/lpegroupbbox.cpp +++ b/src/live_effects/lpegroupbbox.cpp @@ -27,7 +27,7 @@ GroupBBoxEffect::original_bbox(SPLPEItem *lpeitem, bool absolute) transform = Geom::identity(); } - Geom::Rect itemBBox = item->getBounds(transform, SPItem::GEOMETRIC_BBOX); + Geom::Rect itemBBox = to_2geom(*item->getBounds(transform, SPItem::GEOMETRIC_BBOX)); // fixme: fix for when getBounds returns invalid Rect boundingbox_X = itemBBox[Geom::X]; boundingbox_Y = itemBBox[Geom::Y]; } diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp index 0c7a701f1..107f5b249 100644 --- a/src/live_effects/parameter/point.cpp +++ b/src/live_effects/parameter/point.cpp @@ -89,7 +89,7 @@ PointParam::param_newWidget(Gtk::Tooltips * /*tooltips*/) param_effect->getSPDoc() ) ); // TODO: fix to get correct desktop (don't use SP_ACTIVE_DESKTOP) SPDesktop *desktop = SP_ACTIVE_DESKTOP; - Geom::Matrix transf = to_2geom(desktop->doc2dt()); + Geom::Matrix transf = desktop->doc2dt(); pointwdg->setTransform(transf); pointwdg->setValue( *this ); pointwdg->clearProgrammatically(); diff --git a/src/main.cpp b/src/main.cpp index d6f0ae9e8..f19dac81c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -920,7 +920,7 @@ do_query_dimension (SPDocument *doc, bool extent, NR::Dim2 const axis, const gch SPItem *item = ((SPItem *) o); // "true" SVG bbox for scripting - boost::optional area = item->getBounds(from_2geom(sp_item_i2doc_affine(item))); + boost::optional area = item->getBounds(sp_item_i2doc_affine(item)); if (area) { Inkscape::SVGOStringStream os; if (extent) { @@ -953,7 +953,7 @@ do_query_all_recurse (SPObject *o) { SPItem *item = ((SPItem *) o); if (o->id && SP_IS_ITEM(item)) { - boost::optional area = item->getBounds(from_2geom(sp_item_i2doc_affine(item))); + boost::optional area = item->getBounds(sp_item_i2doc_affine(item)); if (area) { Inkscape::SVGOStringStream os; os << o->id; @@ -1045,7 +1045,7 @@ sp_do_export_png(SPDocument *doc) // write object bbox to area sp_document_ensure_up_to_date (doc); - sp_item_invoke_bbox((SPItem *) o_area, &area, from_2geom(sp_item_i2r_affine((SPItem *) o_area)), TRUE); + sp_item_invoke_bbox((SPItem *) o_area, &area, sp_item_i2r_affine((SPItem *) o_area), TRUE); } else { g_warning("Object with id=\"%s\" was not found in the document. Nothing exported.", sp_export_id); return; diff --git a/src/marker.cpp b/src/marker.cpp index 98d485c33..d77aa87d6 100644 --- a/src/marker.cpp +++ b/src/marker.cpp @@ -655,11 +655,11 @@ sp_marker_show_instance ( SPMarker *marker, NRArenaItem *parent, if (v->items[pos]) { NR::Matrix m; if (marker->orient_auto) { - m = from_2geom(base); + m = base; } else { /* fixme: Orient units (Lauris) */ m = NR::Matrix(rotate_degrees(marker->orient)); - m *= get_translation(from_2geom(base)); + m *= NR::get_translation(base); } if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) { m = NR::scale(linewidth) * m; diff --git a/src/nodepath.cpp b/src/nodepath.cpp index 017544901..82a5e841c 100644 --- a/src/nodepath.cpp +++ b/src/nodepath.cpp @@ -160,7 +160,7 @@ Inkscape::NodePath::Node * Inkscape::NodePath::Path::active_node = NULL; static SPCanvasItem * sp_nodepath_make_helper_item(Inkscape::NodePath::Path *np, /*SPDesktop *desktop, */const SPCurve *curve, bool show = false) { SPCurve *helper_curve = curve->copy(); - helper_curve->transform(to_2geom(np->i2d)); + helper_curve->transform(np->i2d); SPCanvasItem *helper_path = sp_canvas_bpath_new(sp_desktop_controls(np->desktop), helper_curve); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(helper_path), np->helperpath_rgba, np->helperpath_width, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(helper_path), 0, SP_WIND_RULE_NONZERO); @@ -218,7 +218,7 @@ sp_nodepath_update_helperpaths(Inkscape::NodePath::Path *np) { std::vector hpaths = lpe->getHelperPaths(lpeitem); for (unsigned int j = 0; j < hpaths.size(); ++j) { SPCurve *curve = new SPCurve(hpaths[j]); - curve->transform(to_2geom(np->i2d)); + curve->transform(np->i2d); sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(((*np->helper_path_vec)[lpe])[j]), curve); curve = curve->unref(); } @@ -310,7 +310,7 @@ Inkscape::NodePath::Path *sp_nodepath_new(SPDesktop *desktop, SPObject *object, // to a change in repr by regenerating nodepath --bb sp_object_read_attr(SP_OBJECT(np->item), "transform"); - np->i2d = from_2geom(sp_item_i2d_affine(np->item)); + np->i2d = sp_item_i2d_affine(np->item); np->d2i = np->i2d.inverse(); np->repr = repr; @@ -523,7 +523,7 @@ static void subpaths_from_pathvector(Inkscape::NodePath::Path *np, Geom::PathVec Inkscape::NodePath::SubPath *sp = sp_nodepath_subpath_new(np); - NR::Point ppos = from_2geom(pit->initialPoint()) * np->i2d; + NR::Point ppos = pit->initialPoint() * (Geom::Matrix)np->i2d; NRPathcode pcode = NR_MOVETO; /* Johan: Note that this is pretty arcane code. I am pretty sure it is working correctly, be very certain to change it! (better to just rewrite this whole method)*/ @@ -532,19 +532,19 @@ static void subpaths_from_pathvector(Inkscape::NodePath::Path *np, Geom::PathVec dynamic_cast(&*cit) || dynamic_cast(&*cit) ) { - NR::Point pos = from_2geom(cit->initialPoint()) * np->i2d; + NR::Point pos = cit->initialPoint() * (Geom::Matrix)np->i2d; sp_nodepath_node_new(sp, NULL, t[i++], pcode, &ppos, &pos, &pos); - ppos = from_2geom(cit->finalPoint()) * np->i2d; + ppos = cit->finalPoint() * (Geom::Matrix)np->i2d; pcode = NR_LINETO; } else if(Geom::CubicBezier const *cubic_bezier = dynamic_cast(&*cit)) { std::vector points = cubic_bezier->points(); - NR::Point pos = from_2geom(points[0]) * np->i2d; - NR::Point npos = from_2geom(points[1]) * np->i2d; + NR::Point pos = points[0] * (Geom::Matrix)np->i2d; + NR::Point npos = points[1] * (Geom::Matrix)np->i2d; sp_nodepath_node_new(sp, NULL, t[i++], pcode, &ppos, &pos, &npos); - ppos = from_2geom(points[2]) * np->i2d; + ppos = points[2] * (Geom::Matrix)np->i2d; pcode = NR_CURVETO; } } @@ -555,7 +555,7 @@ static void subpaths_from_pathvector(Inkscape::NodePath::Path *np, Geom::PathVec * If the length is zero, don't add it to the nodepath. */ Geom::Curve const &closing_seg = pit->back_closed(); if ( ! closing_seg.isDegenerate() ) { - NR::Point pos = from_2geom(closing_seg.finalPoint()) * np->i2d; + NR::Point pos = closing_seg.finalPoint() * (Geom::Matrix)np->i2d; sp_nodepath_node_new(sp, NULL, t[i++], NR_LINETO, &pos, &pos, &pos); } @@ -616,7 +616,7 @@ static void update_object(Inkscape::NodePath::Path *np) if (np->show_helperpath) { SPCurve * helper_curve = np->curve->copy(); - helper_curve->transform(to_2geom(np->i2d)); + helper_curve->transform(np->i2d); sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(np->helper_path), helper_curve); helper_curve->unref(); } @@ -660,7 +660,7 @@ static void update_repr_internal(Inkscape::NodePath::Path *np) if (np->show_helperpath) { SPCurve * helper_curve = np->curve->copy(); - helper_curve->transform(to_2geom(np->i2d)); + helper_curve->transform(np->i2d); sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(np->helper_path), helper_curve); helper_curve->unref(); } @@ -4287,7 +4287,7 @@ void sp_nodepath_flip (Inkscape::NodePath::Path *nodepath, NR::Dim2 axis, boost: Geom::Rect box = sp_node_selected_bbox (nodepath); if (!center) { - center = from_2geom(box.midpoint()); + center = box.midpoint(); } NR::Matrix t = NR::Matrix (NR::translate(- *center)) * @@ -4892,7 +4892,7 @@ void sp_nodepath_show_helperpath(Inkscape::NodePath::Path *np, bool show) { if (show) { SPCurve *helper_curve = np->curve->copy(); - helper_curve->transform(to_2geom(np->i2d)); + helper_curve->transform(np->i2d); if (!np->helper_path) { //np->helper_path = sp_nodepath_make_helper_item(np, desktop, helper_curve, true); // Caution: this applies the transform np->i2d twice!! diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp index ad5874a7e..3bebc7b22 100644 --- a/src/object-snapper.cpp +++ b/src/object-snapper.cpp @@ -146,11 +146,11 @@ void Inkscape::ObjectSnapper::_findCandidates(SPObject* parent, // insert an additional transformation in document coordinates (code copied from sp_item_i2d_affine) sp_item_invoke_bbox(item, &bbox_of_item, - from_2geom(sp_item_i2doc_affine(item) * matrix_to_desktop(to_2geom(additional_affine), item)), + sp_item_i2doc_affine(item) * matrix_to_desktop(additional_affine, item), true); } else { - sp_item_invoke_bbox(item, &bbox_of_item, from_2geom(sp_item_i2d_affine(item)), true); + sp_item_invoke_bbox(item, &bbox_of_item, sp_item_i2d_affine(item), true); } // See if the item is within range if (bbox_of_item) { @@ -345,7 +345,7 @@ void Inkscape::ObjectSnapper::_collectPaths(Inkscape::Snapper::PointType const & root_item = sp_use_root(SP_USE((*i).item)); g_return_if_fail(root_item); } else { - i2doc = from_2geom(sp_item_i2doc_affine((*i).item)); + i2doc = sp_item_i2doc_affine((*i).item); root_item = (*i).item; } @@ -377,7 +377,7 @@ void Inkscape::ObjectSnapper::_collectPaths(Inkscape::Snapper::PointType const & SPCurve *curve = curve_for_item(root_item); if (curve) { // We will get our own copy of the path, which must be freed at some point - Geom::PathVector *borderpathv = pathvector_for_curve(root_item, curve, true, true, Geom::identity(), to_2geom((*i).additional_affine)); + Geom::PathVector *borderpathv = pathvector_for_curve(root_item, curve, true, true, Geom::identity(), (*i).additional_affine); _paths_to_snap_to->push_back(borderpathv); // Perhaps for speed, get a reference to the Geom::pathvector, and store the transformation besides it. curve->unref(); } @@ -417,7 +417,7 @@ void Inkscape::ObjectSnapper::_snapPaths(SnappedConstraints &sc, ** in SPDesktop rather than SPNamedView? */ SPDesktop const *desktop = SP_ACTIVE_DESKTOP; - Geom::Point const p_doc = to_2geom(desktop->dt2doc(p)); + Geom::Point const p_doc = desktop->dt2doc(p); bool const node_tool_active = _snap_to_itempath && selected_path != NULL; @@ -475,8 +475,8 @@ void Inkscape::ObjectSnapper::_snapPaths(SnappedConstraints &sc, * piece are unselected; if they are then this piece must be stationary */ g_assert(unselected_nodes != NULL); - c1 = isUnselectedNode(from_2geom(start_pt), unselected_nodes); - c2 = isUnselectedNode(from_2geom(end_pt), unselected_nodes); + c1 = isUnselectedNode(start_pt, unselected_nodes); + c2 = isUnselectedNode(end_pt, unselected_nodes); } Geom::Point const sp_doc = (*it_pv).pointAt(*np); @@ -489,14 +489,14 @@ void Inkscape::ObjectSnapper::_snapPaths(SnappedConstraints &sc, //Geom::Curve const & curve = (*it_pv).at_index(int(t)); if(is_straight_curve((*it_pv).at_index(int(t)))) { // if we snap to a line segment, then return this line segment (leaves 1 DOF for snapping) - sc.lines.push_back(Inkscape::SnappedLineSegment(from_2geom(sp_dt), dist, getSnapperTolerance(), getSnapperAlwaysSnap(), from_2geom(start_pt), from_2geom(end_pt))); + sc.lines.push_back(Inkscape::SnappedLineSegment(sp_dt, dist, getSnapperTolerance(), getSnapperAlwaysSnap(), start_pt, end_pt)); } else { // for curves other than line segments, we'll return just the closest snapped point // (this is a fully constrained snap, no degrees of freedom left) if (dist < s.getDistance()) { // If this curve has multiple segments, then we will return only // a single snapped point - s = SnappedPoint(from_2geom(sp_dt), SNAPTARGET_PATH, dist, getSnapperTolerance(), getSnapperAlwaysSnap()); + s = SnappedPoint(sp_dt, SNAPTARGET_PATH, dist, getSnapperTolerance(), getSnapperAlwaysSnap()); success = true; } } @@ -752,10 +752,10 @@ void Inkscape::ObjectSnapper::_getBorderNodes(std::vector *points) co { Geom::Coord w = sp_document_width(_named_view->document); Geom::Coord h = sp_document_height(_named_view->document); - points->push_back(from_2geom(Geom::Point(0,0))); - points->push_back(from_2geom(Geom::Point(0,h))); - points->push_back(from_2geom(Geom::Point(w,h))); - points->push_back(from_2geom(Geom::Point(w,0))); + points->push_back(Geom::Point(0,0)); + points->push_back(Geom::Point(0,h)); + points->push_back(Geom::Point(w,h)); + points->push_back(Geom::Point(w,0)); } /* diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index 9dfa760ea..c4855e7d3 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(to_2geom(item->getRelativeTransform(SP_OBJECT(first)))); + c->transform(item->getRelativeTransform(SP_OBJECT(first))); curve->append(c, false); c->unref(); } @@ -221,7 +221,7 @@ sp_selected_path_break_apart(void) gchar *style = g_strdup(SP_OBJECT(item)->repr->attribute("style")); gchar *path_effect = g_strdup(SP_OBJECT(item)->repr->attribute("inkscape:path-effect")); - Geom::PathVector apv = curve->get_pathvector() * to_2geom(SP_ITEM(path)->transform); + Geom::PathVector apv = curve->get_pathvector() * SP_ITEM(path)->transform; curve->unref(); diff --git a/src/pen-context.cpp b/src/pen-context.cpp index ef59aeb31..30b09013b 100644 --- a/src/pen-context.cpp +++ b/src/pen-context.cpp @@ -888,7 +888,7 @@ pen_redraw_all (SPPenContext *const pc) if ( cubic && (*cubic)[2] != to_2geom(pc->p[0]) ) { - NR::Point p2 = from_2geom((*cubic)[2]); + NR::Point p2 = (*cubic)[2]; SP_CTRL(pc->c0)->moveto(p2); sp_ctrlline_set_coords(SP_CTRLLINE(pc->cl0), p2, pc->p[0]); sp_canvas_item_show (pc->c0); @@ -936,7 +936,7 @@ pen_lastpoint_tocurve (SPPenContext *const pc) Geom::CubicBezier const * cubic = dynamic_cast( pc->green_curve->last_segment() ); if ( cubic ) { - pc->p[1] = pc->p[0] + from_2geom( (*cubic)[3] - (*cubic)[2] ); + pc->p[1] = pc->p[0] + (NR::Point)( (*cubic)[3] - (*cubic)[2] ); } else { pc->p[1] = pc->p[0] + (1./3)*(pc->p[3] - pc->p[0]); } @@ -1130,12 +1130,12 @@ pen_handle_key_press(SPPenContext *const pc, GdkEvent *event) Geom::Curve const * crv = &path.back_default(); pc->p[0] = crv->initialPoint(); if ( Geom::CubicBezier const * cubic = dynamic_cast(crv)) { - pc->p[1] = from_2geom( (*cubic)[1] ); + pc->p[1] = (*cubic)[1]; } else { pc->p[1] = pc->p[0]; } NR::Point const pt(( pc->npoints < 4 - ? from_2geom(crv->finalPoint()) + ? (NR::Point)(crv->finalPoint()) : pc->p[3] )); pc->npoints = 2; pc->green_curve->backspace(); diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 435deea5c..c6e2e6153 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -132,7 +132,7 @@ void sp_selection_copy_impl (GSList const *items, GSList **clip, Inkscape::XML:: // Copy item reprs: for (GSList *i = (GSList *) sorted_items; i != NULL; i = i->next) { - sp_selection_copy_one (SP_OBJECT_REPR (i->data), from_2geom(sp_item_i2doc_affine(SP_ITEM (i->data))), clip, xml_doc); + sp_selection_copy_one (SP_OBJECT_REPR (i->data), sp_item_i2doc_affine(SP_ITEM (i->data)), clip, xml_doc); } *clip = g_slist_reverse(*clip); @@ -150,7 +150,7 @@ GSList *sp_selection_paste_impl (SPDocument *doc, SPObject *parent, GSList **cli Inkscape::XML::Node *copy = repr->duplicate(xml_doc); // premultiply the item transform by the accumulated parent transform in the paste layer - NR::Matrix local = from_2geom(sp_item_i2doc_affine(SP_ITEM(parent))); + NR::Matrix local (sp_item_i2doc_affine(SP_ITEM(parent))); if (!local.test_identity()) { gchar const *t_str = copy->attribute("transform"); NR::Matrix item_t (NR::identity()); @@ -498,7 +498,7 @@ void sp_selection_group() NR::Matrix item_t (NR::identity()); if (t_str) sp_svg_transform_read(t_str, &item_t); - item_t *= from_2geom(sp_item_i2doc_affine(SP_ITEM(doc->getObjectByRepr(current->parent())))); + item_t *= sp_item_i2doc_affine(SP_ITEM(doc->getObjectByRepr(current->parent()))); //FIXME: when moving both clone and original from a transformed group (either by //grouping into another parent, or by cut/paste) the transform from the original's //parent becomes embedded into original itself, and this affects its clones. Fix @@ -907,7 +907,7 @@ take_style_from_item (SPItem *item) } // FIXME: also transform gradient/pattern fills, by forking? NO, this must be nondestructive - double ex = NR::expansion(from_2geom(sp_item_i2doc_affine(item))); + double ex = NR::expansion(sp_item_i2doc_affine(item)); if (ex != 1.0) { css = sp_css_attr_scale (css, ex); } @@ -1232,9 +1232,9 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, NR::Matrix const sp_object_read_attr (SP_OBJECT (item), "transform"); // calculate the matrix we need to apply to the clone to cancel its induced transform from its original - NR::Matrix parent_transform = from_2geom(sp_item_i2root_affine(SP_ITEM(SP_OBJECT_PARENT (item)))); - NR::Matrix t = parent_transform * from_2geom(matrix_to_desktop (matrix_from_desktop (to_2geom(affine), item), item)) * parent_transform.inverse(); - NR::Matrix t_inv =parent_transform * from_2geom(matrix_to_desktop (matrix_from_desktop (to_2geom(affine.inverse()), item), item)) * parent_transform.inverse(); + NR::Matrix parent_transform = sp_item_i2root_affine(SP_ITEM(SP_OBJECT_PARENT (item))); + NR::Matrix t = parent_transform * from_2geom(matrix_to_desktop (matrix_from_desktop (affine, item), item)) * parent_transform.inverse(); + NR::Matrix t_inv =parent_transform * from_2geom(matrix_to_desktop (matrix_from_desktop (affine.inverse(), item), item)) * parent_transform.inverse(); NR::Matrix result = t_inv * item->transform * t; if ((prefs_parallel || prefs_unmoved) && affine.is_translation()) { @@ -1262,7 +1262,7 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, NR::Matrix const } else { if (set_i2d) { - sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * to_2geom(affine)); + sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * (Geom::Matrix)affine); } sp_item_write_transform(item, SP_OBJECT_REPR(item), item->transform, NULL); } @@ -2084,8 +2084,8 @@ sp_select_clone_original() bool highlight = prefs_get_int_attribute ("options.highlightoriginal", "value", 0); if (highlight) { - boost::optional a = item->getBounds(from_2geom(sp_item_i2d_affine(item))); - boost::optional b = original->getBounds(from_2geom(sp_item_i2d_affine(original))); + boost::optional a = item->getBounds(sp_item_i2d_affine(item)); + boost::optional b = original->getBounds(sp_item_i2d_affine(original)); if ( a && b ) { // draw a flashing line between the objects SPCurve *curve = new SPCurve(); @@ -2145,7 +2145,7 @@ void sp_selection_to_marker(bool apply) // bottommost object, after sorting SPObject *parent = SP_OBJECT_PARENT (items->data); - NR::Matrix parent_transform = from_2geom(sp_item_i2root_affine(SP_ITEM(parent))); + NR::Matrix parent_transform (sp_item_i2root_affine(SP_ITEM(parent))); // remember the position of the first item gint pos = SP_OBJECT_REPR (items->data)->position(); @@ -2267,7 +2267,7 @@ sp_selection_tile(bool apply) // bottommost object, after sorting SPObject *parent = SP_OBJECT_PARENT (items->data); - NR::Matrix parent_transform = from_2geom(sp_item_i2root_affine(SP_ITEM(parent))); + NR::Matrix parent_transform (sp_item_i2root_affine(SP_ITEM(parent))); // remember the position of the first item gint pos = SP_OBJECT_REPR (items->data)->position(); @@ -2593,7 +2593,7 @@ sp_selection_create_bitmap_copy () } // Calculate the matrix that will be applied to the image so that it exactly overlaps the source objects - NR::Matrix eek = from_2geom(sp_item_i2d_affine (SP_ITEM(parent_object))); + NR::Matrix eek (sp_item_i2d_affine (SP_ITEM(parent_object))); NR::Matrix t; double shift_x = bbox.x0; @@ -2937,7 +2937,7 @@ fit_canvas_to_drawing(SPDocument *doc) sp_document_ensure_up_to_date(doc); SPItem const *const root = SP_ITEM(doc->root); - boost::optional const bbox(root->getBounds(from_2geom(sp_item_i2r_affine(root)))); + boost::optional const bbox(root->getBounds(sp_item_i2r_affine(root))); if (bbox && !bbox->isEmpty()) { doc->fitToRect(*bbox); return true; diff --git a/src/selection.cpp b/src/selection.cpp index b71f27815..9e134ff08 100644 --- a/src/selection.cpp +++ b/src/selection.cpp @@ -407,7 +407,7 @@ NRRect *Selection::boundsInDocument(NRRect *bbox, SPItem::BBoxType type) const { for ( GSList const *iter=items ; iter != NULL ; iter = iter->next ) { SPItem *item=SP_ITEM(iter->data); - NR::Matrix i2doc(from_2geom(sp_item_i2doc_affine(item))); + Geom::Matrix i2doc(sp_item_i2doc_affine(item)); sp_item_invoke_bbox(item, bbox, i2doc, FALSE, type); } diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 0b297318d..562fc760e 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -268,7 +268,7 @@ void Inkscape::SelTrans::grab(NR::Point const &p, gdouble x, gdouble y, bool sho SPItem *it = (SPItem *)sp_object_ref(SP_OBJECT(l->data), NULL); _items.push_back(it); _items_const.push_back(it); - _items_affines.push_back(from_2geom(sp_item_i2d_affine(it))); + _items_affines.push_back(sp_item_i2d_affine(it)); _items_centers.push_back(it->getCenter()); // for content-dragging, we need to remember original centers } @@ -372,7 +372,7 @@ void Inkscape::SelTrans::transform(NR::Matrix const &rel_affine, NR::Point const for (unsigned i = 0; i < _items.size(); i++) { SPItem &item = *_items[i]; NR::Matrix const &prev_transform = _items_affines[i]; - sp_item_set_i2d_affine(&item, to_2geom(prev_transform * affine)); + sp_item_set_i2d_affine(&item, prev_transform * affine); } } else { if (_bbox) { @@ -525,9 +525,9 @@ void Inkscape::SelTrans::stamp() NR::Matrix const *new_affine; if (_show == SHOW_OUTLINE) { - NR::Matrix const i2d(from_2geom(sp_item_i2d_affine(original_item))); + NR::Matrix const i2d(sp_item_i2d_affine(original_item)); NR::Matrix const i2dnew( i2d * _current_relative_affine ); - sp_item_set_i2d_affine(copy_item, to_2geom(i2dnew)); + sp_item_set_i2d_affine(copy_item, i2dnew); new_affine = ©_item->transform; } else { new_affine = &original_item->transform; diff --git a/src/shape-editor.cpp b/src/shape-editor.cpp index 2b7ec4c3d..8e5ea77b5 100644 --- a/src/shape-editor.cpp +++ b/src/shape-editor.cpp @@ -349,7 +349,7 @@ bool ShapeEditor::is_over_stroke (NR::Point event_p, bool remember) { //Translate click point into proper coord system this->curvepoint_doc = desktop->w2d(event_p); - this->curvepoint_doc *= from_2geom(sp_item_dt2i_affine(item)); + this->curvepoint_doc *= sp_item_dt2i_affine(item); SPCurve *curve = this->nodepath->curve; // not sure if np->curve is always up to date... Geom::PathVector const &pathv = curve->get_pathvector(); @@ -364,9 +364,9 @@ bool ShapeEditor::is_over_stroke (NR::Point event_p, bool remember) { (( !SP_OBJECT_STYLE(item)->stroke.isNone() ? desktop->current_zoom() * SP_OBJECT_STYLE (item)->stroke_width.computed * 0.5 * - NR::expansion(from_2geom(sp_item_i2d_affine(item))) + NR::expansion(sp_item_i2d_affine(item)) : 0.0) - + prefs_get_int_attribute_limited("options.dragtolerance", "value", 0, 0, 100)) /NR::expansion(from_2geom(sp_item_i2d_affine(item))); + + prefs_get_int_attribute_limited("options.dragtolerance", "value", 0, 0, 100)) /NR::expansion(sp_item_i2d_affine(item)); bool close = (NR::L2 (delta) < stroke_tolerance); if (remember && close) { diff --git a/src/snap.cpp b/src/snap.cpp index 46b9ecad2..9c9a69a98 100644 --- a/src/snap.cpp +++ b/src/snap.cpp @@ -280,7 +280,7 @@ Geom::Point SnapManager::multipleOfGridPitch(Geom::Point const &t) const } if (success) - return to_2geom(nearest_multiple); + return nearest_multiple; } return t; diff --git a/src/sp-conn-end-pair.cpp b/src/sp-conn-end-pair.cpp index 6ef374684..328f5a696 100644 --- a/src/sp-conn-end-pair.cpp +++ b/src/sp-conn-end-pair.cpp @@ -167,7 +167,7 @@ SPConnEndPair::getEndpoints(NR::Point endPts[]) const { for (unsigned h = 0; h < 2; ++h) { if ( h2attItem[h] ) { - boost::optional bbox = h2attItem[h]->getBounds(from_2geom(sp_item_i2doc_affine(h2attItem[h]))); + boost::optional bbox = h2attItem[h]->getBounds(sp_item_i2doc_affine(h2attItem[h])); if (bbox) { endPts[h] = bbox->midpoint(); } else { diff --git a/src/sp-conn-end.cpp b/src/sp-conn-end.cpp index 127262540..40017912f 100644 --- a/src/sp-conn-end.cpp +++ b/src/sp-conn-end.cpp @@ -60,7 +60,7 @@ sp_conn_end_move_compensate(NR::Matrix const */*mp*/, SPItem */*moved_item*/, SPItem const *const path_item = SP_ITEM(path); SPObject const *const ancestor = get_nearest_common_ancestor(path_item, h2attItem); - NR::Matrix const path2anc(from_2geom(i2anc_affine(path_item, ancestor))); + NR::Matrix const path2anc(i2anc_affine(path_item, ancestor)); if (h2attItem[0] != NULL && h2attItem[1] != NULL) { /* Initial end-points: centre of attached object. */ @@ -81,7 +81,7 @@ sp_conn_end_move_compensate(NR::Matrix const */*mp*/, SPItem */*moved_item*/, return; } h2bbox_icoordsys[h] = *bbox; - h2i2anc[h] = from_2geom(i2anc_affine(h2attItem[h], ancestor)); + h2i2anc[h] = i2anc_affine(h2attItem[h], ancestor); h2endPt_icoordsys[h] = h2bbox_icoordsys[h].midpoint(); } @@ -125,7 +125,7 @@ sp_conn_end_move_compensate(NR::Matrix const */*mp*/, SPItem */*moved_item*/, } h2bbox_icoordsys[ind] = *bbox; - h2i2anc = from_2geom(i2anc_affine(h2attItem[ind], ancestor)); + h2i2anc = i2anc_affine(h2attItem[ind], ancestor); h2endPt_icoordsys[ind] = h2bbox_icoordsys[ind].midpoint(); h2endPt_icoordsys[!ind] = other_endpt; diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index 1970a8034..889e8b8ff 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -255,7 +255,7 @@ static void sp_genericellipse_snappoints(SPItem const *item, SnapPointsIter p) SPGenericEllipse *ellipse = SP_GENERICELLIPSE(item); sp_genericellipse_normalize(ellipse); - NR::Matrix const i2d = from_2geom(sp_item_i2d_affine(item)); + NR::Matrix const i2d = sp_item_i2d_affine(item); // figure out if we have a slice, whilst guarding against rounding errors bool slice = false; diff --git a/src/sp-flowregion.cpp b/src/sp-flowregion.cpp index cbfb51195..490407f81 100644 --- a/src/sp-flowregion.cpp +++ b/src/sp-flowregion.cpp @@ -188,7 +188,7 @@ void SPFlowregion::UpdateComputed(void) { SPObject* object=SP_OBJECT(this); - NR::Matrix itr_mat = from_2geom(sp_item_i2root_affine (SP_ITEM(object))); + NR::Matrix itr_mat (sp_item_i2root_affine (SP_ITEM(object))); itr_mat = itr_mat.inverse(); for (std::vector::iterator it = computed.begin() ; it != computed.end() ; it++) @@ -410,7 +410,7 @@ void SPFlowregionExclude::UpdateComputed(void) delete computed; computed = NULL; } - NR::Matrix itr_mat = from_2geom(sp_item_i2root_affine (SP_ITEM(object))); + NR::Matrix itr_mat (sp_item_i2root_affine (SP_ITEM(object))); itr_mat = itr_mat.inverse(); for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { @@ -525,7 +525,7 @@ static void GetDest(SPObject* child,Shape **computed,NR::Matrix itr_mat) if ( curve ) { Path* temp=new Path; Geom::Matrix tr_mat = sp_item_i2root_affine (SP_ITEM(u_child)); - tr_mat = to_2geom(itr_mat) * tr_mat; + tr_mat = (Geom::Matrix)itr_mat * tr_mat; temp->LoadPathVector(curve->get_pathvector(), tr_mat, true); Shape* n_shp=new Shape; temp->Convert(0.25); diff --git a/src/sp-flowtext.cpp b/src/sp-flowtext.cpp index f6ba68911..5c3ff8a95 100644 --- a/src/sp-flowtext.cpp +++ b/src/sp-flowtext.cpp @@ -363,7 +363,7 @@ sp_flowtext_print(SPItem *item, SPPrintContext *ctx) dbox.y0 = 0.0; dbox.x1 = sp_document_width(SP_OBJECT_DOCUMENT(item)); dbox.y1 = sp_document_height(SP_OBJECT_DOCUMENT(item)); - NR::Matrix const ctm = from_2geom(sp_item_i2d_affine(item)); + NR::Matrix const ctm (sp_item_i2d_affine(item)); group->layout.print(ctx, &pbox, &dbox, &bbox, ctm); } diff --git a/src/sp-image.cpp b/src/sp-image.cpp index f1e645d6f..5a02517e2 100644 --- a/src/sp-image.cpp +++ b/src/sp-image.cpp @@ -1314,7 +1314,7 @@ static void sp_image_snappoints(SPItem const *item, SnapPointsIter p) double const y0 = image.y.computed; double const x1 = x0 + image.width.computed; double const y1 = y0 + image.height.computed; - NR::Matrix const i2d (from_2geom(sp_item_i2d_affine (item))); + NR::Matrix const i2d (sp_item_i2d_affine (item)); *p = NR::Point(x0, y0) * i2d; *p = NR::Point(x0, y1) * i2d; *p = NR::Point(x1, y1) * i2d; diff --git a/src/sp-item-notify-moveto.cpp b/src/sp-item-notify-moveto.cpp index bf7393013..391766fb6 100644 --- a/src/sp-item-notify-moveto.cpp +++ b/src/sp-item-notify-moveto.cpp @@ -41,7 +41,7 @@ void sp_item_notify_moveto(SPItem &item, SPGuide const &mv_g, int const snappoin s = (position - pos0) / dot(dir, dir). */ NR::translate const tr( ( position - pos0 ) * ( dir / dir_lensq ) ); - sp_item_set_i2d_affine(&item, sp_item_i2d_affine(&item) * to_2geom(tr)); + sp_item_set_i2d_affine(&item, sp_item_i2d_affine(&item) * tr); /// \todo Reget snappoints, check satisfied. if (commit) { diff --git a/src/sp-item-transform.cpp b/src/sp-item-transform.cpp index 6a6ab4fc4..fd9e9314b 100644 --- a/src/sp-item-transform.cpp +++ b/src/sp-item-transform.cpp @@ -33,7 +33,7 @@ sp_item_rotate_rel(SPItem *item, NR::rotate const &rotation) NR::Matrix affine = NR::Matrix(inverse(s)) * NR::Matrix(rotation) * NR::Matrix(s); // Rotate item. - sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * to_2geom(affine)); + sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * (Geom::Matrix)affine); // Use each item's own transform writer, consistent with sp_selection_apply_affine() sp_item_write_transform(item, SP_OBJECT_REPR(item), item->transform); @@ -48,8 +48,8 @@ sp_item_scale_rel (SPItem *item, NR::scale const &scale) { boost::optional bbox = sp_item_bbox_desktop(item); if (bbox) { - NR::translate const s(bbox->midpoint()); // use getCenter? - sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * to_2geom(NR::Matrix(inverse(s)) * scale * s)); + Geom::Translate const s(bbox->midpoint()); // use getCenter? + sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * s.inverse() * (Geom::Matrix)(NR::Matrix)scale * s); sp_item_write_transform(item, SP_OBJECT_REPR(item), item->transform); } } @@ -63,7 +63,7 @@ sp_item_skew_rel (SPItem *item, double skewX, double skewY) NR::Matrix const skew(1, skewY, skewX, 1, 0, 0); NR::Matrix affine = NR::Matrix(inverse(s)) * skew * NR::Matrix(s); - sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * to_2geom(affine)); + sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * (Geom::Matrix)affine); sp_item_write_transform(item, SP_OBJECT_REPR(item), item->transform); // Restore the center position (it's changed because the bbox center changed) @@ -74,7 +74,7 @@ sp_item_skew_rel (SPItem *item, double skewX, double skewY) void sp_item_move_rel(SPItem *item, NR::translate const &tr) { - sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * to_2geom(tr)); + sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * tr); sp_item_write_transform(item, SP_OBJECT_REPR(item), item->transform); } diff --git a/src/sp-item.cpp b/src/sp-item.cpp index b0b6d8137..f88d7b9e0 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -287,7 +287,7 @@ SPItem::setExplicitlyHidden(bool const val) { */ void SPItem::setCenter(NR::Point object_centre) { - boost::optional bbox = getBounds(from_2geom(sp_item_i2d_affine(this))); + boost::optional bbox = getBounds(sp_item_i2d_affine(this)); if (bbox) { transform_center_x = object_centre[NR::X] - bbox->midpoint()[NR::X]; if (fabs(transform_center_x) < 1e-5) // rounding error @@ -309,7 +309,7 @@ bool SPItem::isCenterSet() { } NR::Point SPItem::getCenter() const { - boost::optional bbox = getBounds(from_2geom(sp_item_i2d_affine(this))); + boost::optional bbox = getBounds(sp_item_i2d_affine(this)); if (bbox) { return bbox->midpoint() + NR::Point (this->transform_center_x, this->transform_center_y); } else { @@ -702,22 +702,6 @@ boost::optional SPItem::getBounds(NR::Matrix const &transform, return r; } -/* - * If the item is empty, or has an empty boundingbox for another reason, this method will - * return an empty rectangle. I.e. "getBounds(...).isEmpty() == true". - */ -Geom::Rect -SPItem::getBounds(Geom::Matrix const &transform, SPItem::BBoxType type, unsigned int /*dkey*/) -const -{ - boost::optional r; - sp_item_invoke_bbox_full(this, &r, from_2geom(transform), type, TRUE); - if (r) - return to_2geom(*r); - else - return Geom::Rect(); // return empty rectangle -} - void sp_item_invoke_bbox(SPItem const *item, boost::optional *bbox, NR::Matrix const &transform, unsigned const clear, SPItem::BBoxType type) { @@ -800,7 +784,7 @@ sp_item_invoke_bbox_full(SPItem const *item, boost::optional *bbox, NR } // transform the expansions by the item's transform: - NR::Matrix i2d = from_2geom(sp_item_i2d_affine (item)); + NR::Matrix i2d(sp_item_i2d_affine (item)); dx0 *= NR::expansionX(i2d); dx1 *= NR::expansionX(i2d); dy0 *= NR::expansionY(i2d); @@ -910,19 +894,19 @@ sp_item_bbox_desktop(SPItem *item, NRRect *bbox, SPItem::BBoxType type) g_assert(SP_IS_ITEM(item)); g_assert(bbox != NULL); - sp_item_invoke_bbox(item, bbox, from_2geom(sp_item_i2d_affine(item)), TRUE, type); + sp_item_invoke_bbox(item, bbox, sp_item_i2d_affine(item), TRUE, type); } boost::optional sp_item_bbox_desktop(SPItem *item, SPItem::BBoxType type) { boost::optional rect = boost::optional(); - sp_item_invoke_bbox(item, &rect, from_2geom(sp_item_i2d_affine(item)), TRUE, type); + sp_item_invoke_bbox(item, &rect, sp_item_i2d_affine(item), TRUE, type); return rect; } static void sp_item_private_snappoints(SPItem const *item, SnapPointsIter p) { - boost::optional bbox = item->getBounds(from_2geom(sp_item_i2d_affine(item))); + boost::optional bbox = item->getBounds(sp_item_i2d_affine(item)); /* Just the corners of the bounding box suffices given that we don't yet support angled guide lines. */ @@ -971,7 +955,7 @@ void sp_item_snappoints(SPItem const *item, bool includeItemCenter, SnapPointsIt for (std::vector::const_iterator p_orig = p_clip_or_mask.begin(); p_orig != p_clip_or_mask.end(); p_orig++) { // All snappoints are in desktop coordinates, but the item's transformation is // in document coordinates. Hence the awkward construction below - *p = (*p_orig) * from_2geom(matrix_to_desktop (matrix_from_desktop (to_2geom(item->transform), item), item)); + *p = (*p_orig) * from_2geom(matrix_to_desktop (matrix_from_desktop (item->transform, item), item)); } } } @@ -1351,7 +1335,7 @@ sp_item_adjust_livepatheffect (SPItem *item, NR::Matrix const &postmul, bool set if (lpeobj->lpe) { Inkscape::LivePathEffect::Effect * effect = lpeobj->lpe; - effect->transform_multiply(to_2geom(postmul), set); + effect->transform_multiply(postmul, set); } } } @@ -1508,9 +1492,9 @@ i2anc_affine(SPObject const *object, SPObject const *const ancestor) { /* stop at first non-renderable ancestor */ while ( object != ancestor && SP_IS_ITEM(object) ) { if (SP_IS_ROOT(object)) { - ret *= to_2geom(SP_ROOT(object)->c2p); + ret *= SP_ROOT(object)->c2p; } - ret *= to_2geom(SP_ITEM(object)->transform); + ret *= SP_ITEM(object)->transform; object = SP_OBJECT_PARENT(object); } return ret; @@ -1524,7 +1508,7 @@ i2i_affine(SPObject const *src, SPObject const *dest) { } NR::Matrix SPItem::getRelativeTransform(SPObject const *dest) const { - return from_2geom(i2i_affine(this, dest)); + return i2i_affine(this, dest); } /** @@ -1549,12 +1533,12 @@ Geom::Matrix sp_item_i2root_affine(SPItem const *item) Geom::Matrix ret(Geom::identity()); g_assert(ret.isIdentity()); while ( NULL != SP_OBJECT_PARENT(item) ) { - ret *= to_2geom(item->transform); + ret *= item->transform; item = SP_ITEM(SP_OBJECT_PARENT(item)); } g_assert(SP_IS_ROOT(item)); - ret *= to_2geom(item->transform); + ret *= item->transform; return ret; } @@ -1622,7 +1606,7 @@ void sp_item_set_i2d_affine(SPItem *item, Geom::Matrix const &i2dt) } Geom::Matrix const i2p( i2dt * dt2p ); - sp_item_set_item_transform(item, from_2geom(i2p)); + sp_item_set_item_transform(item, i2p); } diff --git a/src/sp-item.h b/src/sp-item.h index 581b6acdd..358f3d75c 100644 --- a/src/sp-item.h +++ b/src/sp-item.h @@ -155,7 +155,6 @@ struct SPItem : public SPObject { void lowerToBottom(); boost::optional getBounds(NR::Matrix const &transform, BBoxType type=APPROXIMATE_BBOX, unsigned int dkey=0) const; - Geom::Rect getBounds(Geom::Matrix const &transform, BBoxType type=APPROXIMATE_BBOX, unsigned int dkey=0) const; sigc::connection _clip_ref_connection; sigc::connection _mask_ref_connection; diff --git a/src/sp-path.cpp b/src/sp-path.cpp index e0e10b6de..427a7d6cf 100644 --- a/src/sp-path.cpp +++ b/src/sp-path.cpp @@ -360,10 +360,9 @@ 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(to_2geom(xform)); - sp_lpe_item_update_patheffect(path, true, true); + path->original_curve->transform(xform); } else { - shape->curve->transform(to_2geom(xform)); + shape->curve->transform(xform); } // Adjust stroke @@ -511,7 +510,7 @@ void freehand_create_single_dot(SPEventContext *ec, NR::Point const &pt, char co /* put the circle where the mouse click occurred and set the diameter to the current stroke width, multiplied by the amount specified in the preferences */ - NR::Matrix const i2d (from_2geom(sp_item_i2d_affine (item))); + NR::Matrix const i2d (sp_item_i2d_affine (item)); NR::Point pp = pt * i2d; double rad = 0.5 * prefs_get_double_attribute(tool, "dot-size", 3.0); if (event_state & GDK_MOD1_MASK) { diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp index 08d30b4f4..b573300e0 100644 --- a/src/sp-rect.cpp +++ b/src/sp-rect.cpp @@ -560,7 +560,7 @@ static void sp_rect_snappoints(SPItem const *item, SnapPointsIter p) SPRect *rect = SP_RECT(item); - NR::Matrix const i2d (from_2geom(sp_item_i2d_affine (item))); + NR::Matrix const i2d (sp_item_i2d_affine (item)); *p = NR::Point(rect->x.computed, rect->y.computed) * i2d; *p = NR::Point(rect->x.computed, rect->y.computed + rect->height.computed) * i2d; @@ -579,7 +579,7 @@ sp_rect_convert_to_guides(SPItem *item) { std::list > pts; - NR::Matrix const i2d (from_2geom(sp_item_i2d_affine(SP_ITEM(rect)))); + NR::Matrix const i2d (sp_item_i2d_affine(SP_ITEM(rect))); NR::Point A1(NR::Point(rect->x.computed, rect->y.computed) * i2d); NR::Point A2(NR::Point(rect->x.computed, rect->y.computed + rect->height.computed) * i2d); diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index 054310472..96b52fd46 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -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; diff --git a/src/sp-text.cpp b/src/sp-text.cpp index 0390df6bf..09b926e63 100644 --- a/src/sp-text.cpp +++ b/src/sp-text.cpp @@ -493,7 +493,7 @@ sp_text_print (SPItem *item, SPPrintContext *ctx) dbox.y0 = 0.0; dbox.x1 = sp_document_width (SP_OBJECT_DOCUMENT (item)); dbox.y1 = sp_document_height (SP_OBJECT_DOCUMENT (item)); - NR::Matrix const ctm = from_2geom(sp_item_i2d_affine(item)); + NR::Matrix const ctm (sp_item_i2d_affine(item)); group->layout.print(ctx,&pbox,&dbox,&bbox,ctm); } diff --git a/src/sp-tspan.cpp b/src/sp-tspan.cpp index 0b3be7072..c86c852d7 100644 --- a/src/sp-tspan.cpp +++ b/src/sp-tspan.cpp @@ -578,7 +578,7 @@ sp_textpath_to_text(SPObject *tp) SPObject *text = SP_OBJECT_PARENT(tp); NRRect bbox; - sp_item_invoke_bbox(SP_ITEM(text), &bbox, from_2geom(sp_item_i2doc_affine(SP_ITEM(text))), TRUE); + sp_item_invoke_bbox(SP_ITEM(text), &bbox, sp_item_i2doc_affine(SP_ITEM(text)), TRUE); NR::Point xy(bbox.x0, bbox.y0); // make a list of textpath children diff --git a/src/sp-use-reference.cpp b/src/sp-use-reference.cpp index 5b5011381..e493e6afa 100644 --- a/src/sp-use-reference.cpp +++ b/src/sp-use-reference.cpp @@ -231,7 +231,7 @@ void SPUsePath::refresh_source() } } originalPath = new Path; - originalPath->LoadPathVector(curve->get_pathvector(), to_2geom(item->transform), true); + originalPath->LoadPathVector(curve->get_pathvector(), item->transform, true); curve->unref(); } diff --git a/src/splivarot.cpp b/src/splivarot.cpp index 06ae89ba0..47051be2b 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -461,7 +461,7 @@ sp_selected_path_boolop(bool_op bop, const unsigned int verb, const Glib::ustrin // adjust style properties that depend on a possible transform in the source object in order // to get a correct style attribute for the new path SPItem* item_source = SP_ITEM(source); - NR::Matrix i2root = from_2geom(sp_item_i2root_affine(item_source)); + NR::Matrix i2root(sp_item_i2root_affine(item_source)); sp_item_adjust_stroke(item_source, NR::expansion(i2root)); sp_item_adjust_pattern(item_source, i2root); sp_item_adjust_gradient(item_source, i2root); @@ -493,7 +493,7 @@ sp_selected_path_boolop(bool_op bop, const unsigned int verb, const Glib::ustrin // premultiply by the inverse of parent's repr SPItem *parent_item = SP_ITEM(sp_desktop_document(desktop)->getObjectByRepr(parent)); - NR::Matrix local = from_2geom(sp_item_i2doc_affine(parent_item)); + NR::Matrix local (sp_item_i2doc_affine(parent_item)); gchar *transform = sp_svg_transform_write(local.inverse()); // now that we have the result, add it on the canvas @@ -607,7 +607,7 @@ void sp_selected_path_outline_add_marker( SPObject *marker_object, Geom::Matrix SPMarker* marker = SP_MARKER (marker_object); SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (marker_object)); - NR::Matrix tr(from_2geom(marker_transform)); + NR::Matrix tr(marker_transform); if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) { tr = stroke_scale * tr; @@ -1631,7 +1631,7 @@ sp_selected_path_simplify_items(SPDesktop *desktop, continue; if (simplifyIndividualPaths) { - boost::optional itemBbox = item->getBounds(from_2geom(sp_item_i2d_affine(item))); + boost::optional itemBbox = item->getBounds(sp_item_i2d_affine(item)); if (itemBbox) { simplifySize = L2(itemBbox->dimensions()); } else { @@ -1779,7 +1779,7 @@ pathvector_for_curve(SPItem *item, SPCurve *curve, bool doTransformation, bool t if (transformFull) { *dest *= extraPreAffine * sp_item_i2doc_affine(item) * extraPostAffine; } else { - *dest *= extraPreAffine * to_2geom(item->transform) * extraPostAffine; + *dest *= extraPreAffine * (Geom::Matrix)item->transform * extraPostAffine; } } else { *dest *= extraPreAffine * extraPostAffine; diff --git a/src/svg/svg-affine.cpp b/src/svg/svg-affine.cpp index d6715a580..a34736176 100644 --- a/src/svg/svg-affine.cpp +++ b/src/svg/svg-affine.cpp @@ -43,7 +43,7 @@ sp_svg_transform_read(gchar const *str, Geom::Matrix *transform) { NR::Matrix mat; if (sp_svg_transform_read(str, &mat)) { - *transform = to_2geom(mat); + *transform = mat; return true; } else { return false; @@ -184,7 +184,7 @@ sp_svg_transform_write(Geom::Matrix const &transform) gchar * sp_svg_transform_write(Geom::Matrix const *transform) { - NR::Matrix const t(from_2geom(*transform)); + NR::Matrix const t(*transform); return sp_svg_transform_write(&t); } diff --git a/src/text-chemistry.cpp b/src/text-chemistry.cpp index 9cce92ef8..0eeac8c4f 100644 --- a/src/text-chemistry.cpp +++ b/src/text-chemistry.cpp @@ -429,7 +429,7 @@ text_unflow () rtext->setAttribute("style", SP_OBJECT_REPR(flowtext)->attribute("style")); // fixme: transfer style attrs too; and from descendants NRRect bbox; - sp_item_invoke_bbox(SP_ITEM(flowtext), &bbox, from_2geom(sp_item_i2doc_affine(SP_ITEM(flowtext))), TRUE); + sp_item_invoke_bbox(SP_ITEM(flowtext), &bbox, sp_item_i2doc_affine(SP_ITEM(flowtext)), TRUE); NR::Point xy(bbox.x0, bbox.y0); if (xy[NR::X] != 1e18 && xy[NR::Y] != 1e18) { sp_repr_set_svg_double(rtext, "x", xy[NR::X]); diff --git a/src/text-context.cpp b/src/text-context.cpp index 5e0e1ee8e..6d26bee2b 100644 --- a/src/text-context.cpp +++ b/src/text-context.cpp @@ -1638,7 +1638,7 @@ static void sp_text_context_update_text_selection(SPTextContext *tc) std::vector quads; if (tc->text != NULL) - quads = sp_te_create_selection_quads(tc->text, tc->text_sel_start, tc->text_sel_end, from_2geom(sp_item_i2d_affine(tc->text))); + quads = sp_te_create_selection_quads(tc->text, tc->text_sel_start, tc->text_sel_end, sp_item_i2d_affine(tc->text)); for (unsigned i = 0 ; i < quads.size() ; i += 4) { SPCanvasItem *quad_canvasitem; quad_canvasitem = sp_canvas_item_new(sp_desktop_controls(tc->desktop), SP_TYPE_CTRLQUADR, NULL); diff --git a/src/text-editing.cpp b/src/text-editing.cpp index ffac0e227..be098b7e9 100644 --- a/src/text-editing.cpp +++ b/src/text-editing.cpp @@ -80,7 +80,7 @@ sp_te_input_is_empty (SPObject const *item) Inkscape::Text::Layout::iterator sp_te_get_position_by_coords (SPItem const *item, NR::Point &i_p) { - NR::Matrix im = from_2geom(sp_item_i2d_affine (item)); + NR::Matrix im (sp_item_i2d_affine (item)); im = im.inverse(); NR::Point p = i_p * im; @@ -948,7 +948,7 @@ sp_te_adjust_kerning_screen (SPItem *item, Inkscape::Text::Layout::iterator cons // divide increment by zoom // divide increment by matrix expansion gdouble factor = 1 / desktop->current_zoom(); - NR::Matrix t = from_2geom(sp_item_i2doc_affine(item)); + NR::Matrix t (sp_item_i2doc_affine(item)); factor = factor / NR::expansion(t); by = factor * by; @@ -970,7 +970,7 @@ sp_te_adjust_rotation_screen(SPItem *text, Inkscape::Text::Layout::iterator cons // divide increment by zoom // divide increment by matrix expansion gdouble factor = 1 / desktop->current_zoom(); - NR::Matrix t = from_2geom(sp_item_i2doc_affine(text)); + NR::Matrix t (sp_item_i2doc_affine(text)); factor = factor / NR::expansion(t); Inkscape::Text::Layout const *layout = te_get_layout(text); if (layout == NULL) return; @@ -1055,7 +1055,7 @@ sp_te_adjust_tspan_letterspacing_screen(SPItem *text, Inkscape::Text::Layout::it gdouble const zoom = desktop->current_zoom(); gdouble const zby = (by / (zoom * (nb_let > 1 ? nb_let - 1 : 1)) - / NR::expansion(from_2geom(sp_item_i2doc_affine(SP_ITEM(source_obj))))); + / NR::expansion(sp_item_i2doc_affine(SP_ITEM(source_obj)))); val += zby; if (start == end) { @@ -1127,7 +1127,7 @@ sp_te_adjust_linespacing_screen (SPItem *text, Inkscape::Text::Layout::iterator gdouble zby = by / (desktop->current_zoom() * (line_count == 0 ? 1 : line_count)); // divide increment by matrix expansion - NR::Matrix t = from_2geom(sp_item_i2doc_affine (SP_ITEM(text))); + NR::Matrix t (sp_item_i2doc_affine (SP_ITEM(text))); zby = zby / NR::expansion(t); switch (style->line_height.unit) { diff --git a/src/tweak-context.cpp b/src/tweak-context.cpp index e670a2db4..86d7e6da2 100644 --- a/src/tweak-context.cpp +++ b/src/tweak-context.cpp @@ -366,7 +366,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, NR::Poi // skip those paths whose bboxes are entirely out of reach with our radius - boost::optional bbox = item->getBounds(from_2geom(sp_item_i2doc_affine(item))); + boost::optional bbox = item->getBounds(sp_item_i2doc_affine(item)); if (bbox) { bbox->growBy(radius); if (!bbox->contains(p)) { @@ -384,7 +384,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, NR::Poi Shape *theShape = new Shape; Shape *theRes = new Shape; - NR::Matrix i2doc(from_2geom(sp_item_i2doc_affine(item))); + NR::Matrix i2doc(sp_item_i2doc_affine(item)); orig->ConvertWithBackData((0.08 - (0.07 * fidelity)) / NR::expansion(i2doc)); // default 0.059 orig->Fill(theShape, 0); @@ -603,7 +603,7 @@ tweak_colors_in_gradient (SPItem *item, bool fill_or_stroke, if (!gradient || !SP_IS_GRADIENT(gradient)) return; - NR::Matrix i2d = from_2geom(sp_item_i2doc_affine (item)); + NR::Matrix i2d (sp_item_i2doc_affine (item)); NR::Point p = p_w * i2d.inverse(); p *= (gradient->gradientTransform).inverse(); // now p is in gradient's original coordinates @@ -736,7 +736,7 @@ sp_tweak_color_recursive (guint mode, SPItem *item, SPItem *item_at_point, if (!style) { return false; } - boost::optional bbox = item->getBounds(from_2geom(sp_item_i2doc_affine(item)), + boost::optional bbox = item->getBounds(sp_item_i2doc_affine(item), SPItem::GEOMETRIC_BBOX); if (!bbox) { return false; diff --git a/src/ui/cache/svg_preview_cache.cpp b/src/ui/cache/svg_preview_cache.cpp index aa9d045e4..20d0ea0a4 100644 --- a/src/ui/cache/svg_preview_cache.cpp +++ b/src/ui/cache/svg_preview_cache.cpp @@ -36,7 +36,7 @@ GdkPixbuf* render_pixbuf(NRArenaItem* root, double scale_factor, const Geom::Rec NRGC gc(NULL); Geom::Matrix t(Geom::Scale(scale_factor, scale_factor)); - nr_arena_item_set_transform(root, from_2geom(t)); + nr_arena_item_set_transform(root, t); gc.transform.set_identity(); nr_arena_item_invoke_update( root, NULL, &gc, diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index ce506523a..36ceac0d1 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -549,7 +549,7 @@ void ClipboardManagerImpl::_copySelection(Inkscape::Selection *selection) // write the complete accumulated transform passed to us // (we're dealing with unattached representations, so we write to their attributes // instead of using sp_item_set_transform) - gchar *transform_str = sp_svg_transform_write(from_2geom(sp_item_i2doc_affine(SP_ITEM(i->data)))); + gchar *transform_str = sp_svg_transform_write(sp_item_i2doc_affine(SP_ITEM(i->data))); obj_copy->setAttribute("transform", transform_str); g_free(transform_str); } @@ -791,7 +791,7 @@ void ClipboardManagerImpl::_pasteDocument(SPDocument *clipdoc, bool in_place) // we know that after pasting the upper left corner of the selection will be aligend to the corresponding // page corner. Using the boundingbox of the selection is more foolproof though if (sel_bbox) { - Geom::Point pos_mouse = to_2geom(desktop->point()); //Location of mouse pointer in desktop coordinates + Geom::Point pos_mouse = desktop->point(); //Location of mouse pointer in desktop coordinates // Now calculate how far we would have to move the pasted objects to get their // midpoint at the location of the mouse pointer rel_pos_mouse = pos_mouse - to_2geom(sel_bbox->midpoint()); diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp index a512f9849..4f9c33ff5 100644 --- a/src/ui/dialog/filedialogimpl-win32.cpp +++ b/src/ui/dialog/filedialogimpl-win32.cpp @@ -869,7 +869,7 @@ bool FileOpenDialogImplWin32::set_svg_preview() boost::optional maybeArea(from_2geom(area)); sp_document_ensure_up_to_date (svgDoc); sp_item_invoke_bbox((SPItem *) svgDoc->root, &maybeArea, - from_2geom(sp_item_i2r_affine((SPItem *)(svgDoc->root))), TRUE); + sp_item_i2r_affine((SPItem *)(svgDoc->root)), TRUE); NRArena *const arena = NRArena::create(); @@ -879,7 +879,7 @@ bool FileOpenDialogImplWin32::set_svg_preview() arena, key, SP_ITEM_SHOW_DISPLAY); NRGC gc(NULL); - gc.transform = from_2geom(Geom::Matrix(Geom::Scale(scaleFactor, scaleFactor))); + gc.transform = Geom::Matrix(Geom::Scale(scaleFactor, scaleFactor)); nr_arena_item_invoke_update (root, NULL, &gc, NR_ARENA_ITEM_STATE_ALL, NR_ARENA_ITEM_STATE_NONE); diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index ed89bf6aa..29b6c37dd 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -528,7 +528,7 @@ Transformation::updatePageTransform(Inkscape::Selection *selection) { if (selection && !selection->isEmpty()) { if (_check_replace_matrix.get_active()) { - Geom::Matrix current (to_2geom(SP_ITEM(selection->itemList()->data)->transform)); // take from the first item in selection + Geom::Matrix current (SP_ITEM(selection->itemList()->data)->transform); // take from the first item in selection Geom::Matrix new_displayed = current; @@ -973,7 +973,7 @@ Transformation::onReplaceMatrixToggled() double f = _scalar_transform_f.getValue(); Geom::Matrix displayed (a, b, c, d, e, f); - Geom::Matrix current = to_2geom(SP_ITEM(selection->itemList()->data)->transform); // take from the first item in selection + Geom::Matrix current = SP_ITEM(selection->itemList()->data)->transform; // take from the first item in selection Geom::Matrix new_displayed; if (_check_replace_matrix.get_active()) { diff --git a/src/widgets/font-selector.cpp b/src/widgets/font-selector.cpp index 20b105614..5c6aa35e7 100644 --- a/src/widgets/font-selector.cpp +++ b/src/widgets/font-selector.cpp @@ -806,7 +806,7 @@ void sp_font_preview_set_font(SPFontPreview *fprev, font_instance *font, SPFontS if (fprev->font) { Geom::Matrix flip(Geom::Scale(fsel->fontsize, -fsel->fontsize)); - fprev->rfont = fprev->font->RasterFont(from_2geom(flip), 0); + fprev->rfont = fprev->font->RasterFont(flip, 0); } if (GTK_WIDGET_DRAWABLE (fprev)) gtk_widget_queue_draw (GTK_WIDGET (fprev)); diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index b460258ed..cdd356871 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -623,7 +623,11 @@ sp_icon_doc_icon( SPDocument *doc, NRArenaItem *root, if (object && SP_IS_ITEM(object)) { /* Find bbox in document */ Geom::Matrix const i2doc(sp_item_i2doc_affine(SP_ITEM(object))); - boost::optional dbox = SP_ITEM(object)->getBounds(i2doc); + boost::optional nrdbox = SP_ITEM(object)->getBounds(i2doc); + boost::optional dbox; + if (nrdbox) { + dbox = to_2geom(*nrdbox); + } if ( SP_OBJECT_PARENT(object) == NULL ) { @@ -636,7 +640,7 @@ sp_icon_doc_icon( SPDocument *doc, NRArenaItem *root, NRGC gc(NULL); /* Update to renderable state */ double sf = 1.0; - nr_arena_item_set_transform(root, from_2geom(Geom::Scale(sf, sf))); + nr_arena_item_set_transform(root, (Geom::Matrix)Geom::Scale(sf, sf)); gc.transform.set_identity(); nr_arena_item_invoke_update( root, NULL, &gc, NR_ARENA_ITEM_STATE_ALL, @@ -668,7 +672,7 @@ sp_icon_doc_icon( SPDocument *doc, NRArenaItem *root, } sf = (double)psize / (double)block; - nr_arena_item_set_transform(root, from_2geom(Geom::Scale(sf, sf))); + nr_arena_item_set_transform(root, (Geom::Matrix)Geom::Scale(sf, sf)); gc.transform.set_identity(); nr_arena_item_invoke_update( root, NULL, &gc, NR_ARENA_ITEM_STATE_ALL, -- 2.30.2