@@ -80,8 +80,6 @@ def paintEvent( self, e ):
8080 if DEBUG : print 'FigureCanvasQtAgg.paintEvent: ' , self , \
8181 self .get_width_height ()
8282
83- p = QtGui .QPainter ( self )
84-
8583 # only replot data when needed
8684 if type (self .replot ) is bool : # might be a bbox for blitting
8785 if self .replot :
@@ -99,13 +97,15 @@ def paintEvent( self, e ):
9997 qImage = QtGui .QImage (stringBuffer , self .renderer .width ,
10098 self .renderer .height ,
10199 QtGui .QImage .Format_ARGB32 )
100+ p = QtGui .QPainter (self )
102101 p .drawPixmap (QtCore .QPoint (0 , 0 ), QtGui .QPixmap .fromImage (qImage ))
103102
104103 # draw the zoom rectangle to the QPainter
105104 if self .drawRect :
106105 p .setPen ( QtGui .QPen ( QtCore .Qt .black , 1 , QtCore .Qt .DotLine ) )
107106 p .drawRect ( self .rect [0 ], self .rect [1 ], self .rect [2 ], self .rect [3 ] )
108107
108+ p .end ()
109109 # we are blitting here
110110 else :
111111 bbox = self .replot
@@ -114,10 +114,10 @@ def paintEvent( self, e ):
114114 reg = self .copy_from_bbox (bbox )
115115 stringBuffer = reg .to_string ()
116116 qImage = QtGui .QImage (stringBuffer , w , h , QtGui .QImage .Format_ARGB32 )
117+ p = QtGui .QPainter (self )
117118 pixmap = QtGui .QPixmap .fromImage (qImage )
118119 p .drawPixmap (QtCore .QPoint (l , self .renderer .height - t ), pixmap )
119-
120- p .end ()
120+ p .end ()
121121 self .replot = False
122122 self .drawRect = False
123123
0 commit comments