Mercurial > hg > svgui
diff layer/Colour3DPlotRenderer.cpp @ 1122:94370157b265 spectrogram-minor-refactor
Fixes and debug output for mag range calculations
author | Chris Cannam |
---|---|
date | Fri, 22 Jul 2016 13:56:24 +0100 |
parents | d930ff725f64 |
children | 343887ac6766 |
line wrap: on
line diff
--- a/layer/Colour3DPlotRenderer.cpp Fri Jul 22 12:17:55 2016 +0100 +++ b/layer/Colour3DPlotRenderer.cpp Fri Jul 22 13:56:24 2016 +0100 @@ -69,6 +69,24 @@ } } +bool +Colour3DPlotRenderer::geometryChanged(const LayerGeometryProvider *v) +{ + RenderType renderType = decideRenderType(v); + + if (renderType == DirectTranslucent) { + return true; // never cached + } + + if (m_cache.getSize() == v->getPaintSize() && + m_cache.getZoomLevel() == v->getZoomLevel() && + m_cache.getStartFrame() == v->getStartFrame()) { + return false; + } else { + return true; + } +} + Colour3DPlotRenderer::RenderResult Colour3DPlotRenderer::render(const LayerGeometryProvider *v, QPainter &paint, QRect rect, bool timeConstrained) @@ -129,7 +147,7 @@ // throw std::logic_error("Columns not set in mag cache"); } - MagnitudeRange range = m_magCache.getRange(x0, x1-x0); + MagnitudeRange range = m_magCache.getRange(x0, x1 - x0); return { rect, range }; @@ -163,6 +181,9 @@ bool rightToLeft = false; + int reqx0 = x0; + int reqx1 = x1; + if (!m_cache.isValid() && timeConstrained) { // When rendering the whole area, in a context where we might // not be able to complete the work, start from somewhere near @@ -223,14 +244,7 @@ throw std::logic_error("internal error: failed to render entire requested rect even when not time-constrained"); } - //!!! a dev debug check - if (!m_magCache.areColumnsSet(x0, x1 - x0)) { - cerr << "NB Columns (" << x0 << " -> " << x1-x0 - << ") not set in mag cache" << endl; -// throw std::logic_error("Columns not set in mag cache"); - } - - MagnitudeRange range = m_magCache.getRange(x0, x1-x0); + MagnitudeRange range = m_magCache.getRange(reqx0, reqx1 - reqx0); return { pr, range };