File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 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):
1010
1111 def paintEvent (self , event ):
1212 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 ()
1516 surface = cairo .ImageSurface (cairo .FORMAT_ARGB32 , width , height )
1617 self ._renderer .set_ctx_from_surface (surface )
1718 self ._renderer .set_width_height (width , height )
@@ -23,6 +24,9 @@ def paintEvent(self, event):
2324 # QImage under PySide on Python 3.
2425 if QT_API == 'PySide' and six .PY3 :
2526 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 )
2630 painter = QtGui .QPainter (self )
2731 painter .drawImage (0 , 0 , qimage )
2832 self ._draw_rect_callback (painter )
You can’t perform that action at this time.
0 commit comments