diff layer/Colour3DPlotLayer.cpp @ 1123:343887ac6766 spectrogram-minor-refactor

Some tidying
author Chris Cannam
date Fri, 22 Jul 2016 14:42:36 +0100
parents d930ff725f64
children ee98d587cd1a
line wrap: on
line diff
--- a/layer/Colour3DPlotLayer.cpp	Fri Jul 22 13:56:24 2016 +0100
+++ b/layer/Colour3DPlotLayer.cpp	Fri Jul 22 14:42:36 2016 +0100
@@ -1086,6 +1086,12 @@
     Colour3DPlotRenderer *renderer = getRenderer(v);
 
     Colour3DPlotRenderer::RenderResult result;
+    MagnitudeRange magRange;
+    int viewId = v->getId();
+
+    if (!renderer->geometryChanged(v)) {
+        magRange = m_viewMags[viewId];
+    }
     
     if (m_synchronous) {
 
@@ -1095,20 +1101,20 @@
 
         result = renderer->renderTimeConstrained(v, paint, rect);
 
-        //!!! + mag range
-
         QRect uncached = renderer->getLargestUncachedRect(v);
         if (uncached.width() > 0) {
-            cerr << "updating rect at " << uncached.x() << " width "
-                 << uncached.width() << endl;
             v->updatePaintRect(uncached);
         }
     }
     
-    //!!! at the mo this measures the range of the whole thing, not
-    //!!! just the view - need to reset it when view extents change
+    magRange.sample(result.range);
 
-    m_viewMags[v->getId()].sample(result.range);
+    if (magRange.isSet()) {
+        if (!(m_viewMags[viewId] == magRange)) {
+            m_viewMags[viewId] = magRange;
+    //!!! now need to do the normalise-visible thing
+        }
+    }
     
     cerr << "mag range in this view: "
          << m_viewMags[v->getId()].getMin()