Permalink
Browse files

Fixed blitting in Gtk3Agg backend to redraw only area defined by bbox (

  • Loading branch information...
1 parent 745bb21 commit 6e6370177db95173aa91c4961f066b7395ffda6c @spinnau spinnau committed Dec 9, 2012
Showing with 13 additions and 1 deletion.
  1. +13 −1 lib/matplotlib/backends/backend_gtk3agg.py
@@ -59,8 +59,20 @@ def on_draw_event(self, widget, ctx):
return False
def blit(self, bbox=None):
+ # If bbox is None, blit the entire canvas to gtk. Otherwise
+ # blit only the area defined by the bbox.
+ if bbox is None:
+ bbox = self.figure.bbox
+
+ allocation = self.get_allocation()
+ w, h = allocation.width, allocation.height
+ x = int(bbox.x0)
+ y = h - int(bbox.y1)
+ width = int(bbox.x1) - int(bbox.x0)
+ height = int(bbox.y1) - int(bbox.y0)
+
self._bbox_queue.append(bbox)
- self.queue_draw()
+ self.queue_draw_area(x, y, width, height)
def print_png(self, filename, *args, **kwargs):
# Do this so we can save the resolution of figure in the PNG file

0 comments on commit 6e63701

Please sign in to comment.