comparison layer/Colour3DPlotRenderer.cpp @ 1117:64709d4d09ef spectrogram-minor-refactor

Fix translucent mode for spectrogram
author Chris Cannam
date Tue, 19 Jul 2016 17:28:03 +0100
parents e7a07cd63d21
children 175d4e15884d
comparison
equal deleted inserted replaced
1116:e7a07cd63d21 1117:64709d4d09ef
13 COPYING included with this distribution for more information. 13 COPYING included with this distribution for more information.
14 */ 14 */
15 15
16 #include "Colour3DPlotRenderer.h" 16 #include "Colour3DPlotRenderer.h"
17 #include "RenderTimer.h" 17 #include "RenderTimer.h"
18
19 #include "base/Profiler.h"
18 20
19 #include "data/model/DenseThreeDimensionalModel.h" 21 #include "data/model/DenseThreeDimensionalModel.h"
20 #include "data/model/Dense3DModelPeakCache.h" 22 #include "data/model/Dense3DModelPeakCache.h"
21 #include "data/model/FFTModel.h" 23 #include "data/model/FFTModel.h"
22 24
245 if (!m_params.alwaysOpaque && !m_params.interpolate) { 247 if (!m_params.alwaysOpaque && !m_params.interpolate) {
246 248
247 // consider translucent option -- only if not smoothing & not 249 // consider translucent option -- only if not smoothing & not
248 // explicitly requested opaque & sufficiently zoomed-in 250 // explicitly requested opaque & sufficiently zoomed-in
249 251
250 if (model->getHeight() < v->getPaintHeight() && 252 if (model->getHeight() * 3 < v->getPaintHeight() &&
251 relativeBinResolution >= 2 * zoomLevel) { 253 relativeBinResolution >= 3 * zoomLevel) {
252 return DirectTranslucent; 254 return DirectTranslucent;
253 } 255 }
254 } 256 }
255 257
256 if (relativeBinResolution > zoomLevel) { 258 if (relativeBinResolution > zoomLevel) {
263 void 265 void
264 Colour3DPlotRenderer::renderDirectTranslucent(const LayerGeometryProvider *v, 266 Colour3DPlotRenderer::renderDirectTranslucent(const LayerGeometryProvider *v,
265 QPainter &paint, 267 QPainter &paint,
266 QRect rect) 268 QRect rect)
267 { 269 {
270 Profiler profiler("Colour3DPlotRenderer::renderDirectTranslucent");
271
268 QPoint illuminatePos; 272 QPoint illuminatePos;
269 bool illuminate = v->shouldIlluminateLocalFeatures 273 bool illuminate = v->shouldIlluminateLocalFeatures
270 (m_sources.verticalBinLayer, illuminatePos); 274 (m_sources.verticalBinLayer, illuminatePos);
271 275
272 const DenseThreeDimensionalModel *model = m_sources.source; 276 const DenseThreeDimensionalModel *model = m_sources.source;
428 Colour3DPlotRenderer::renderToCachePixelResolution(const LayerGeometryProvider *v, 432 Colour3DPlotRenderer::renderToCachePixelResolution(const LayerGeometryProvider *v,
429 int x0, int repaintWidth, 433 int x0, int repaintWidth,
430 bool rightToLeft, 434 bool rightToLeft,
431 bool timeConstrained) 435 bool timeConstrained)
432 { 436 {
437 Profiler profiler("Colour3DPlotRenderer::renderToCachePixelResolution");
433 cerr << "renderToCachePixelResolution" << endl; 438 cerr << "renderToCachePixelResolution" << endl;
434 439
435 // Draw to the draw buffer, and then copy from there. The draw 440 // Draw to the draw buffer, and then copy from there. The draw
436 // buffer is at the same resolution as the target in the cache, so 441 // buffer is at the same resolution as the target in the cache, so
437 // no extra scaling needed. 442 // no extra scaling needed.
518 523
519 void 524 void
520 Colour3DPlotRenderer::renderToCacheBinResolution(const LayerGeometryProvider *v, 525 Colour3DPlotRenderer::renderToCacheBinResolution(const LayerGeometryProvider *v,
521 int x0, int repaintWidth) 526 int x0, int repaintWidth)
522 { 527 {
528 Profiler profiler("Colour3DPlotRenderer::renderToCacheBinResolution");
523 cerr << "renderToCacheBinResolution" << endl; 529 cerr << "renderToCacheBinResolution" << endl;
524 530
525 // Draw to the draw buffer, and then scale-copy from there. Draw 531 // Draw to the draw buffer, and then scale-copy from there. Draw
526 // buffer is at bin resolution, i.e. buffer x == source column 532 // buffer is at bin resolution, i.e. buffer x == source column
527 // number. We use toolkit smooth scaling for interpolation. 533 // number. We use toolkit smooth scaling for interpolation.