diff 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
line wrap: on
line diff
--- a/layer/ScrollableImageCache.cpp	Tue Jul 05 12:20:56 2016 +0100
+++ b/layer/ScrollableImageCache.cpp	Tue Jul 05 17:48:26 2016 +0100
@@ -17,20 +17,18 @@
 #include <iostream>
 using namespace std;
 
-//#define DEBUG_SCROLLABLE_IMAGE_CACHE 1
+#define DEBUG_SCROLLABLE_IMAGE_CACHE 1
 
 void
-ScrollableImageCache::scrollTo(sv_frame_t newStartFrame)
+ScrollableImageCache::scrollTo(LayerGeometryProvider *v, sv_frame_t newStartFrame)
 {
-    if (!m_v) throw std::logic_error("ScrollableImageCache: not associated with a LayerGeometryProvider");
-
     if (m_startFrame == newStartFrame) {
 	// haven't moved
         return;
     }
 	
-    int dx = (m_v->getXForFrame(m_startFrame) -
-	      m_v->getXForFrame(newStartFrame));
+    int dx = (v->getXForFrame(m_startFrame) -
+	      v->getXForFrame(newStartFrame));
 
 #ifdef DEBUG_SCROLLABLE_IMAGE_CACHE
     cerr << "ScrollableImageCache::scrollTo: start frame " << m_startFrame