Code

remove many unnecessary to_2geom and from_2geom calls
[inkscape.git] / src / text-editing.cpp
index d289397743d18e96fabfac02606a82d816156a4f..be098b7e9ede655f0999ee55b5c2a2842cec9922 100644 (file)
@@ -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, NR::Point &i_p)
 {
-    NR::Matrix im = from_2geom(sp_item_i2d_affine (item));
+    NR::Matrix im (sp_item_i2d_affine (item));
     im = im.inverse();
 
     NR::Point p = i_p * im;
@@ -948,7 +948,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();
-    NR::Matrix t = from_2geom(sp_item_i2doc_affine(item));
+    NR::Matrix t (sp_item_i2doc_affine(item));
     factor = factor / NR::expansion(t);
     by = factor * by;
 
@@ -970,7 +970,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();
-    NR::Matrix t = from_2geom(sp_item_i2doc_affine(text));
+    NR::Matrix t (sp_item_i2doc_affine(text));
     factor = factor / NR::expansion(t);
     Inkscape::Text::Layout const *layout = te_get_layout(text);
     if (layout == NULL) return;
@@ -1055,7 +1055,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))
-                         / NR::expansion(from_2geom(sp_item_i2doc_affine(SP_ITEM(source_obj)))));
+                         / NR::expansion(sp_item_i2doc_affine(SP_ITEM(source_obj))));
     val += zby;
 
     if (start == end) {
@@ -1127,7 +1127,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
-    NR::Matrix t = from_2geom(sp_item_i2doc_affine (SP_ITEM(text)));
+    NR::Matrix t (sp_item_i2doc_affine (SP_ITEM(text)));
     zby = zby / NR::expansion(t);
 
     switch (style->line_height.unit) {
@@ -1669,14 +1669,11 @@ static bool tidy_operator_styled_whitespace(SPObject **item)
         for ( ; ; ) {   // go up one item in the xml
             test_item = SP_OBJECT_PARENT(test_item);
             if (is_line_break_object(test_item)) break;
-            if (test_item) {
-                SPObject *next = SP_OBJECT_NEXT(test_item);
-                if (next) {
-                    test_item = next;
-                    break;
-                }
-            } else {
-                return false;
+            if (SP_IS_FLOWTEXT(test_item)) return false;
+            SPObject *next = SP_OBJECT_NEXT(test_item);
+            if (next) {
+                test_item = next;
+                break;
             }
         }
         if (is_line_break_object(test_item)) {  // no next string, see if there's a prev string