Skip to content

FIX: always eraseRect in Qt widget #13050

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 30, 2018
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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy