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/print.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/print.cpp') diff --git a/src/print.cpp b/src/print.cpp index ed9b8d19c..7b582b0d1 100644 --- a/src/print.cpp +++ b/src/print.cpp @@ -104,14 +104,14 @@ sp_print_preview_document(SPDocument *doc) /* Create new arena */ mod->base = SP_ITEM(sp_document_root(doc)); mod->arena = NRArena::create(); - mod->dkey = sp_item_display_key_new(1); - mod->root = sp_item_invoke_show(mod->base, mod->arena, mod->dkey, SP_ITEM_SHOW_DISPLAY); + mod->dkey = SPItem::display_key_new(1); + mod->root = (mod->base)->invoke_show(mod->arena, mod->dkey, SP_ITEM_SHOW_DISPLAY); /* Print document */ ret = mod->begin(doc); - sp_item_invoke_print(mod->base, &context); + (mod->base)->invoke_print(&context); ret = mod->finish(); /* Release arena */ - sp_item_invoke_hide(mod->base, mod->dkey); + (mod->base)->invoke_hide(mod->dkey); mod->base = NULL; mod->root = NULL; nr_object_unref((NRObject *) mod->arena); @@ -129,9 +129,9 @@ sp_print_document(Gtk::Window& parentWindow, SPDocument *doc) // Build arena SPItem *base = SP_ITEM(sp_document_root(doc)); NRArena *arena = NRArena::create(); - unsigned int dkey = sp_item_display_key_new(1); + unsigned int dkey = SPItem::display_key_new(1); // TODO investigate why we are grabbing root and then ignoring it. - NRArenaItem *root = sp_item_invoke_show(base, arena, dkey, SP_ITEM_SHOW_DISPLAY); + NRArenaItem *root = base->invoke_show(arena, dkey, SP_ITEM_SHOW_DISPLAY); // Run print dialog Inkscape::UI::Dialog::Print printop(doc,base); @@ -139,7 +139,7 @@ sp_print_document(Gtk::Window& parentWindow, SPDocument *doc) (void)res; // TODO handle this // Release arena - sp_item_invoke_hide(base, dkey); + base->invoke_hide(dkey); nr_object_unref((NRObject *) arena); } @@ -165,14 +165,14 @@ sp_print_document_to_file(SPDocument *doc, gchar const *filename) /* Create new arena */ mod->base = SP_ITEM(sp_document_root(doc)); mod->arena = NRArena::create(); - mod->dkey = sp_item_display_key_new(1); - mod->root = sp_item_invoke_show(mod->base, mod->arena, mod->dkey, SP_ITEM_SHOW_DISPLAY); + mod->dkey = SPItem::display_key_new(1); + mod->root = (mod->base)->invoke_show(mod->arena, mod->dkey, SP_ITEM_SHOW_DISPLAY); /* Print document */ ret = mod->begin(doc); - sp_item_invoke_print(mod->base, &context); + (mod->base)->invoke_print(&context); ret = mod->finish(); /* Release arena */ - sp_item_invoke_hide(mod->base, mod->dkey); + (mod->base)->invoke_hide(mod->dkey); mod->base = NULL; mod->root = NULL; nr_object_unref((NRObject *) mod->arena); -- 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/print.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/print.cpp') diff --git a/src/print.cpp b/src/print.cpp index 7b582b0d1..43f0113a0 100644 --- a/src/print.cpp +++ b/src/print.cpp @@ -90,7 +90,7 @@ sp_print_preview_document(SPDocument *doc) Inkscape::Extension::Print *mod; unsigned int ret; - sp_document_ensure_up_to_date(doc); + doc->ensure_up_to_date(); mod = Inkscape::Extension::get_print(SP_MODULE_KEY_PRINT_DEFAULT); @@ -124,7 +124,7 @@ sp_print_preview_document(SPDocument *doc) void sp_print_document(Gtk::Window& parentWindow, SPDocument *doc) { - sp_document_ensure_up_to_date(doc); + doc->ensure_up_to_date(); // Build arena SPItem *base = SP_ITEM(sp_document_root(doc)); @@ -152,7 +152,7 @@ sp_print_document_to_file(SPDocument *doc, gchar const *filename) gchar *oldoutput; unsigned int ret; - sp_document_ensure_up_to_date(doc); + doc->ensure_up_to_date(); mod = Inkscape::Extension::get_print(SP_MODULE_KEY_PRINT_PS); oldconst = mod->get_param_string("destination"); -- cgit v1.2.3