Mercurial > hg > svgui
comparison layer/ScrollableImageCache.cpp @ 1079:7ebfb61b1701 spectrogram-minor-refactor
More filling in render & cache code
author | Chris Cannam |
---|---|
date | Thu, 30 Jun 2016 15:46:14 +0100 |
parents | 25b035362c44 |
children | c8c747783110 |
comparison
equal
deleted
inserted
replaced
1078:ee01a4062747 | 1079:7ebfb61b1701 |
---|---|
21 | 21 |
22 void | 22 void |
23 ScrollableImageCache::scrollTo(sv_frame_t newStartFrame) | 23 ScrollableImageCache::scrollTo(sv_frame_t newStartFrame) |
24 { | 24 { |
25 if (!m_v) throw std::logic_error("ScrollableImageCache: not associated with a LayerGeometryProvider"); | 25 if (!m_v) throw std::logic_error("ScrollableImageCache: not associated with a LayerGeometryProvider"); |
26 | |
27 if (m_startFrame == newStartFrame) { | |
28 // haven't moved | |
29 return; | |
30 } | |
26 | 31 |
27 int dx = (m_v->getXForFrame(m_startFrame) - | 32 int dx = (m_v->getXForFrame(m_startFrame) - |
28 m_v->getXForFrame(newStartFrame)); | 33 m_v->getXForFrame(newStartFrame)); |
29 | 34 |
30 #ifdef DEBUG_SCROLLABLE_IMAGE_CACHE | 35 #ifdef DEBUG_SCROLLABLE_IMAGE_CACHE |
39 } | 44 } |
40 | 45 |
41 int w = m_image.width(); | 46 int w = m_image.width(); |
42 | 47 |
43 if (dx == 0) { | 48 if (dx == 0) { |
44 // haven't moved | 49 // haven't moved visibly |
45 return; | 50 return; |
46 } | 51 } |
47 | 52 |
48 if (dx <= -w || dx >= w) { | 53 if (dx <= -w || dx >= w) { |
49 // scrolled entirely off | 54 // scrolled entirely off |