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-image.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/sp-image.cpp') diff --git a/src/sp-image.cpp b/src/sp-image.cpp index 68bafdeab..367d2e489 100644 --- a/src/sp-image.cpp +++ b/src/sp-image.cpp @@ -569,7 +569,7 @@ sp_image_get_type (void) (GInstanceInitFunc) sp_image_init, NULL, /* value_table */ }; - image_type = g_type_register_static (sp_item_get_type (), "SPImage", &image_info, (GTypeFlags)0); + image_type = g_type_register_static (SPItem::getType (), "SPImage", &image_info, (GTypeFlags)0); } return image_type; } @@ -585,7 +585,7 @@ sp_image_class_init (SPImageClass * klass) sp_object_class = (SPObjectClass *) klass; item_class = (SPItemClass *) klass; - parent_class = (SPItemClass*)g_type_class_ref (sp_item_get_type ()); + parent_class = (SPItemClass*)g_type_class_ref (SPItem::getType ()); sp_object_class->build = sp_image_build; sp_object_class->release = sp_image_release; @@ -1352,7 +1352,7 @@ static void sp_image_snappoints(SPItem const *item, std::vectori2d_affine ()); p.push_back(Inkscape::SnapCandidatePoint(Geom::Point(x0, y0) * i2d, Inkscape::SNAPSOURCE_CORNER, Inkscape::SNAPTARGET_CORNER)); p.push_back(Inkscape::SnapCandidatePoint(Geom::Point(x0, y1) * i2d, Inkscape::SNAPSOURCE_CORNER, Inkscape::SNAPTARGET_CORNER)); p.push_back(Inkscape::SnapCandidatePoint(Geom::Point(x1, y1) * i2d, Inkscape::SNAPSOURCE_CORNER, Inkscape::SNAPTARGET_CORNER)); -- 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/sp-image.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/sp-image.cpp') diff --git a/src/sp-image.cpp b/src/sp-image.cpp index 367d2e489..c1fb9a571 100644 --- a/src/sp-image.cpp +++ b/src/sp-image.cpp @@ -646,7 +646,7 @@ sp_image_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *rep sp_object_read_attr (object, "color-profile"); /* Register */ - sp_document_add_resource (document, "image", object); + document->add_resource ("image", object); } static void @@ -656,7 +656,7 @@ sp_image_release (SPObject *object) if (SP_OBJECT_DOCUMENT (object)) { /* Unregister ourselves */ - sp_document_remove_resource (SP_OBJECT_DOCUMENT (object), "image", SP_OBJECT (object)); + SP_OBJECT_DOCUMENT (object)->remove_resource ("image", SP_OBJECT (object)); } if (image->href) { -- cgit v1.2.3 From 1aaf9a0ee3da28012bf43cfa61e2e5fa933edd2e Mon Sep 17 00:00:00 2001 From: Abhishek Sharma Public Date: Tue, 6 Jul 2010 12:52:32 +0530 Subject: C++ification of SPObject continued along with the onset of XML Privatisation. Users may checkout [grep -Ir XML Tree *] in the source code and all the places where the XML node/Tree is being used shall be reflected. (bzr r9546.1.5) --- src/sp-image.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/sp-image.cpp') diff --git a/src/sp-image.cpp b/src/sp-image.cpp index c1fb9a571..33038d73c 100644 --- a/src/sp-image.cpp +++ b/src/sp-image.cpp @@ -838,8 +838,12 @@ sp_image_update (SPObject *object, SPCtx *ctx, unsigned int flags) pixbuf = sp_image_repr_read_image ( image->lastMod, image->pixPath, - object->repr->attribute("xlink:href"), - object->repr->attribute("sodipodi:absref"), + + //XML Tree being used directly while it shouldn't be. + object->getRepr()->attribute("xlink:href"), + + //XML Tree being used directly while it shouldn't be. + object->getRepr()->attribute("sodipodi:absref"), doc->base); if (pixbuf) { pixbuf = sp_image_pixbuf_force_rgba (pixbuf); @@ -1056,7 +1060,9 @@ sp_image_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XM if (image->height._set) { sp_repr_set_svg_double(repr, "height", image->height.computed); } - repr->setAttribute("preserveAspectRatio", object->repr->attribute("preserveAspectRatio")); + + //XML Tree being used directly here while it shouldn't be... + repr->setAttribute("preserveAspectRatio", object->getRepr()->attribute("preserveAspectRatio")); #if ENABLE_LCMS if (image->color_profile) { repr->setAttribute("color-profile", image->color_profile); -- 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-image.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/sp-image.cpp') diff --git a/src/sp-image.cpp b/src/sp-image.cpp index 33038d73c..ae7ac6fa3 100644 --- a/src/sp-image.cpp +++ b/src/sp-image.cpp @@ -637,13 +637,13 @@ sp_image_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *rep ((SPObjectClass *) parent_class)->build (object, document, repr); } - sp_object_read_attr (object, "xlink:href"); - 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, "preserveAspectRatio"); - sp_object_read_attr (object, "color-profile"); + object->readAttr( "xlink:href"); + object->readAttr( "x"); + object->readAttr( "y"); + object->readAttr( "width"); + object->readAttr( "height"); + object->readAttr( "preserveAspectRatio"); + object->readAttr( "color-profile"); /* Register */ document->add_resource ("image", object); -- cgit v1.2.3