diff options
author | Ben Loftis <ben@harrisonconsoles.com> | 2015-02-12 11:22:55 -0600 |
---|---|---|
committer | Ben Loftis <ben@harrisonconsoles.com> | 2015-02-12 11:35:35 -0600 |
commit | b8ec035b245421a0758bf7d74c674d86cd2eff9c (patch) | |
tree | 242cd319e2589196e4b483795020887854c9187b /libs | |
parent | 16346296d3098799863c38b3ea3ce1d87610042e (diff) |
_single_exposure is now a member variable for each GtkCanvas.
Gtk coalesces multiple exposes into a single combined rect.
If _single_exposure is disabled, we break apart the individual expose rects for the canvas rendering.
Diffstat (limited to 'libs')
-rw-r--r-- | libs/canvas/canvas.cc | 31 | ||||
-rw-r--r-- | libs/canvas/canvas/canvas.h | 2 |
2 files changed, 18 insertions, 15 deletions
diff --git a/libs/canvas/canvas.cc b/libs/canvas/canvas.cc index 4c4696e0c1..cc588cf3e1 100644 --- a/libs/canvas/canvas.cc +++ b/libs/canvas/canvas.cc @@ -382,6 +382,7 @@ GtkCanvas::GtkCanvas () , _new_current_item (0) , _grabbed_item (0) , _focused_item (0) + , _single_exposure (1) , current_tooltip_item (0) , tooltip_window (0) { @@ -786,22 +787,22 @@ GtkCanvas::on_expose_event (GdkEventExpose* ev) draw_context->fill (); /* render canvas */ + if ( _single_exposure ) { + + render (Rect (ev->area.x, ev->area.y, ev->area.x + ev->area.width, ev->area.y + ev->area.height), draw_context); -#define CANVAS_SINGLE_EXPOSE -#ifdef CANVAS_SINGLE_EXPOSE - render (Rect (ev->area.x, ev->area.y, ev->area.x + ev->area.width, ev->area.y + ev->area.height), draw_context); -#else - GdkRectangle* rects; - gint nrects; - - gdk_region_get_rectangles (ev->region, &rects, &nrects); - for (gint n = 0; n < nrects; ++n) { - draw_context->set_identity_matrix(); //reset the cairo matrix, just in case someone left it transformed after drawing ( cough ) - render (Rect (rects[n].x, rects[n].y, rects[n].x + rects[n].width, rects[n].y + rects[n].height), draw_context); - } - g_free (rects); -#endif - + } else { + GdkRectangle* rects; + gint nrects; + + gdk_region_get_rectangles (ev->region, &rects, &nrects); + for (gint n = 0; n < nrects; ++n) { + draw_context->set_identity_matrix(); //reset the cairo matrix, just in case someone left it transformed after drawing ( cough ) + render (Rect (rects[n].x, rects[n].y, rects[n].x + rects[n].width, rects[n].y + rects[n].height), draw_context); + } + g_free (rects); + } + #ifdef USE_CAIRO_IMAGE_SURFACE /* now blit our private surface back to the GDK one */ diff --git a/libs/canvas/canvas/canvas.h b/libs/canvas/canvas/canvas.h index 26cf850d03..387c6680cb 100644 --- a/libs/canvas/canvas/canvas.h +++ b/libs/canvas/canvas/canvas.h @@ -225,6 +225,8 @@ private: Item * _grabbed_item; /** the item that currently has key focus or 0 */ Item * _focused_item; + + bool _single_exposure; sigc::connection tooltip_timeout_connection; Item* current_tooltip_item; |