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/sp-use.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/sp-use.cpp') diff --git a/src/sp-use.cpp b/src/sp-use.cpp index 9cd38e4b3..1125550c8 100644 --- a/src/sp-use.cpp +++ b/src/sp-use.cpp @@ -289,7 +289,7 @@ sp_use_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, uns use->y.computed) * transform ); Geom::OptRect optbbox; - sp_item_invoke_bbox_full(child, optbbox, ct, flags, FALSE); + child->invoke_bbox_full( optbbox, ct, flags, FALSE); if (optbbox) { bbox->x0 = (*optbbox)[0][0]; bbox->y0 = (*optbbox)[1][0]; @@ -312,7 +312,7 @@ sp_use_print(SPItem *item, SPPrintContext *ctx) } if (use->child && SP_IS_ITEM(use->child)) { - sp_item_invoke_print(SP_ITEM(use->child), ctx); + SP_ITEM(use->child)->invoke_print(ctx); } if (translated) { @@ -336,7 +336,7 @@ sp_use_description(SPItem *item) * a , and giving its description. */ } ++recursion_depth; - char *child_desc = sp_item_description(SP_ITEM(use->child)); + char *child_desc = SP_ITEM(use->child)->description(); --recursion_depth; ret = g_strdup_printf(_("Clone of: %s"), child_desc); @@ -357,7 +357,7 @@ sp_use_show(SPItem *item, NRArena *arena, unsigned key, unsigned flags) nr_arena_group_set_style(NR_ARENA_GROUP(ai), SP_OBJECT_STYLE(item)); if (use->child) { - NRArenaItem *ac = sp_item_invoke_show(SP_ITEM(use->child), arena, key, flags); + NRArenaItem *ac = SP_ITEM(use->child)->invoke_show(arena, key, flags); if (ac) { nr_arena_item_add_child(ai, ac, NULL); } @@ -375,7 +375,7 @@ sp_use_hide(SPItem *item, unsigned key) SPUse *use = SP_USE(item); if (use->child) { - sp_item_invoke_hide(SP_ITEM(use->child), key); + SP_ITEM(use->child)->invoke_hide(key); } if (((SPItemClass *) parent_class)->hide) { @@ -512,7 +512,7 @@ sp_use_move_compensate(Geom::Matrix const *mp, SPItem */*original*/, SPUse *self // commit the compensation SPItem *item = SP_ITEM(self); item->transform *= clone_move; - sp_item_write_transform(item, SP_OBJECT_REPR(item), item->transform, &advertized_move); + item->doWriteTransform(SP_OBJECT_REPR(item), item->transform, &advertized_move); SP_OBJECT(item)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } @@ -543,7 +543,7 @@ sp_use_href_changed(SPObject */*old_ref*/, SPObject */*ref*/, SPUse *use) for (SPItemView *v = item->display; v != NULL; v = v->next) { NRArenaItem *ai; - ai = sp_item_invoke_show(SP_ITEM(use->child), NR_ARENA_ITEM_ARENA(v->arenaitem), v->key, v->flags); + ai = SP_ITEM(use->child)->invoke_show(NR_ARENA_ITEM_ARENA(v->arenaitem), v->key, v->flags); if (ai) { nr_arena_item_add_child(v->arenaitem, ai, NULL); } @@ -736,7 +736,7 @@ sp_use_unlink(SPUse *use) { Geom::Matrix nomove(Geom::identity()); // Advertise ourselves as not moving. - sp_item_write_transform(item, SP_OBJECT_REPR(item), t, &nomove); + item->doWriteTransform(SP_OBJECT_REPR(item), t, &nomove); } return item; } -- cgit v1.2.3 From 1aad26aea24f62b63c992118f36b12483f9a5414 Mon Sep 17 00:00:00 2001 From: Abhishek Sharma Public Date: Sat, 3 Jul 2010 22:50:36 +0530 Subject: another c++ification for sp-object.h/cpp and still in progress... (bzr r9546.1.4) --- src/sp-use.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/sp-use.cpp') diff --git a/src/sp-use.cpp b/src/sp-use.cpp index 1125550c8..3770b2324 100644 --- a/src/sp-use.cpp +++ b/src/sp-use.cpp @@ -140,7 +140,7 @@ sp_use_finalize(GObject *obj) SPUse *use = (SPUse *) obj; if (use->child) { - sp_object_detach(SP_OBJECT(obj), use->child); + SP_OBJECT(obj)->detach(use->child); use->child = NULL; } @@ -177,7 +177,7 @@ sp_use_release(SPObject *object) SPUse *use = SP_USE(object); if (use->child) { - sp_object_detach(object, use->child); + object->detach(use->child); use->child = NULL; } @@ -525,7 +525,7 @@ sp_use_href_changed(SPObject */*old_ref*/, SPObject */*ref*/, SPUse *use) use->_transformed_connection.disconnect(); if (use->child) { - sp_object_detach(SP_OBJECT(use), use->child); + SP_OBJECT(use)->detach(use->child); use->child = NULL; } @@ -537,9 +537,9 @@ sp_use_href_changed(SPObject */*old_ref*/, SPObject */*ref*/, SPUse *use) g_return_if_fail(type > G_TYPE_NONE); if (g_type_is_a(type, SP_TYPE_ITEM)) { use->child = (SPObject*) g_object_new(type, 0); - sp_object_attach(SP_OBJECT(use), use->child, use->lastChild()); + SP_OBJECT(use)->attach(use->child, use->lastChild()); sp_object_unref(use->child, SP_OBJECT(use)); - sp_object_invoke_build(use->child, SP_OBJECT(use)->document, childrepr, TRUE); + (use->child)->invoke_build(SP_OBJECT(use)->document, childrepr, TRUE); for (SPItemView *v = item->display; v != NULL; v = v->next) { NRArenaItem *ai; -- cgit v1.2.3 From 6cc35b45eab6422a6b6f67d621aa259a0a73786f Mon Sep 17 00:00:00 2001 From: Abhishek Sharma Public Date: Mon, 12 Jul 2010 22:06:46 +0530 Subject: SPObject c++ification finalized along with the beginning of XML Privatisation tweaks (bzr r9546.1.6) --- src/sp-use.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/sp-use.cpp') diff --git a/src/sp-use.cpp b/src/sp-use.cpp index 3770b2324..075c7f804 100644 --- a/src/sp-use.cpp +++ b/src/sp-use.cpp @@ -160,11 +160,11 @@ sp_use_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) (* ((SPObjectClass *) parent_class)->build)(object, document, repr); } - sp_object_read_attr(object, "x"); - sp_object_read_attr(object, "y"); - sp_object_read_attr(object, "width"); - sp_object_read_attr(object, "height"); - sp_object_read_attr(object, "xlink:href"); + object->readAttr( "x"); + object->readAttr( "y"); + object->readAttr( "width"); + object->readAttr( "height"); + object->readAttr( "xlink:href"); // We don't need to create child here: // reading xlink:href will attach ref, and that will cause the changed signal to be emitted, @@ -492,7 +492,7 @@ sp_use_move_compensate(Geom::Matrix const *mp, SPItem */*original*/, SPUse *self return; // restore item->transform field from the repr, in case it was changed by seltrans - sp_object_read_attr (SP_OBJECT (self), "transform"); + SP_OBJECT (self)->readAttr ("transform"); Geom::Matrix t = sp_use_get_parent_transform(self); Geom::Matrix clone_move = t.inverse() * m * t; -- cgit v1.2.3