comparison layer/ScrollableImageCache.h @ 1090:c8c747783110 spectrogram-minor-refactor

Cut over to using the renderer (though it's very incomplete) and fix some cache problems and pointer lifetime misunderstandings
author Chris Cannam
date Tue, 05 Jul 2016 17:48:26 +0100
parents cbc7c8675706
children 261a00010918
comparison
equal deleted inserted replaced
1089:c8683d94442a 1090:c8c747783110
35 * using the drawImage call. 35 * using the drawImage call.
36 */ 36 */
37 class ScrollableImageCache 37 class ScrollableImageCache
38 { 38 {
39 public: 39 public:
40 ScrollableImageCache(const LayerGeometryProvider *v = 0) : 40 ScrollableImageCache() :
41 m_v(v),
42 m_left(0), 41 m_left(0),
43 m_width(0), 42 m_width(0),
44 m_startFrame(0), 43 m_startFrame(0),
45 m_zoomLevel(0) 44 m_zoomLevel(0)
46 {} 45 {}
110 const QImage &getImage() const { 109 const QImage &getImage() const {
111 return m_image; 110 return m_image;
112 } 111 }
113 112
114 /** 113 /**
115 * Set the new start frame for the cache, if possible also moving 114 * Set the new start frame for the cache, according to the
116 * along any existing valid data within the cache so that it 115 * geometry of the supplied LayerGeometryProvider, if possible
117 * continues to be valid for the new start frame. 116 * also moving along any existing valid data within the cache so
117 * that it continues to be valid for the new start frame.
118 */ 118 */
119 void scrollTo(sv_frame_t newStartFrame); 119 void scrollTo(LayerGeometryProvider *v, sv_frame_t newStartFrame);
120 120
121 /** 121 /**
122 * Take a left coordinate and width describing a region, and 122 * Take a left coordinate and width describing a region, and
123 * adjust them so that they are contiguous with the cache valid 123 * adjust them so that they are contiguous with the cache valid
124 * region and so that the union of the adjusted region with the 124 * region and so that the union of the adjusted region with the
140 QImage image, 140 QImage image,
141 int imageLeft, 141 int imageLeft,
142 int imageWidth); 142 int imageWidth);
143 143
144 private: 144 private:
145 const LayerGeometryProvider *m_v;
146 QImage m_image; 145 QImage m_image;
147 int m_left; // of valid region 146 int m_left; // of valid region
148 int m_width; // of valid region 147 int m_width; // of valid region
149 sv_frame_t m_startFrame; 148 sv_frame_t m_startFrame;
150 int m_zoomLevel; 149 int m_zoomLevel;