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/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 9f7bc9ad3..5cb317a44 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1201,7 +1201,7 @@ do_query_dimension (SPDocument *doc, bool extent, Geom::Dim2 const axis, const g SPItem *item = ((SPItem *) o); // "true" SVG bbox for scripting - Geom::OptRect area = item->getBounds(sp_item_i2doc_affine(item)); + Geom::OptRect area = item->getBounds(item->i2doc_affine()); if (area) { Inkscape::SVGOStringStream os; if (extent) { @@ -1234,7 +1234,7 @@ do_query_all_recurse (SPObject *o) { SPItem *item = ((SPItem *) o); if (o->getId() && SP_IS_ITEM(item)) { - Geom::OptRect area = item->getBounds(sp_item_i2doc_affine(item)); + Geom::OptRect area = item->getBounds(item->i2doc_affine()); if (area) { Inkscape::SVGOStringStream os; os << o->getId(); @@ -1329,7 +1329,7 @@ sp_do_export_png(SPDocument *doc) // write object bbox to area sp_document_ensure_up_to_date (doc); Geom::OptRect areaMaybe; - sp_item_invoke_bbox((SPItem *) o_area, areaMaybe, sp_item_i2d_affine((SPItem *) o_area), TRUE); + static_cast(o_area)->invoke_bbox( areaMaybe, static_cast(o_area)->i2d_affine(), TRUE); if (areaMaybe) { area = *areaMaybe; } else { -- 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/main.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 5cb317a44..a25343991 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1020,7 +1020,7 @@ void sp_process_file_list(GSList *fl) g_warning("Specified document %s cannot be opened (does not exist or not a valid SVG file)", filename); } else { if (sp_vacuum_defs) { - vacuum_document(doc); + doc->vacuum_document(); } if (sp_vacuum_defs && !sp_export_svg) { // save under the name given in the command line @@ -1197,7 +1197,7 @@ do_query_dimension (SPDocument *doc, bool extent, Geom::Dim2 const axis, const g } if (o) { - sp_document_ensure_up_to_date (doc); + doc->ensure_up_to_date (); SPItem *item = ((SPItem *) o); // "true" SVG bbox for scripting @@ -1224,7 +1224,7 @@ do_query_all (SPDocument *doc) o = SP_DOCUMENT_ROOT(doc); if (o) { - sp_document_ensure_up_to_date (doc); + doc->ensure_up_to_date (); do_query_all_recurse(o); } } @@ -1327,7 +1327,7 @@ sp_do_export_png(SPDocument *doc) } // write object bbox to area - sp_document_ensure_up_to_date (doc); + doc->ensure_up_to_date (); Geom::OptRect areaMaybe; static_cast(o_area)->invoke_bbox( areaMaybe, static_cast(o_area)->i2d_affine(), TRUE); if (areaMaybe) { @@ -1352,9 +1352,9 @@ sp_do_export_png(SPDocument *doc) area = Geom::Rect(Geom::Interval(x0,x1), Geom::Interval(y0,y1)); } else if (sp_export_area_page || !(sp_export_id || sp_export_area_drawing)) { /* Export the whole page: note: Inkscape uses 'page' in all menus and dialogs, not 'canvas' */ - sp_document_ensure_up_to_date (doc); + doc->ensure_up_to_date (); Geom::Point origin (SP_ROOT(doc->root)->x.computed, SP_ROOT(doc->root)->y.computed); - area = Geom::Rect(origin, origin + sp_document_dimensions(doc)); + area = Geom::Rect(origin, origin + doc->getDimensions()); } // set filename and dpi from options, if not yet set from the hints -- cgit v1.2.3