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/text-editing.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/text-editing.cpp') diff --git a/src/text-editing.cpp b/src/text-editing.cpp index 372f5026d..600059303 100644 --- a/src/text-editing.cpp +++ b/src/text-editing.cpp @@ -80,7 +80,7 @@ sp_te_input_is_empty (SPObject const *item) Inkscape::Text::Layout::iterator sp_te_get_position_by_coords (SPItem const *item, Geom::Point const &i_p) { - Geom::Matrix im (sp_item_i2d_affine (item)); + Geom::Matrix im (item->i2d_affine ()); im = im.inverse(); Geom::Point p = i_p * im; @@ -956,7 +956,7 @@ sp_te_adjust_kerning_screen (SPItem *item, Inkscape::Text::Layout::iterator cons // divide increment by zoom // divide increment by matrix expansion gdouble factor = 1 / desktop->current_zoom(); - Geom::Matrix t (sp_item_i2doc_affine(item)); + Geom::Matrix t (item->i2doc_affine()); factor = factor / t.descrim(); by = factor * by; @@ -1008,7 +1008,7 @@ sp_te_adjust_rotation_screen(SPItem *text, Inkscape::Text::Layout::iterator cons // divide increment by zoom // divide increment by matrix expansion gdouble factor = 1 / desktop->current_zoom(); - Geom::Matrix t (sp_item_i2doc_affine(text)); + Geom::Matrix t (text->i2doc_affine()); factor = factor / t.descrim(); Inkscape::Text::Layout const *layout = te_get_layout(text); if (layout == NULL) return; @@ -1112,7 +1112,7 @@ sp_te_adjust_tspan_letterspacing_screen(SPItem *text, Inkscape::Text::Layout::it gdouble const zoom = desktop->current_zoom(); gdouble const zby = (by / (zoom * (nb_let > 1 ? nb_let - 1 : 1)) - / to_2geom(sp_item_i2doc_affine(SP_ITEM(source_obj))).descrim()); + / to_2geom(SP_ITEM(source_obj)->i2doc_affine()).descrim()); val += zby; if (start == end) { @@ -1184,7 +1184,7 @@ sp_te_adjust_linespacing_screen (SPItem *text, Inkscape::Text::Layout::iterator gdouble zby = by / (desktop->current_zoom() * (line_count == 0 ? 1 : line_count)); // divide increment by matrix expansion - Geom::Matrix t (sp_item_i2doc_affine (SP_ITEM(text))); + Geom::Matrix t (SP_ITEM(text)->i2doc_affine ()); zby = zby / t.descrim(); switch (style->line_height.unit) { @@ -1861,7 +1861,7 @@ void sp_te_apply_style(SPItem *text, Inkscape::Text::Layout::iterator const &sta SPCSSAttr *css_set = sp_repr_css_attr_new(); sp_repr_css_merge(css_set, (SPCSSAttr*) css); { - Geom::Matrix const local(sp_item_i2doc_affine(SP_ITEM(common_ancestor))); + Geom::Matrix const local(SP_ITEM(common_ancestor)->i2doc_affine()); double const ex(local.descrim()); if ( ( ex != 0. ) && ( ex != 1. ) ) { -- 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/text-editing.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/text-editing.cpp') diff --git a/src/text-editing.cpp b/src/text-editing.cpp index 600059303..2ed5270fd 100644 --- a/src/text-editing.cpp +++ b/src/text-editing.cpp @@ -872,8 +872,8 @@ sp_te_set_repr_text_multiline(SPItem *text, gchar const *str) SPObject *object; bool is_textpath = false; if (SP_IS_TEXT_TEXTPATH (text)) { - repr = SP_OBJECT_REPR (sp_object_first_child(SP_OBJECT (text))); - object = sp_object_first_child(SP_OBJECT (text)); + repr = SP_OBJECT_REPR (SP_OBJECT (text)->first_child()); + object = SP_OBJECT (text)->first_child(); is_textpath = true; } else { repr = SP_OBJECT_REPR (text); @@ -1331,7 +1331,7 @@ static void apply_css_recursive(SPObject *o, SPCSSAttr const *css) { sp_repr_css_change(SP_OBJECT_REPR(o), const_cast(css), "style"); - for (SPObject *child = sp_object_first_child(SP_OBJECT(o)) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = SP_OBJECT(o)->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { if (sp_repr_css_property(const_cast(css), "opacity", NULL) != NULL) { // Unset properties which are accumulating and thus should not be set recursively. // For example, setting opacity 0.5 on a group recursively would result in the visible opacity of 0.25 for an item in the group. @@ -1418,7 +1418,7 @@ static void recursively_apply_style(SPObject *common_ancestor, SPCSSAttr const * child_span->appendChild(text_in_span); Inkscape::GC::release(text_in_span); child->deleteObject(); - child = sp_object_get_child_by_repr(common_ancestor, child_span); + child = common_ancestor->get_child_by_repr(child_span); } else surround_entire_string = true; @@ -1430,7 +1430,7 @@ static void recursively_apply_style(SPObject *common_ancestor, SPCSSAttr const * SP_OBJECT_REPR(common_ancestor)->removeChild(child_repr); child_span->appendChild(child_repr); Inkscape::GC::release(child_repr); - child = sp_object_get_child_by_repr(common_ancestor, child_span); + child = common_ancestor->get_child_by_repr(child_span); } Inkscape::GC::release(child_span); -- 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/text-editing.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/text-editing.cpp') diff --git a/src/text-editing.cpp b/src/text-editing.cpp index 2ed5270fd..a307e5e27 100644 --- a/src/text-editing.cpp +++ b/src/text-editing.cpp @@ -1497,7 +1497,8 @@ static bool tidy_operator_empty_spans(SPObject **item) the repeated strings will be merged by another operator. */ static bool tidy_operator_inexplicable_spans(SPObject **item) { - if (*item && sp_repr_is_meta_element((*item)->repr)) return false; + //XML Tree being directly used here while it shouldn't be. + if (*item && sp_repr_is_meta_element((*item)->getRepr())) return false; if (SP_IS_STRING(*item)) return false; if (is_line_break_object(*item)) return false; TextTagAttributes *attrs = attributes_for_object(*item); -- cgit v1.2.3