diff layer/SpectrogramLayer.h @ 1211:7a19738b9762 3.0-integration

Recreate FFT model when something changes, not the next time it's requested (avoids extra work when only retrieving the model)
author Chris Cannam
date Thu, 05 Jan 2017 11:10:57 +0000
parents c53ed1a6fcbd
children a1ee3108d1d3
line wrap: on
line diff
--- a/layer/SpectrogramLayer.h	Wed Jan 04 16:03:12 2017 +0000
+++ b/layer/SpectrogramLayer.h	Thu Jan 05 11:10:57 2017 +0000
@@ -302,9 +302,12 @@
     int getFFTOversampling() const;
     int getFFTSize() const; // m_windowSize * getFFTOversampling()
 
-    mutable FFTModel *m_fftModel; //!!! should not be mutable, see getFFTModel()?
-    mutable Dense3DModelPeakCache *m_peakCache;
+    FFTModel *m_fftModel;
+    FFTModel *getFFTModel() const { return m_fftModel; }
+    Dense3DModelPeakCache *m_peakCache;
+    Dense3DModelPeakCache *getPeakCache() const { return m_peakCache; }
     const int m_peakCacheDivisor;
+    void recreateFFTModel();
 
     typedef std::map<int, MagnitudeRange> ViewMagMap; // key is view id
     mutable ViewMagMap m_viewMags;
@@ -316,10 +319,6 @@
     Colour3DPlotRenderer *getRenderer(LayerGeometryProvider *) const;
     void invalidateRenderers();
     
-    FFTModel *getFFTModel() const;
-    Dense3DModelPeakCache *getPeakCache() const;
-    void invalidateFFTModel();
-
     void paintWithRenderer(LayerGeometryProvider *v, QPainter &paint, QRect rect) const;
 
     void paintDetailedScale(LayerGeometryProvider *v,