diff --git a/lib/matplotlib/backends/backend_gtk3agg.py b/lib/matplotlib/backends/backend_gtk3agg.py index 239911238a53..5e26ff385282 100644 --- a/lib/matplotlib/backends/backend_gtk3agg.py +++ b/lib/matplotlib/backends/backend_gtk3agg.py @@ -17,9 +17,6 @@ def __init__(self, figure): backend_gtk3.FigureCanvasGTK3.__init__(self, figure) self._bbox_queue = [] - def _render_figure(self, width, height): - backend_agg.FigureCanvasAgg.draw(self) - def on_draw_event(self, widget, ctx): """GtkDrawable draw event, like expose_event in GTK 2.X.""" allocation = self.get_allocation() @@ -71,8 +68,7 @@ def blit(self, bbox=None): def draw(self): if self.get_visible() and self.get_mapped(): - allocation = self.get_allocation() - self._render_figure(allocation.width, allocation.height) + backend_agg.FigureCanvasAgg.draw(self) super().draw() def print_png(self, filename, *args, **kwargs): diff --git a/lib/matplotlib/backends/backend_gtk3cairo.py b/lib/matplotlib/backends/backend_gtk3cairo.py index 433cbb555041..13b4587b2f7c 100644 --- a/lib/matplotlib/backends/backend_gtk3cairo.py +++ b/lib/matplotlib/backends/backend_gtk3cairo.py @@ -20,10 +20,6 @@ def __init__(self, figure): super().__init__(figure) self._renderer = RendererGTK3Cairo(self.figure.dpi) - def _render_figure(self, width, height): - self._renderer.set_width_height(width, height) - self.figure.draw(self._renderer) - def on_draw_event(self, widget, ctx): """GtkDrawable draw event.""" with (self.toolbar._wait_cursor_for_draw_cm() if self.toolbar @@ -34,7 +30,9 @@ def on_draw_event(self, widget, ctx): self.get_style_context(), ctx, allocation.x, allocation.y, allocation.width, allocation.height) - self._render_figure(allocation.width, allocation.height) + self._renderer.set_width_height( + allocation.width, allocation.height) + self.figure.draw(self._renderer) @_BackendGTK3.export