diff layer/Layer.h @ 131:eaae73b6bd28

* Suspend/resume fft data server write activity while reading from a server to repaint the spectrogram display. Makes a significant improvement to the otherwise dreadful responsiveness of spectrogram display.
author Chris Cannam
date Thu, 03 Aug 2006 12:42:15 +0000
parents 33929e0c3c6b
children 9e6b3e239b9d
line wrap: on
line diff
--- a/layer/Layer.h	Mon Jul 31 17:05:18 2006 +0000
+++ b/layer/Layer.h	Thu Aug 03 12:42:15 2006 +0000
@@ -24,6 +24,7 @@
 #include <QObject>
 #include <QRect>
 #include <QXmlAttributes>
+#include <QMutex>
 
 #include <map>
 
@@ -226,19 +227,17 @@
      * it).  The layer may respond by (for example) freeing any cache
      * memory it is using, until next time its paint method is called,
      * when it should set itself un-dormant again.
+     *
+     * A layer class that overrides this function must also call this
+     * class's implementation.
      */
-    virtual void setLayerDormant(const View *v, bool dormant) {
-	m_dormancy[v] = dormant;
-    }
+    virtual void setLayerDormant(const View *v, bool dormant);
 
     /**
      * Return whether the layer is dormant (i.e. hidden) in the given
      * view.
      */
-    virtual bool isLayerDormant(const View *v) const {
-	if (m_dormancy.find(v) == m_dormancy.end()) return false;
-	return m_dormancy.find(v)->second;
-    }
+    virtual bool isLayerDormant(const View *v) const;
 
     virtual PlayParameters *getPlayParameters();
 
@@ -293,7 +292,8 @@
     void layerParametersChanged();
     void layerNameChanged();
 
-protected:
+private:
+    mutable QMutex m_dormancyMutex;
     mutable std::map<const void *, bool> m_dormancy;
 };