Mercurial > hg > svgui
comparison layer/Colour3DPlotRenderer.cpp @ 1100:102f986ec032 spectrogram-minor-refactor
Create, but don't yet use, a renderer in the colour 3d plot layer
author | Chris Cannam |
---|---|
date | Wed, 13 Jul 2016 13:06:28 +0100 |
parents | 5c6271734790 |
children | d84a0033b305 |
comparison
equal
deleted
inserted
replaced
1099:5c6271734790 | 1100:102f986ec032 |
---|---|
213 } | 213 } |
214 | 214 |
215 bool | 215 bool |
216 Colour3DPlotRenderer::useBinResolutionForDrawBuffer(LayerGeometryProvider *v) const | 216 Colour3DPlotRenderer::useBinResolutionForDrawBuffer(LayerGeometryProvider *v) const |
217 { | 217 { |
218 DenseThreeDimensionalModel *model = m_sources.source; | 218 const DenseThreeDimensionalModel *model = m_sources.source; |
219 if (!model) return false; | 219 if (!model) return false; |
220 int binResolution = model->getResolution(); | 220 int binResolution = model->getResolution(); |
221 int zoomLevel = v->getZoomLevel(); | 221 int zoomLevel = v->getZoomLevel(); |
222 return (binResolution > zoomLevel); | 222 return (binResolution > zoomLevel); |
223 } | 223 } |
232 | 232 |
233 // Draw to the draw buffer, and then copy from there. The draw | 233 // Draw to the draw buffer, and then copy from there. The draw |
234 // buffer is at the same resolution as the target in the cache, so | 234 // buffer is at the same resolution as the target in the cache, so |
235 // no extra scaling needed. | 235 // no extra scaling needed. |
236 | 236 |
237 DenseThreeDimensionalModel *model = m_sources.source; | 237 const DenseThreeDimensionalModel *model = m_sources.source; |
238 if (!model || !model->isOK() || !model->isReady()) { | 238 if (!model || !model->isOK() || !model->isReady()) { |
239 throw std::logic_error("no source model provided, or model not ready"); | 239 throw std::logic_error("no source model provided, or model not ready"); |
240 } | 240 } |
241 | 241 |
242 int h = v->getPaintHeight(); | 242 int h = v->getPaintHeight(); |
322 | 322 |
323 // Draw to the draw buffer, and then scale-copy from there. Draw | 323 // Draw to the draw buffer, and then scale-copy from there. Draw |
324 // buffer is at bin resolution, i.e. buffer x == source column | 324 // buffer is at bin resolution, i.e. buffer x == source column |
325 // number. We use toolkit smooth scaling for interpolation. | 325 // number. We use toolkit smooth scaling for interpolation. |
326 | 326 |
327 DenseThreeDimensionalModel *model = m_sources.source; | 327 const DenseThreeDimensionalModel *model = m_sources.source; |
328 if (!model || !model->isOK() || !model->isReady()) { | 328 if (!model || !model->isOK() || !model->isReady()) { |
329 throw std::logic_error("no source model provided, or model not ready"); | 329 throw std::logic_error("no source model provided, or model not ready"); |
330 } | 330 } |
331 | 331 |
332 // The draw buffer will contain a fragment at bin resolution. We | 332 // The draw buffer will contain a fragment at bin resolution. We |
463 int maxbin = int(binfory[h-1]); | 463 int maxbin = int(binfory[h-1]); |
464 if (minbin < 0) minbin = 0; | 464 if (minbin < 0) minbin = 0; |
465 if (maxbin < 0) maxbin = minbin+1; | 465 if (maxbin < 0) maxbin = minbin+1; |
466 | 466 |
467 int divisor = 1; | 467 int divisor = 1; |
468 DenseThreeDimensionalModel *sourceModel = m_sources.source; | 468 const DenseThreeDimensionalModel *sourceModel = m_sources.source; |
469 if (usePeaksCache) { | 469 if (usePeaksCache) { |
470 divisor = m_sources.peaks->getColumnsPerPeak(); | 470 divisor = m_sources.peaks->getColumnsPerPeak(); |
471 sourceModel = m_sources.peaks; | 471 sourceModel = m_sources.peaks; |
472 } | 472 } |
473 | 473 |
608 int minbin = int(binfory[0] + 0.0001); | 608 int minbin = int(binfory[0] + 0.0001); |
609 int maxbin = int(binfory[h-1]); | 609 int maxbin = int(binfory[h-1]); |
610 if (minbin < 0) minbin = 0; | 610 if (minbin < 0) minbin = 0; |
611 if (maxbin < 0) maxbin = minbin+1; | 611 if (maxbin < 0) maxbin = minbin+1; |
612 | 612 |
613 FFTModel *fft = m_sources.fft; | 613 const FFTModel *fft = m_sources.fft; |
614 | 614 |
615 FFTModel::PeakSet peakfreqs; | 615 FFTModel::PeakSet peakfreqs; |
616 | 616 |
617 int psx = -1; | 617 int psx = -1; |
618 | 618 |