diff layer/Colour3DPlotLayer.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 a42e5a3c63ef
children 343887ac6766
line wrap: on
line diff
--- a/layer/Colour3DPlotLayer.cpp	Wed Jul 20 13:40:23 2016 +0100
+++ b/layer/Colour3DPlotLayer.cpp	Fri Jul 22 12:17:55 2016 +0100
@@ -609,16 +609,19 @@
 }
 
 bool
-Colour3DPlotLayer::isLayerScrollable(const LayerGeometryProvider *v) const
+Colour3DPlotLayer::isLayerScrollable(const LayerGeometryProvider */* v */) const
 {
     if (m_normalizeVisibleArea) {
         return false;
     }
-    if (getRenderer(v)->willRenderOpaque(v)) {
-        return true;
-    }
-    QPoint discard;
-    return !v->shouldIlluminateLocalFeatures(this, discard);
+    //!!! ah hang on, if we're potentially rendering incrementally
+    //!!! they we can't be scrollable
+    return false;
+//    if (getRenderer(v)->willRenderOpaque(v)) {
+//        return true;
+//    }
+//    QPoint discard;
+//    return !v->shouldIlluminateLocalFeatures(this, discard);
 }
 
 bool
@@ -1080,31 +1083,39 @@
 Colour3DPlotLayer::paintWithRenderer(LayerGeometryProvider *v,
                                      QPainter &paint, QRect rect) const
 {
-    static int depth = 0;
-    
     Colour3DPlotRenderer *renderer = getRenderer(v);
 
+    Colour3DPlotRenderer::RenderResult result;
+    
     if (m_synchronous) {
-        (void)renderer->render(v, paint, rect);
-        return;
+
+        result = renderer->render(v, paint, rect);
+
+    } else {
+
+        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
 
-    ++depth;
-    cerr << "paint depth " << depth << endl;
+    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