avoid double call to mkPen when creating PlotCurveItem objects (#817)

* avoid double call to mkPen when creating PlotCurveItem objects

* avoid unnecessary calls to mkPen in paint
This commit is contained in:
Daniel Hrisca 2019-06-24 03:30:40 +03:00 committed by Ogi Moore
parent 3e7cace746
commit 297e1d95a5

View File

@ -59,7 +59,6 @@ class PlotCurveItem(GraphicsObject):
self.metaData = {}
self.opts = {
'pen': fn.mkPen('w'),
'shadowPen': None,
'fillLevel': None,
'brush': None,
@ -70,6 +69,8 @@ class PlotCurveItem(GraphicsObject):
'mouseWidth': 8, # width of shape responding to mouse click
'compositionMode': None,
}
if 'pen' not in kargs:
self.opts['pen'] = fn.mkPen('w')
self.setClickable(kargs.get('clickable', False))
self.setData(*args, **kargs)
@ -482,8 +483,8 @@ class PlotCurveItem(GraphicsObject):
p.fillPath(self.fillPath, self.opts['brush'])
profiler('draw fill path')
sp = fn.mkPen(self.opts['shadowPen'])
cp = fn.mkPen(self.opts['pen'])
sp = self.opts['shadowPen']
cp = self.opts['pen']
## Copy pens and apply alpha adjustment
#sp = QtGui.QPen(self.opts['shadowPen'])
@ -496,8 +497,6 @@ class PlotCurveItem(GraphicsObject):
#pen.setColor(c)
##pen.setCosmetic(True)
if sp is not None and sp.style() != QtCore.Qt.NoPen:
p.setPen(sp)
p.drawPath(path)