Speed up PlotCurveItem in some cases (avoid drawing shadow when it is not needed)

This commit is contained in:
Luke Campagnola 2013-01-07 10:45:17 -05:00
parent 60836462d2
commit b66e6e8ad6
2 changed files with 6 additions and 13 deletions

View File

@ -426,10 +426,12 @@ class PlotCurveItem(GraphicsObject):
p.fillPath(self.fillPath, self.opts['brush'])
prof.mark('draw fill path')
sp = fn.mkPen(self.opts['shadowPen'])
cp = fn.mkPen(self.opts['pen'])
## Copy pens and apply alpha adjustment
sp = QtGui.QPen(self.opts['shadowPen'])
cp = QtGui.QPen(self.opts['pen'])
#sp = QtGui.QPen(self.opts['shadowPen'])
#cp = QtGui.QPen(self.opts['pen'])
#for pen in [sp, cp]:
#if pen is None:
#continue

View File

@ -379,10 +379,7 @@ class PlotDataItem(GraphicsObject):
def updateItems(self):
#for c in self.curves+self.scatters:
#if c.scene() is not None:
#c.scene().removeItem(c)
curveArgs = {}
for k,v in [('pen','pen'), ('shadowPen','shadowPen'), ('fillLevel','fillLevel'), ('fillBrush', 'brush'), ('antialias', 'antialias')]:
curveArgs[v] = self.opts[k]
@ -399,18 +396,12 @@ class PlotDataItem(GraphicsObject):
self.curve.show()
else:
self.curve.hide()
#curve = PlotCurveItem(x=x, y=y, **curveArgs)
#curve.setParentItem(self)
#self.curves.append(curve)
if scatterArgs['symbol'] is not None:
self.scatter.setData(x=x, y=y, **scatterArgs)
self.scatter.show()
else:
self.scatter.hide()
#sp = ScatterPlotItem(x=x, y=y, **scatterArgs)
#sp.setParentItem(self)
#self.scatters.append(sp)
def getData(self):