Mercurial > hg > svgui
comparison layer/ScrollableMagRangeCache.cpp @ 1120:65cdaf8d6b50 spectrogram-minor-refactor
Toward updating mag cache
author | Chris Cannam |
---|---|
date | Wed, 20 Jul 2016 13:40:23 +0100 |
parents | 175d4e15884d |
children | 94370157b265 |
comparison
equal
deleted
inserted
replaced
1119:be5b91ec81a0 | 1120:65cdaf8d6b50 |
---|---|
76 m_ranges = newRanges; | 76 m_ranges = newRanges; |
77 } | 77 } |
78 } | 78 } |
79 | 79 |
80 void | 80 void |
81 ScrollableMagRangeCache::sampleColumn(int column, const MagnitudeRange &r) | |
82 { | |
83 if (!in_range_for(m_ranges, column)) { | |
84 cerr << "ERROR: ScrollableMagRangeCache::sampleColumn: column " << column | |
85 << " is out of range for cache of width " << m_ranges.size() | |
86 << " (with start frame " << m_startFrame << ")" << endl; | |
87 throw logic_error("column out of range"); | |
88 } else { | |
89 m_ranges[column].sample(r); | |
90 } | |
91 } | |
92 | |
93 void | |
81 ScrollableMagRangeCache::sampleColumn(const LayerGeometryProvider *v, | 94 ScrollableMagRangeCache::sampleColumn(const LayerGeometryProvider *v, |
82 sv_frame_t frame, | 95 sv_frame_t frame, |
83 const MagnitudeRange &r) | 96 const MagnitudeRange &r) |
84 { | 97 { |
85 int x = (v->getXForFrame(frame) - | 98 int x = (v->getXForFrame(frame) - |
86 v->getXForFrame(m_startFrame)); | 99 v->getXForFrame(m_startFrame)); |
87 | 100 |
88 if (!in_range_for(m_ranges, x)) { | 101 if (!in_range_for(m_ranges, x)) { |
89 cerr << "WARNING: ScrollableMagRangeCache::sampleColumn: column " << x | 102 cerr << "WARNING: ScrollableMagRangeCache::sampleColumn: column " << x |
90 << " arising from frame " << frame << " is out of range for cache " | 103 << " arising from frame " << frame << " is out of range for cache " |
91 << "of width " << m_ranges.size() << endl; | 104 << "of width " << m_ranges.size() |
105 << " (with start frame " << m_startFrame << ")" << endl; | |
106 throw logic_error("column out of range"); | |
92 } else { | 107 } else { |
93 sampleColumn(x, r); | 108 sampleColumn(x, r); |
94 } | 109 } |
95 } | 110 } |
96 | 111 |