diff options
| author | Jabier Arraiza <jabier.arraiza@marker.es> | 2019-10-09 06:05:56 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2019-10-09 06:05:56 +0000 |
| commit | 5a2dae366dd8d2797b55b0cd0eb801d2e03f0176 (patch) | |
| tree | 17a5c707895752d7599e211f4d43f3fad16491b6 /src/display | |
| parent | Last string change to this file moved today from skip files to translate fil... (diff) | |
| download | inkscape-5a2dae366dd8d2797b55b0cd0eb801d2e03f0176.tar.gz inkscape-5a2dae366dd8d2797b55b0cd0eb801d2e03f0176.zip | |
Improve node selection ~x3 removing unneded updateNow() called in non necesary places. Also ensure canvas is always redraw
Diffstat (limited to 'src/display')
| -rw-r--r-- | src/display/sp-canvas.cpp | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp index 62edc36c4..5014343e0 100644 --- a/src/display/sp-canvas.cpp +++ b/src/display/sp-canvas.cpp @@ -57,7 +57,7 @@ static bool const HAS_BROKEN_MOTION_HINTS = true; // Define this to visualize the regions to be redrawn //#define DEBUG_REDRAW 1; -// Define this to output the time spent in a full iddle loop and the number of "tiles" painted +// Define this to output the time spent in a full idle loop and the number of "tiles" painted //#define DEBUG_PERFORMANCE 1; // Tiles are a way to minimize the number of redraws, eliminating too small redraws. @@ -2535,17 +2535,19 @@ int SPCanvas::doUpdate() gint SPCanvas::idle_handler(gpointer data) { SPCanvas *canvas = SP_CANVAS (data); - int const ret = canvas->doUpdate(); + int ret = canvas->doUpdate(); + int n_rects = cairo_region_num_rectangles(canvas->_clean_region); + if (n_rects > 1) { // not fully painted, maybe clean region is updated in middle of idle, reload again + ret = 0; + } #ifdef DEBUG_PERFORMANCE - static gint totaloops = 1; - if (!ret) { - totaloops++; + static int totaloops = 1; + if (ret == 0) { + totaloops += 1; } -#endif if (ret) { // Reset idle id canvas->_idle_id = 0; -#ifdef DEBUG_PERFORMANCE static glong totalelapsed = 0; GTimeVal now; g_get_current_time (&now); @@ -2567,6 +2569,10 @@ gint SPCanvas::idle_handler(gpointer data) } totaloops = 1; canvas->_splits = 0; +#else + if (ret) { + // Reset idle id + canvas->_idle_id = 0; #endif } return !ret; @@ -2713,7 +2719,20 @@ void SPCanvas::scrollTo( Geom::Point const &c, unsigned int clear, bool is_scrol void SPCanvas::updateNow() { if (_need_update) { +#ifdef DEBUG_PERFORMANCE + GTimeVal now; + g_get_current_time (&now); + glong elapsed = (now.tv_sec - _idle_time.tv_sec) * 1000000 + + (now.tv_usec - _idle_time.tv_usec); + g_message("updateNow() started %f", elapsed/(double)1000000); +#endif doUpdate(); +#ifdef DEBUG_PERFORMANCE + g_get_current_time (&now); + elapsed = (now.tv_sec - _idle_time.tv_sec) * 1000000 + + (now.tv_usec - _idle_time.tv_usec); + g_message("updateNow() ended %f", elapsed/(double)1000000); +#endif } } |
