Add support for blitting in qt5cairo. · matplotlib/matplotlib@7e57660 · GitHub
Skip to content

Commit 7e57660

Browse files
committed
Add support for blitting in qt5cairo.
Test with e.g. examples/event_handling/poly_editor.py. Doing the same for the other foocairo backends is left as an exercise to the reader.
1 parent 969513e commit 7e57660

3 files changed

Lines changed: 49 additions & 12 deletions

File tree

lib/matplotlib/backends/backend_cairo.py

Lines changed: 40 additions & 0 deletions

lib/matplotlib/backends/backend_qt5.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,15 @@ def draw_idle(self):
460460
self._draw_pending = True
461461
QtCore.QTimer.singleShot(0, self._draw_idle)
462462

463+
def blit(self, bbox=None):
464+
# docstring inherited
465+
if bbox is None and self.figure:
466+
bbox = self.figure.bbox # Blit the entire canvas if bbox is None.
467+
# repaint uses logical pixels, not physical pixels like the renderer.
468+
l, b, w, h = [pt / self._dpi_ratio for pt in bbox.bounds]
469+
t = b + h
470+
self.repaint(l, self.rect().height() - t, w, h)
471+
463472
def _draw_idle(self):
464473
with self._idle_draw_cntx():
465474
if not self._draw_pending:

lib/matplotlib/backends/backend_qt5agg.py

Lines changed: 0 additions & 12 deletions

0 commit comments

Comments
 (0)