# HG changeset patch # User Chris Cannam # Date 1468413039 -3600 # Node ID 1364cbf4453d5ce32632ede9cfaa806ea232b8db # Parent 102f986ec032f21f557ac5a17de36634e75e352f Begin using renderer in colour 3d plot layer diff -r 102f986ec032 -r 1364cbf4453d layer/Colour3DPlotLayer.cpp --- a/layer/Colour3DPlotLayer.cpp Wed Jul 13 13:06:28 2016 +0100 +++ b/layer/Colour3DPlotLayer.cpp Wed Jul 13 13:30:39 2016 +0100 @@ -64,6 +64,7 @@ m_peakResolution(256), m_miny(0), m_maxy(0), + m_synchronous(false), m_peakCache(0), m_peakCacheDivisor(8) { @@ -81,6 +82,12 @@ } void +Colour3DPlotLayer::setSynchronousPainting(bool synchronous) +{ + m_synchronous = synchronous; +} + +void Colour3DPlotLayer::setModel(const DenseThreeDimensionalModel *model) { if (m_model == model) return; @@ -1318,6 +1325,36 @@ } void +Colour3DPlotLayer::paintAlternative(LayerGeometryProvider *v, QPainter &paint, QRect rect) const +{ + static int depth = 0; + + Colour3DPlotRenderer *renderer = getRenderer(v); + + if (m_synchronous) { + (void)renderer->render(v, paint, rect); + return; + } + + ++depth; + cerr << "paint depth " << depth << endl; + + (void)renderer->renderTimeConstrained(v, paint, rect); + + //!!! + mag range + + QRect uncached = renderer->getLargestUncachedRect(); + if (uncached.width() > 0) { + cerr << "updating rect at " << uncached.x() << " width " + << uncached.width() << endl; + v->updatePaintRect(uncached); + } + + cerr << "exiting paint depth " << depth << endl; + --depth; +} + +void Colour3DPlotLayer::paint(LayerGeometryProvider *v, QPainter &paint, QRect rect) const { /* @@ -1346,6 +1383,15 @@ #endif return; } + + //!!! why is the setLayerDormant(false) found here in + //!!! SpectrogramLayer not present in Colour3DPlotLayer? + //!!! unnecessary? vestigial? forgotten? + + paintAlternative(v, paint, rect); + return; + + //!!!??? if (m_normalization == ColumnOp::NormalizeVisibleArea) { rect = v->getPaintRect(); diff -r 102f986ec032 -r 1364cbf4453d layer/Colour3DPlotLayer.h --- a/layer/Colour3DPlotLayer.h Wed Jul 13 13:06:28 2016 +0100 +++ b/layer/Colour3DPlotLayer.h Wed Jul 13 13:30:39 2016 +0100 @@ -52,6 +52,7 @@ } virtual const Model *getModel() const { return m_model; } virtual void paint(LayerGeometryProvider *v, QPainter &paint, QRect rect) const; + virtual void setSynchronousPainting(bool synchronous); virtual int getVerticalScaleWidth(LayerGeometryProvider *v, bool, QPainter &) const; virtual void paintVerticalScale(LayerGeometryProvider *v, bool, QPainter &paint, QRect rect) const; @@ -172,6 +173,8 @@ int m_miny; int m_maxy; + bool m_synchronous; + mutable Dense3DModelPeakCache *m_peakCache; const int m_peakCacheDivisor; Dense3DModelPeakCache *getPeakCache() const; @@ -208,6 +211,9 @@ int getColourScaleWidth(QPainter &) const; void fillCache(int firstBin, int lastBin) const; void paintDense(LayerGeometryProvider *v, QPainter &paint, QRect rect) const; + + void paintAlternative(LayerGeometryProvider *v, QPainter &paint, QRect rect) const; + }; #endif diff -r 102f986ec032 -r 1364cbf4453d layer/SpectrogramLayer.cpp --- a/layer/SpectrogramLayer.cpp Wed Jul 13 13:06:28 2016 +0100 +++ b/layer/SpectrogramLayer.cpp Wed Jul 13 13:30:39 2016 +0100 @@ -1531,6 +1531,7 @@ ScrollableImageCache & SpectrogramLayer::getImageCacheReference(const LayerGeometryProvider *view) const { + //!!! to go? if (m_imageCaches.find(view->getId()) == m_imageCaches.end()) { m_imageCaches[view->getId()] = ScrollableImageCache(); }