comparison layer/SpectrogramLayer.h @ 478:0990b95140e3

* incremental commit
author Chris Cannam
date Tue, 03 Feb 2009 12:02:17 +0000
parents 92f4d88241b8
children 0033dbfb92e3
comparison
equal deleted inserted replaced
477:92f4d88241b8 478:0990b95140e3
282 }; 282 };
283 283
284 Palette m_palette; 284 Palette m_palette;
285 285
286 /** 286 /**
287 * PixmapCache covers the area of the view, at view resolution. 287 * ImageCache covers the area of the view, at view resolution.
288 * Not all of it is necessarily valid at once (it is refreshed 288 * Not all of it is necessarily valid at once (it is refreshed
289 * in parts when scrolling, for example). 289 * in parts when scrolling, for example).
290 */ 290 */
291 struct PixmapCache 291 struct ImageCache
292 { 292 {
293 QPixmap pixmap; 293 QImage image;
294 QRect validArea; 294 QRect validArea;
295 long startFrame; 295 long startFrame;
296 size_t zoomLevel; 296 size_t zoomLevel;
297 }; 297 };
298 typedef std::map<const View *, PixmapCache> ViewPixmapCache; 298 typedef std::map<const View *, ImageCache> ViewImageCache;
299 void invalidatePixmapCaches(); 299 void invalidateImageCaches();
300 void invalidatePixmapCaches(size_t startFrame, size_t endFrame); 300 void invalidateImageCaches(size_t startFrame, size_t endFrame);
301 mutable ViewPixmapCache m_pixmapCaches; 301 mutable ViewImageCache m_imageCaches;
302 302
303 /** 303 /**
304 * When painting, we draw directly onto the draw buffer and then 304 * When painting, we draw directly onto the draw buffer and then
305 * copy this to the part of the pixmap cache that needed refreshing 305 * copy this to the part of the image cache that needed refreshing
306 * before copying the pixmap cache onto the window. (Remind me why 306 * before copying the image cache onto the window. (Remind me why
307 * we don't draw directly onto the cache?) 307 * we don't draw directly onto the cache?)
308 */ 308 */
309 mutable QImage m_drawBuffer; 309 mutable QImage m_drawBuffer;
310 310
311 mutable QTimer *m_updateTimer; 311 mutable QTimer *m_updateTimer;
411 typedef std::map<const View *, MagnitudeRange> ViewMagMap; 411 typedef std::map<const View *, MagnitudeRange> ViewMagMap;
412 mutable ViewMagMap m_viewMags; 412 mutable ViewMagMap m_viewMags;
413 mutable std::vector<MagnitudeRange> m_columnMags; 413 mutable std::vector<MagnitudeRange> m_columnMags;
414 void invalidateMagnitudes(); 414 void invalidateMagnitudes();
415 bool updateViewMagnitudes(View *v) const; 415 bool updateViewMagnitudes(View *v) const;
416 bool getColumnValues(View *v, FFTModel *fft, int x0, int x, 416 bool paintColumnValues(View *v, FFTModel *fft, int x0, int x,
417 int minbin, int maxbin, 417 int minbin, int maxbin,
418 float displayMinFreq, float displayMaxFreq, 418 float displayMinFreq, float displayMaxFreq,
419 const int h, 419 const int h,
420 const float *yforbin, float *yval) const; 420 const float *yforbin) const;
421 421
422 virtual void updateMeasureRectYCoords(View *v, const MeasureRect &r) const; 422 virtual void updateMeasureRectYCoords(View *v, const MeasureRect &r) const;
423 virtual void setMeasureRectYCoord(View *v, MeasureRect &r, bool start, int y) const; 423 virtual void setMeasureRectYCoord(View *v, MeasureRect &r, bool start, int y) const;
424 }; 424 };
425 425