render canvas using the GDK region rather than the GDK area.
authorPaul Davis <paul@linuxaudiosystems.com>
Tue, 3 Feb 2015 20:38:14 +0000 (15:38 -0500)
committerPaul Davis <paul@linuxaudiosystems.com>
Tue, 3 Feb 2015 20:38:14 +0000 (15:38 -0500)
The region is the un-coalesced set of rectangles that were requested for redraw. The area
is the coalesced single rectangle. In the worst cases, the coalesced rectangle could span
the entire window even though just two pixels in opposite corners were to be redrawn.

There is a problem with the verbose cursor as it is dragged across MIDI tracks. TO BE
FIXED.

libs/canvas/canvas.cc

index 1a14f8bde3989bcde7167e20dd0c7c737036a9e9..84360369835587b2f0738d4c492220fd223869f8 100644 (file)
@@ -786,9 +786,20 @@ GtkCanvas::on_expose_event (GdkEventExpose* ev)
         draw_context->fill ();
         
         /* render canvas */
-        
-        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);
+        for (gint n = 0; n < nrects; ++n) {
+               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 
+        
 #ifdef USE_CAIRO_IMAGE_SURFACE
        /* now blit our private surface back to the GDK one */