Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fb9e723

Browse filesBrowse files
authored
Merge pull request matplotlib#17462 from anntzer/gtk_render_figure
Inline FigureCanvasGtkFoo._render_figure.
2 parents 16df024 + d02b8be commit fb9e723
Copy full SHA for fb9e723

File tree

2 files changed

+4
-10
lines changed
Filter options

2 files changed

+4
-10
lines changed

‎lib/matplotlib/backends/backend_gtk3agg.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_gtk3agg.py
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ def __init__(self, figure):
1717
backend_gtk3.FigureCanvasGTK3.__init__(self, figure)
1818
self._bbox_queue = []
1919

20-
def _render_figure(self, width, height):
21-
backend_agg.FigureCanvasAgg.draw(self)
22-
2320
def on_draw_event(self, widget, ctx):
2421
"""GtkDrawable draw event, like expose_event in GTK 2.X."""
2522
allocation = self.get_allocation()
@@ -71,8 +68,7 @@ def blit(self, bbox=None):
7168

7269
def draw(self):
7370
if self.get_visible() and self.get_mapped():
74-
allocation = self.get_allocation()
75-
self._render_figure(allocation.width, allocation.height)
71+
backend_agg.FigureCanvasAgg.draw(self)
7672
super().draw()
7773

7874
def print_png(self, filename, *args, **kwargs):

‎lib/matplotlib/backends/backend_gtk3cairo.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_gtk3cairo.py
+3-5Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ def __init__(self, figure):
2020
super().__init__(figure)
2121
self._renderer = RendererGTK3Cairo(self.figure.dpi)
2222

23-
def _render_figure(self, width, height):
24-
self._renderer.set_width_height(width, height)
25-
self.figure.draw(self._renderer)
26-
2723
def on_draw_event(self, widget, ctx):
2824
"""GtkDrawable draw event."""
2925
with (self.toolbar._wait_cursor_for_draw_cm() if self.toolbar
@@ -34,7 +30,9 @@ def on_draw_event(self, widget, ctx):
3430
self.get_style_context(), ctx,
3531
allocation.x, allocation.y,
3632
allocation.width, allocation.height)
37-
self._render_figure(allocation.width, allocation.height)
33+
self._renderer.set_width_height(
34+
allocation.width, allocation.height)
35+
self.figure.draw(self._renderer)
3836

3937

4038
@_BackendGTK3.export

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.