File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -10,8 +10,9 @@ def __init__(self, figure):
10
10
11
11
def paintEvent (self , event ):
12
12
self ._update_dpi ()
13
- width = self .width ()
14
- height = self .height ()
13
+ dpi_ratio = self ._dpi_ratio
14
+ width = dpi_ratio * self .width ()
15
+ height = dpi_ratio * self .height ()
15
16
surface = cairo .ImageSurface (cairo .FORMAT_ARGB32 , width , height )
16
17
self ._renderer .set_ctx_from_surface (surface )
17
18
self ._renderer .set_width_height (width , height )
@@ -23,6 +24,9 @@ def paintEvent(self, event):
23
24
# QImage under PySide on Python 3.
24
25
if QT_API == 'PySide' and six .PY3 :
25
26
ctypes .c_long .from_address (id (buf )).value = 1
27
+ if hasattr (qimage , 'setDevicePixelRatio' ):
28
+ # Not available on Qt4 or some older Qt5.
29
+ qimage .setDevicePixelRatio (dpi_ratio )
26
30
painter = QtGui .QPainter (self )
27
31
painter .drawImage (0 , 0 , qimage )
28
32
self ._draw_rect_callback (painter )
You can’t perform that action at this time.
0 commit comments