Mercurial > hg > svgui
diff layer/ScrollableMagRangeCache.h @ 1119:be5b91ec81a0 spectrogram-minor-refactor
Inch toward using the mag cache (currently will crash with debug exception)
author | Chris Cannam |
---|---|
date | Wed, 20 Jul 2016 08:42:04 +0100 |
parents | 175d4e15884d |
children | 65cdaf8d6b50 |
line wrap: on
line diff
--- a/layer/ScrollableMagRangeCache.h Wed Jul 20 08:30:20 2016 +0100 +++ b/layer/ScrollableMagRangeCache.h Wed Jul 20 08:42:04 2016 +0100 @@ -95,12 +95,33 @@ bool isColumnSet(int column) const { return in_range_for(m_ranges, column) && m_ranges.at(column).isSet(); } + + bool areColumnsSet(int x, int count) const { + for (int i = 0; i < count; ++i) { + if (!isColumnSet(x + i)) return false; + } + return true; + } - const MagnitudeRange &getRange(int column) const { + /** + * Get the magnitude range for a single column. + */ + MagnitudeRange getRange(int column) const { return m_ranges.at(column); } /** + * Get the magnitude range for a range of columns. + */ + MagnitudeRange getRange(int x, int count) const { + MagnitudeRange r; + for (int i = 0; i < count; ++i) { + r.sample(m_ranges.at(x + i)); + } + return r; + } + + /** * Set the new start frame for the cache, according to the * geometry of the supplied LayerGeometryProvider, if possible * also moving along any existing valid data within the cache so