comparison layer/Colour3DPlotRenderer.cpp @ 1122:94370157b265 spectrogram-minor-refactor

Fixes and debug output for mag range calculations
author Chris Cannam
date Fri, 22 Jul 2016 13:56:24 +0100
parents d930ff725f64
children 343887ac6766
comparison
equal deleted inserted replaced
1121:d930ff725f64 1122:94370157b265
64 64
65 if (areaRight.width() > areaLeft.width()) { 65 if (areaRight.width() > areaLeft.width()) {
66 return areaRight; 66 return areaRight;
67 } else { 67 } else {
68 return areaLeft; 68 return areaLeft;
69 }
70 }
71
72 bool
73 Colour3DPlotRenderer::geometryChanged(const LayerGeometryProvider *v)
74 {
75 RenderType renderType = decideRenderType(v);
76
77 if (renderType == DirectTranslucent) {
78 return true; // never cached
79 }
80
81 if (m_cache.getSize() == v->getPaintSize() &&
82 m_cache.getZoomLevel() == v->getZoomLevel() &&
83 m_cache.getStartFrame() == v->getStartFrame()) {
84 return false;
85 } else {
86 return true;
69 } 87 }
70 } 88 }
71 89
72 Colour3DPlotRenderer::RenderResult 90 Colour3DPlotRenderer::RenderResult
73 Colour3DPlotRenderer::render(const LayerGeometryProvider *v, 91 Colour3DPlotRenderer::render(const LayerGeometryProvider *v,
127 cerr << "NB Columns (" << x0 << " -> " << x1-x0 145 cerr << "NB Columns (" << x0 << " -> " << x1-x0
128 << ") not set in mag cache" << endl; 146 << ") not set in mag cache" << endl;
129 // throw std::logic_error("Columns not set in mag cache"); 147 // throw std::logic_error("Columns not set in mag cache");
130 } 148 }
131 149
132 MagnitudeRange range = m_magCache.getRange(x0, x1-x0); 150 MagnitudeRange range = m_magCache.getRange(x0, x1 - x0);
133 151
134 return { rect, range }; 152 return { rect, range };
135 153
136 } else { 154 } else {
137 cerr << "cache partial hit" << endl; 155 cerr << "cache partial hit" << endl;
161 m_magCache.setStartFrame(startFrame); 179 m_magCache.setStartFrame(startFrame);
162 } 180 }
163 181
164 bool rightToLeft = false; 182 bool rightToLeft = false;
165 183
184 int reqx0 = x0;
185 int reqx1 = x1;
186
166 if (!m_cache.isValid() && timeConstrained) { 187 if (!m_cache.isValid() && timeConstrained) {
167 // When rendering the whole area, in a context where we might 188 // When rendering the whole area, in a context where we might
168 // not be able to complete the work, start from somewhere near 189 // not be able to complete the work, start from somewhere near
169 // the middle so that the region of interest appears first 190 // the middle so that the region of interest appears first
170 191
221 //!!! when we are at start/end of model -- trap, report, and 242 //!!! when we are at start/end of model -- trap, report, and
222 //!!! then fix 243 //!!! then fix
223 throw std::logic_error("internal error: failed to render entire requested rect even when not time-constrained"); 244 throw std::logic_error("internal error: failed to render entire requested rect even when not time-constrained");
224 } 245 }
225 246
226 //!!! a dev debug check 247 MagnitudeRange range = m_magCache.getRange(reqx0, reqx1 - reqx0);
227 if (!m_magCache.areColumnsSet(x0, x1 - x0)) {
228 cerr << "NB Columns (" << x0 << " -> " << x1-x0
229 << ") not set in mag cache" << endl;
230 // throw std::logic_error("Columns not set in mag cache");
231 }
232
233 MagnitudeRange range = m_magCache.getRange(x0, x1-x0);
234 248
235 return { pr, range }; 249 return { pr, range };
236 250
237 //!!! todo: timing/incomplete paint 251 //!!! todo: timing/incomplete paint
238 252