Code

remove flicker when creating dialog
[inkscape.git] / src / sp-tspan.cpp
index 6be42312516e2ec64c5fa4bb696040775091df7b..3b5780721dda18940d5f295947f3eee01b4b6dd1 100644 (file)
@@ -198,13 +198,13 @@ sp_tspan_modified(SPObject *object, unsigned flags)
 
 static void sp_tspan_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &transform, unsigned const flags)
 {
+    // find out the ancestor text which holds our layout
     SPObject *parent_text = SP_OBJECT(item);
     for (; parent_text != NULL && !SP_IS_TEXT(parent_text); parent_text = SP_OBJECT_PARENT (parent_text));
     if (parent_text == NULL) return;
 
-    Inkscape::Text::Layout layout = SP_TEXT(parent_text)->layout;
-
-    SP_TEXT(parent_text)->layout.getBoundingBox(bbox, transform, sp_text_get_length_upto(parent_text, item) - 1, sp_text_get_length(item));
+    // get the bbox of our portion of the layout
+    SP_TEXT(parent_text)->layout.getBoundingBox(bbox, transform, sp_text_get_length_upto(parent_text, item), sp_text_get_length_upto(item, NULL) - 1);
 
     // Add stroke width
     SPStyle* style=SP_OBJECT_STYLE (item);
@@ -453,7 +453,7 @@ void   refresh_textpath_source(SPTextPath* tp)
     tp->sourcePath->sourceDirty=false;
        
     // finalisons
-    if ( tp->sourcePath->originalPath ) { 
+    if ( tp->sourcePath->originalPath ) {
         if (tp->originalPath) {
             delete tp->originalPath;
         }
@@ -574,7 +574,7 @@ sp_textpath_to_text(SPObject *tp)
         // make a copy of each textpath child
         Inkscape::XML::Node *copy = ((Inkscape::XML::Node *) i->data)->duplicate();
         // remove the old repr from under textpath
-        SP_OBJECT_REPR(tp)->removeChild((Inkscape::XML::Node *) i->data); 
+        SP_OBJECT_REPR(tp)->removeChild((Inkscape::XML::Node *) i->data);
         // put its copy into under textPath
         SP_OBJECT_REPR(text)->addChild(copy, NULL); // fixme: copy id
     }
@@ -583,7 +583,7 @@ sp_textpath_to_text(SPObject *tp)
     tp->deleteObject();
     g_slist_free(tp_reprs);
 
-    // set x/y on text 
+    // set x/y on text
     /* fixme: Yuck, is this really the right test? */
     if (xy[NR::X] != 1e18 && xy[NR::Y] != 1e18) {
         sp_repr_set_svg_double(SP_OBJECT_REPR(text), "x", xy[NR::X]);