Mercurial > hg > svgui
comparison layer/ScrollableImageCache.cpp @ 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 | 7ebfb61b1701 |
children | 261a00010918 |
comparison
equal
deleted
inserted
replaced
1089:c8683d94442a | 1090:c8c747783110 |
---|---|
15 #include "ScrollableImageCache.h" | 15 #include "ScrollableImageCache.h" |
16 | 16 |
17 #include <iostream> | 17 #include <iostream> |
18 using namespace std; | 18 using namespace std; |
19 | 19 |
20 //#define DEBUG_SCROLLABLE_IMAGE_CACHE 1 | 20 #define DEBUG_SCROLLABLE_IMAGE_CACHE 1 |
21 | 21 |
22 void | 22 void |
23 ScrollableImageCache::scrollTo(sv_frame_t newStartFrame) | 23 ScrollableImageCache::scrollTo(LayerGeometryProvider *v, sv_frame_t newStartFrame) |
24 { | 24 { |
25 if (!m_v) throw std::logic_error("ScrollableImageCache: not associated with a LayerGeometryProvider"); | |
26 | |
27 if (m_startFrame == newStartFrame) { | 25 if (m_startFrame == newStartFrame) { |
28 // haven't moved | 26 // haven't moved |
29 return; | 27 return; |
30 } | 28 } |
31 | 29 |
32 int dx = (m_v->getXForFrame(m_startFrame) - | 30 int dx = (v->getXForFrame(m_startFrame) - |
33 m_v->getXForFrame(newStartFrame)); | 31 v->getXForFrame(newStartFrame)); |
34 | 32 |
35 #ifdef DEBUG_SCROLLABLE_IMAGE_CACHE | 33 #ifdef DEBUG_SCROLLABLE_IMAGE_CACHE |
36 cerr << "ScrollableImageCache::scrollTo: start frame " << m_startFrame | 34 cerr << "ScrollableImageCache::scrollTo: start frame " << m_startFrame |
37 << " -> " << newStartFrame << ", dx = " << dx << endl; | 35 << " -> " << newStartFrame << ", dx = " << dx << endl; |
38 #endif | 36 #endif |