From b66e6e8ad68717f186071153aefc6ae012170c01 Mon Sep 17 00:00:00 2001 From: Luke Campagnola Date: Mon, 7 Jan 2013 10:45:17 -0500 Subject: [PATCH] Speed up PlotCurveItem in some cases (avoid drawing shadow when it is not needed) --- pyqtgraph/graphicsItems/PlotCurveItem.py | 8 +++++--- pyqtgraph/graphicsItems/PlotDataItem.py | 11 +---------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/pyqtgraph/graphicsItems/PlotCurveItem.py b/pyqtgraph/graphicsItems/PlotCurveItem.py index 5314b0f2..8af13e19 100644 --- a/pyqtgraph/graphicsItems/PlotCurveItem.py +++ b/pyqtgraph/graphicsItems/PlotCurveItem.py @@ -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 diff --git a/pyqtgraph/graphicsItems/PlotDataItem.py b/pyqtgraph/graphicsItems/PlotDataItem.py index 714210c4..22aa3ad9 100644 --- a/pyqtgraph/graphicsItems/PlotDataItem.py +++ b/pyqtgraph/graphicsItems/PlotDataItem.py @@ -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):