From 8867de5daf309e4cdd3fce177b408618490be4f3 Mon Sep 17 00:00:00 2001 From: Abhishek Sharma Public Date: Tue, 29 Jun 2010 23:35:42 +0530 Subject: This is the first c++ification commit from me. It handles sp-line, sp-polyline, sp-item and marks the onset of document c++ification as well. Users can check performace increase with [/usr/bin/time -v inkscape_binary_with_commandline_options]. (bzr r9546.1.1) --- src/draw-context.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/draw-context.cpp') diff --git a/src/draw-context.cpp b/src/draw-context.cpp index 3049f3a6a..52118eb16 100644 --- a/src/draw-context.cpp +++ b/src/draw-context.cpp @@ -438,7 +438,7 @@ spdc_attach_selection(SPDrawContext *dc, Inkscape::Selection */*sel*/) /* Curve list */ /* We keep it in desktop coordinates to eliminate calculation errors */ SPCurve *norm = sp_path_get_curve_for_edit (SP_PATH(item)); - norm->transform(sp_item_i2d_affine(dc->white_item)); + norm->transform((dc->white_item)->i2d_affine()); g_return_if_fail( norm != NULL ); dc->white_curves = g_slist_reverse(norm->split()); norm->unref(); @@ -656,7 +656,7 @@ spdc_flush_white(SPDrawContext *dc, SPCurve *gc) /* Now we have to go back to item coordinates at last */ c->transform( dc->white_item - ? sp_item_dt2i_affine(dc->white_item) + ? (dc->white_item)->dt2i_affine() : SP_EVENT_CONTEXT_DESKTOP(dc)->dt2doc() ); SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(dc); @@ -694,7 +694,7 @@ spdc_flush_white(SPDrawContext *dc, SPCurve *gc) dc->selection->set(repr); Inkscape::GC::release(repr); - item->transform = sp_item_i2doc_affine(SP_ITEM(desktop->currentLayer())).inverse(); + item->transform = SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse(); item->updateRepr(); } @@ -836,8 +836,8 @@ void spdc_create_single_dot(SPEventContext *ec, Geom::Point const &pt, char cons current stroke width, multiplied by the amount specified in the preferences */ Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - Geom::Matrix const i2d (sp_item_i2d_affine (item)); - Geom::Point pp = pt * i2d.inverse(); + Geom::Matrix const i2d (item->i2d_affine ()); + Geom::Point pp = pt; double rad = 0.5 * prefs->getDouble(tool_path + "/dot-size", 3.0); if (event_state & GDK_MOD1_MASK) { /* TODO: We vary the dot size between 0.5*rad and 1.5*rad, where rad is the dot size @@ -856,6 +856,7 @@ void spdc_create_single_dot(SPEventContext *ec, Geom::Point const &pt, char cons sp_repr_set_svg_double (repr, "sodipodi:rx", rad * stroke_width); sp_repr_set_svg_double (repr, "sodipodi:ry", rad * stroke_width); item->updateRepr(); + item->set_item_transform(i2d.inverse()); sp_desktop_selection(desktop)->set(item); -- cgit v1.2.3 From 121815791be2d24cb745663520b111ee914fbc09 Mon Sep 17 00:00:00 2001 From: Abhishek Sharma Public Date: Thu, 1 Jul 2010 15:36:56 +0530 Subject: C++fied SPDocument added (bzr r9546.1.2) --- src/draw-context.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/draw-context.cpp') diff --git a/src/draw-context.cpp b/src/draw-context.cpp index 52118eb16..ea25efc22 100644 --- a/src/draw-context.cpp +++ b/src/draw-context.cpp @@ -712,7 +712,7 @@ spdc_flush_white(SPDrawContext *dc, SPCurve *gc) c->unref(); /* Flush pending updates */ - sp_document_ensure_up_to_date(doc); + doc->ensure_up_to_date(); } /** -- cgit v1.2.3 From d25a9a072143eafa4a9823b84e977c4b85d45efe Mon Sep 17 00:00:00 2001 From: Abhishek Sharma Public Date: Fri, 2 Jul 2010 18:05:42 +0530 Subject: New Class SPDocumentUndo created which takes care of c++fying some non SPDocument based methods (bzr r9546.1.3) --- src/draw-context.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/draw-context.cpp') diff --git a/src/draw-context.cpp b/src/draw-context.cpp index ea25efc22..a3c3601cc 100644 --- a/src/draw-context.cpp +++ b/src/draw-context.cpp @@ -698,7 +698,7 @@ spdc_flush_white(SPDrawContext *dc, SPCurve *gc) item->updateRepr(); } - sp_document_done(doc, SP_IS_PEN_CONTEXT(dc)? SP_VERB_CONTEXT_PEN : SP_VERB_CONTEXT_PENCIL, + SPDocumentUndo::done(doc, SP_IS_PEN_CONTEXT(dc)? SP_VERB_CONTEXT_PEN : SP_VERB_CONTEXT_PENCIL, _("Draw path")); // When quickly drawing several subpaths with Shift, the next subpath may be finished and @@ -861,7 +861,7 @@ void spdc_create_single_dot(SPEventContext *ec, Geom::Point const &pt, char cons sp_desktop_selection(desktop)->set(item); desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Creating single dot")); - sp_document_done(sp_desktop_document(desktop), SP_VERB_NONE, _("Create single dot")); + SPDocumentUndo::done(sp_desktop_document(desktop), SP_VERB_NONE, _("Create single dot")); } /* -- cgit v1.2.3