Mercurial > hg > svgui
diff layer/SpectrogramLayer.cpp @ 1121:d930ff725f64 spectrogram-minor-refactor
Wiring through the magnitude range updates
author | Chris Cannam |
---|---|
date | Fri, 22 Jul 2016 12:17:55 +0100 |
parents | 64709d4d09ef |
children | 94370157b265 |
line wrap: on
line diff
--- a/layer/SpectrogramLayer.cpp Wed Jul 20 13:40:23 2016 +0100 +++ b/layer/SpectrogramLayer.cpp Fri Jul 22 12:17:55 2016 +0100 @@ -1385,12 +1385,13 @@ cerr << "SpectrogramLayer::invalidateMagnitudes called" << endl; #endif m_viewMags.clear(); - for (vector<MagnitudeRange>::iterator i = m_columnMags.begin(); +/*!!! for (vector<MagnitudeRange>::iterator i = m_columnMags.begin(); i != m_columnMags.end(); ++i) { *i = MagnitudeRange(); } +*/ } - +/*!!! bool SpectrogramLayer::updateViewMagnitudes(LayerGeometryProvider *v) const { @@ -1434,7 +1435,7 @@ m_viewMags[v->getId()] = mag; return true; } - +*/ void SpectrogramLayer::setSynchronousPainting(bool synchronous) { @@ -1487,31 +1488,42 @@ void SpectrogramLayer::paintWithRenderer(LayerGeometryProvider *v, QPainter &paint, QRect rect) const { - static int depth = 0; + Colour3DPlotRenderer *renderer = getRenderer(v); + + Colour3DPlotRenderer::RenderResult result; - Colour3DPlotRenderer *renderer = getRenderer(v); - if (m_synchronous) { - (void)renderer->render(v, paint, rect); - return; + + result = renderer->render(v, paint, rect); + + } else { + + result = renderer->renderTimeConstrained(v, paint, rect); + + cerr << "mag range in this paint: " << result.range.getMin() << " -> " + << result.range.getMax() << endl; + + //!!! + + QRect uncached = renderer->getLargestUncachedRect(v); + if (uncached.width() > 0) { + cerr << "updating rect at " << uncached.x() << " width " + << uncached.width() << endl; + v->updatePaintRect(uncached); + } } - ++depth; - cerr << "paint depth " << depth << endl; + //!!! at the mo this measures the range of the whole thing, not + //!!! just the view - need to reset it when view extents change + + m_viewMags[v->getId()].sample(result.range); - (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; + cerr << "mag range in this view: " + << m_viewMags[v->getId()].getMin() + << " -> " + << m_viewMags[v->getId()].getMax() + << endl; + } void