🌐 AI搜索 & 代理 主页
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions lib/matplotlib/backends/backend_qt5.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ def __init__(self, figure):
self._dpi_ratio_prev = None

self._draw_pending = False
self._erase_before_paint = False
self._is_drawing = False
self._draw_rect_callback = lambda painter: None

Expand Down Expand Up @@ -491,7 +490,6 @@ def draw(self):
return
with cbook._setattr_cm(self, _is_drawing=True):
super().draw()
self._erase_before_paint = True
self.update()

def draw_idle(self):
Expand Down
8 changes: 4 additions & 4 deletions lib/matplotlib/backends/backend_qt5agg.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ def paintEvent(self, event):

painter = QtGui.QPainter(self)

if self._erase_before_paint:
painter.eraseRect(self.rect())
self._erase_before_paint = False

rect = event.rect()
left = rect.left()
top = rect.top()
Expand All @@ -55,6 +51,10 @@ def paintEvent(self, event):
reg = self.copy_from_bbox(bbox)
buf = cbook._unmultiplied_rgba8888_to_premultiplied_argb32(
memoryview(reg))

# clear the widget canvas
painter.eraseRect(rect)

qimage = QtGui.QImage(buf, buf.shape[1], buf.shape[0],
QtGui.QImage.Format_ARGB32_Premultiplied)
if hasattr(qimage, 'setDevicePixelRatio'):
Expand Down
4 changes: 1 addition & 3 deletions lib/matplotlib/backends/backend_qt5cairo.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ def paintEvent(self, event):
# Not available on Qt4 or some older Qt5.
qimage.setDevicePixelRatio(dpi_ratio)
painter = QtGui.QPainter(self)
if self._erase_before_paint:
painter.eraseRect(self.rect())
self._erase_before_paint = False
painter.eraseRect(event.rect())
painter.drawImage(0, 0, qimage)
self._draw_rect_callback(painter)
painter.end()
Expand Down