changeset 1141:f19dcb288123 spectrogram-minor-refactor

Minor tidy, + go back to opaque-only spectrogram as intended
author Chris Cannam
date Fri, 05 Aug 2016 13:48:14 +0100
parents ca910d8070c8
children 8f4634b82e36
files layer/Colour3DPlotRenderer.cpp layer/SpectrogramLayer.cpp
diffstat 2 files changed, 9 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/layer/Colour3DPlotRenderer.cpp	Fri Aug 05 12:47:10 2016 +0100
+++ b/layer/Colour3DPlotRenderer.cpp	Fri Aug 05 13:48:14 2016 +0100
@@ -238,21 +238,13 @@
                     pr.x(), pr.y(), pr.width(), pr.height());
 
     if (!timeConstrained && (pr != rect)) {
-        //!!! on a first cut, there is a risk that this will happen
-        //!!! when we are at start/end of model -- trap, report, and
-        //!!! then fix
-        throw std::logic_error("internal error: failed to render entire requested rect even when not time-constrained");
+        cerr << "WARNING: failed to render entire requested rect "
+             << "even when not time-constrained" << endl;
     }
 
     MagnitudeRange range = m_magCache.getRange(reqx0, reqx1 - reqx0);
     
     return { pr, range };
-
-    //!!! todo, here or in caller: illuminateLocalFeatures
-
-    //!!! todo: handle vertical range other than full range of column
-    
-    //!!! fft model scaling?
 }
 
 Colour3DPlotRenderer::RenderType
--- a/layer/SpectrogramLayer.cpp	Fri Aug 05 12:47:10 2016 +0100
+++ b/layer/SpectrogramLayer.cpp	Fri Aug 05 13:48:14 2016 +0100
@@ -853,11 +853,14 @@
     int distance = r - m_colourRotation;
 
     if (distance != 0) {
-//!!!	rotatePalette(-distance);
 	m_colourRotation = r;
     }
-    
-    invalidateRenderers(); //!!! in theory we shouldn't have to do this... but...
+
+    // Initially the idea with colour rotation was that we would just
+    // rotate the palette of an already-generated cache. That's not
+    // really practical now that cacheing is handled in a separate
+    // class in which the main cache no longer has a palette.
+    invalidateRenderers();
     
     emit layerParametersChanged();
 }
@@ -1003,10 +1006,6 @@
         Layer::setLayerDormant(v, true);
 
 	invalidateRenderers();
-
-        //!!! in theory we should call invalidateFFTModel() if and
-        //!!! only if there are no remaining views in which we are not
-        //!!! dormant
 	
     } else {
 
@@ -1038,7 +1037,6 @@
     cerr << "SpectrogramLayer::cacheInvalid(" << from << ", " << to << ")" << endl;
 #endif
 
-    //!!! now in common with Colour3DPlotLayer:
     // We used to call invalidateMagnitudes(from, to) to invalidate
     // only those caches whose views contained some of the (from, to)
     // range. That's the right thing to do; it has been lost in
@@ -1465,7 +1463,7 @@
         params.normalization = m_normalization;
         params.binDisplay = m_binDisplay;
         params.binScale = m_binScale;
-        params.alwaysOpaque = false; //!!! should be true though
+        params.alwaysOpaque = true;
         params.invertVertical = false;
         params.scaleFactor = 1.0;
         params.colourRotation = m_colourRotation;