Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit879b7f0

Browse files
tacaswelltimhoffm
authored andcommitted
FIX: always eraseRect in Qt widget (#13050)
Re-focusing the figure window will call the draw method. If thefacecolor of the figure and axes are transparent and we do noterase the widget we are effectively compositing the figure on to itsself which results in artifacts anywhere there is alpha oranti-aliasing.Closes#13012
1 parente7719da commit879b7f0

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

‎lib/matplotlib/backends/backend_qt5.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,6 @@ def __init__(self, figure):
240240
self._dpi_ratio_prev=None
241241

242242
self._draw_pending=False
243-
self._erase_before_paint=False
244243
self._is_drawing=False
245244
self._draw_rect_callback=lambdapainter:None
246245

@@ -491,7 +490,6 @@ def draw(self):
491490
return
492491
withcbook._setattr_cm(self,_is_drawing=True):
493492
super().draw()
494-
self._erase_before_paint=True
495493
self.update()
496494

497495
defdraw_idle(self):

‎lib/matplotlib/backends/backend_qt5agg.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ def paintEvent(self, event):
3838

3939
painter=QtGui.QPainter(self)
4040

41-
ifself._erase_before_paint:
42-
painter.eraseRect(self.rect())
43-
self._erase_before_paint=False
44-
4541
rect=event.rect()
4642
left=rect.left()
4743
top=rect.top()
@@ -55,6 +51,10 @@ def paintEvent(self, event):
5551
reg=self.copy_from_bbox(bbox)
5652
buf=cbook._unmultiplied_rgba8888_to_premultiplied_argb32(
5753
memoryview(reg))
54+
55+
# clear the widget canvas
56+
painter.eraseRect(rect)
57+
5858
qimage=QtGui.QImage(buf,buf.shape[1],buf.shape[0],
5959
QtGui.QImage.Format_ARGB32_Premultiplied)
6060
ifhasattr(qimage,'setDevicePixelRatio'):

‎lib/matplotlib/backends/backend_qt5cairo.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ def paintEvent(self, event):
3737
# Not available on Qt4 or some older Qt5.
3838
qimage.setDevicePixelRatio(dpi_ratio)
3939
painter=QtGui.QPainter(self)
40-
ifself._erase_before_paint:
41-
painter.eraseRect(self.rect())
42-
self._erase_before_paint=False
40+
painter.eraseRect(event.rect())
4341
painter.drawImage(0,0,qimage)
4442
self._draw_rect_callback(painter)
4543
painter.end()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp