comparison layer/SpectrogramLayer.h @ 95:1b3996a86cfa

* Incremental refresh of spectrogram layer
author Chris Cannam
date Tue, 09 May 2006 16:18:59 +0000
parents c7ade7ea3cfe
children a0e7edf9703a
comparison
equal deleted inserted replaced
94:c7ade7ea3cfe 95:1b3996a86cfa
18 18
19 #include "base/Layer.h" 19 #include "base/Layer.h"
20 #include "base/Window.h" 20 #include "base/Window.h"
21 #include "base/RealTime.h" 21 #include "base/RealTime.h"
22 #include "base/Thread.h" 22 #include "base/Thread.h"
23 #include "base/ResizeableBitmap.h"
23 #include "model/PowerOfSqrtTwoZoomConstraint.h" 24 #include "model/PowerOfSqrtTwoZoomConstraint.h"
24 #include "model/DenseTimeValueModel.h" 25 #include "model/DenseTimeValueModel.h"
25 26
26 #include <QMutex> 27 #include <QMutex>
27 #include <QWaitCondition> 28 #include <QWaitCondition>
29 #include <QImage>
30 #include <QPixmap>
28 31
29 #include <fftw3.h> 32 #include <fftw3.h>
30 33
31 class View; 34 class View;
32 class QPainter; 35 class QPainter;
258 size_t m_fillCompletion; 261 size_t m_fillCompletion;
259 }; 262 };
260 263
261 void fillCache(); 264 void fillCache();
262 265
263 mutable QPixmap *m_pixmapCache; 266 struct PixmapCache
264 mutable bool m_pixmapCacheInvalid; 267 {
265 mutable long m_pixmapCacheStartFrame; 268 QPixmap pixmap;
266 mutable size_t m_pixmapCacheZoomLevel; 269 QRect validArea;
267 270 long startFrame;
271 size_t zoomLevel;
272 };
273 typedef std::map<const View *, PixmapCache> ViewPixmapCache;
274 void invalidatePixmapCaches();
275 void invalidatePixmapCaches(size_t startFrame, size_t endFrame);
276 mutable ViewPixmapCache m_pixmapCaches;
277 mutable QImage m_drawBuffer;
278
268 QWaitCondition m_condition; 279 QWaitCondition m_condition;
269 mutable QMutex m_mutex; 280 mutable QMutex m_mutex;
270 281
271 CacheFillThread *m_fillThread; 282 CacheFillThread *m_fillThread;
272 QTimer *m_updateTimer; 283 QTimer *m_updateTimer;