Quantcast

Trying to improve the performance of dragging objects in complex documents

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Trying to improve the performance of dragging objects in complex documents

Minglangjun Li
Hi all,

I notice that dragging objects in Inkscape becomes slow when the document contains a lot of objects. And there's already a bug report (#1198317) complains about it. It remains unresolved, though. I love Inkscape so I am willing to contribute. The big problem is Inkscape's codebase is too large for me. Currently I only find the following lines which may potentially be optimized (haven't tested). 


=== modified file 'src/seltrans.cpp'
--- src/seltrans.cpp 2016-10-24 22:58:43 +0000
+++ src/seltrans.cpp 2017-03-07 15:07:24 +0000
@@ -280,9 +280,13 @@
     // (The special points are the handles, center, rotation axis, font baseline, ends of spiral, etc.)
 
     // First, determine the bounding box
-    _bbox = selection->bounds(_snap_bbox_type);
     _visual_bbox = selection->visualBounds(); // Used for correctly scaling the strokewidth
     _geometric_bbox = selection->geometricBounds();
+    if (_snap_bbox_type == SPItem::VISUAL_BBOX) {
+        _bbox = _visual_bbox;
+    } else {
+        _bbox = _geometric_bbox;
+    }
 
     _point = p;
     if (_geometric_bbox) {


In the previous mentioned bug report they said that the performance dropping has something to do with the bounding box computation. I don't get it. For simple shapes like circles, how can we compute their bbox. more efficiently? Another question is why should we compute the bbox. of the background objects when we drag an object? I think it's the real source of the performance issue. Am I right? Any help is appreciated. Thanks.

Regards,
Minglangjun

------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
Inkscape-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Trying to improve the performance of dragging objects in complex documents

Minglangjun Li
Just tested. This modification causes weird dragging effect. So it does't seem to work.

On Wed, Mar 8, 2017 at 9:09 AM, Minglangjun Li <[hidden email]> wrote:
Hi all,

I notice that dragging objects in Inkscape becomes slow when the document contains a lot of objects. And there's already a bug report (#1198317) complains about it. It remains unresolved, though. I love Inkscape so I am willing to contribute. The big problem is Inkscape's codebase is too large for me. Currently I only find the following lines which may potentially be optimized (haven't tested). 


=== modified file 'src/seltrans.cpp'
--- src/seltrans.cpp 2016-10-24 22:58:43 +0000
+++ src/seltrans.cpp 2017-03-07 15:07:24 +0000
@@ -280,9 +280,13 @@
     // (The special points are the handles, center, rotation axis, font baseline, ends of spiral, etc.)
 
     // First, determine the bounding box
-    _bbox = selection->bounds(_snap_bbox_type);
     _visual_bbox = selection->visualBounds(); // Used for correctly scaling the strokewidth
     _geometric_bbox = selection->geometricBounds();
+    if (_snap_bbox_type == SPItem::VISUAL_BBOX) {
+        _bbox = _visual_bbox;
+    } else {
+        _bbox = _geometric_bbox;
+    }
 
     _point = p;
     if (_geometric_bbox) {


In the previous mentioned bug report they said that the performance dropping has something to do with the bounding box computation. I don't get it. For simple shapes like circles, how can we compute their bbox. more efficiently? Another question is why should we compute the bbox. of the background objects when we drag an object? I think it's the real source of the performance issue. Am I right? Any help is appreciated. Thanks.

Regards,
Minglangjun


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
Inkscape-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-devel
Loading...