_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.
This commit is contained in:
Ben Loftis 2015-02-12 11:22:55 -06:00
parent 16346296d3
commit b8ec035b24
2 changed files with 18 additions and 15 deletions

View file

@ -382,6 +382,7 @@ GtkCanvas::GtkCanvas ()
, _new_current_item (0) , _new_current_item (0)
, _grabbed_item (0) , _grabbed_item (0)
, _focused_item (0) , _focused_item (0)
, _single_exposure (1)
, current_tooltip_item (0) , current_tooltip_item (0)
, tooltip_window (0) , tooltip_window (0)
{ {
@ -786,21 +787,21 @@ GtkCanvas::on_expose_event (GdkEventExpose* ev)
draw_context->fill (); draw_context->fill ();
/* render canvas */ /* render canvas */
if ( _single_exposure ) {
#define 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);
#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); } else {
for (gint n = 0; n < nrects; ++n) { GdkRectangle* rects;
draw_context->set_identity_matrix(); //reset the cairo matrix, just in case someone left it transformed after drawing ( cough ) gint nrects;
render (Rect (rects[n].x, rects[n].y, rects[n].x + rects[n].width, rects[n].y + rects[n].height), draw_context);
} gdk_region_get_rectangles (ev->region, &rects, &nrects);
g_free (rects); for (gint n = 0; n < nrects; ++n) {
#endif 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 #ifdef USE_CAIRO_IMAGE_SURFACE
/* now blit our private surface back to the GDK one */ /* now blit our private surface back to the GDK one */

View file

@ -226,6 +226,8 @@ private:
/** the item that currently has key focus or 0 */ /** the item that currently has key focus or 0 */
Item * _focused_item; Item * _focused_item;
bool _single_exposure;
sigc::connection tooltip_timeout_connection; sigc::connection tooltip_timeout_connection;
Item* current_tooltip_item; Item* current_tooltip_item;
Gtk::Window* tooltip_window; Gtk::Window* tooltip_window;