Mercurial > hg > svgui
comparison layer/Colour3DPlotRenderer.cpp @ 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 |
comparison
equal
deleted
inserted
replaced
1118:175d4e15884d | 1119:be5b91ec81a0 |
---|---|
90 if (x1 > v->getPaintWidth()) x1 = v->getPaintWidth(); | 90 if (x1 > v->getPaintWidth()) x1 = v->getPaintWidth(); |
91 | 91 |
92 m_cache.resize(v->getPaintSize()); | 92 m_cache.resize(v->getPaintSize()); |
93 m_cache.setZoomLevel(v->getZoomLevel()); | 93 m_cache.setZoomLevel(v->getZoomLevel()); |
94 | 94 |
95 m_magCache.resize(v->getPaintSize().width()); | |
96 m_magCache.setZoomLevel(v->getZoomLevel()); | |
97 | |
95 cerr << "cache start " << m_cache.getStartFrame() | 98 cerr << "cache start " << m_cache.getStartFrame() |
96 << " valid left " << m_cache.getValidLeft() | 99 << " valid left " << m_cache.getValidLeft() |
97 << " valid right " << m_cache.getValidRight() | 100 << " valid right " << m_cache.getValidRight() |
98 << endl; | 101 << endl; |
99 cerr << " view start " << startFrame | 102 cerr << " view start " << startFrame |
110 | 113 |
111 cerr << "cache hit" << endl; | 114 cerr << "cache hit" << endl; |
112 | 115 |
113 // cache is valid for the complete requested area | 116 // cache is valid for the complete requested area |
114 paint.drawImage(rect, m_cache.getImage(), rect); | 117 paint.drawImage(rect, m_cache.getImage(), rect); |
115 return { rect, {} }; | 118 |
119 //!!! a dev debug check | |
120 if (!m_magCache.areColumnsSet(x0, x1 - x0)) { | |
121 cerr << "Columns (" << x0 << " -> " << x1-x0 | |
122 << ") not set in mag cache" << endl; | |
123 throw std::logic_error("Columns not set in mag cache"); | |
124 } | |
125 | |
126 MagnitudeRange range = m_magCache.getRange(x0, x1-x0); | |
127 | |
128 return { rect, range }; | |
116 | 129 |
117 } else { | 130 } else { |
118 cerr << "cache partial hit" << endl; | 131 cerr << "cache partial hit" << endl; |
119 | 132 |
120 // cache doesn't begin at the right frame or doesn't | 133 // cache doesn't begin at the right frame or doesn't |
121 // contain the complete view, but might be scrollable or | 134 // contain the complete view, but might be scrollable or |
122 // partially usable | 135 // partially usable |
123 m_cache.scrollTo(v, startFrame); | 136 m_cache.scrollTo(v, startFrame); |
137 m_magCache.scrollTo(v, startFrame); | |
124 | 138 |
125 // if we are not time-constrained, then we want to paint | 139 // if we are not time-constrained, then we want to paint |
126 // the whole area in one go; we don't return a partial | 140 // the whole area in one go; we don't return a partial |
127 // paint. To avoid providing the more complex logic to | 141 // paint. To avoid providing the more complex logic to |
128 // handle painting discontiguous areas, if the only valid | 142 // handle painting discontiguous areas, if the only valid |
136 } | 150 } |
137 } | 151 } |
138 } else { | 152 } else { |
139 // cache is completely invalid | 153 // cache is completely invalid |
140 m_cache.setStartFrame(startFrame); | 154 m_cache.setStartFrame(startFrame); |
155 m_magCache.setStartFrame(startFrame); | |
141 } | 156 } |
142 | 157 |
143 bool rightToLeft = false; | 158 bool rightToLeft = false; |
144 | 159 |
145 if (!m_cache.isValid() && timeConstrained) { | 160 if (!m_cache.isValid() && timeConstrained) { |