Mercurial > hg > svgui
comparison layer/Colour3DPlotLayer.cpp @ 1101:1364cbf4453d spectrogram-minor-refactor
Begin using renderer in colour 3d plot layer
author | Chris Cannam |
---|---|
date | Wed, 13 Jul 2016 13:30:39 +0100 |
parents | 102f986ec032 |
children | 36a981a0fa31 |
comparison
equal
deleted
inserted
replaced
1100:102f986ec032 | 1101:1364cbf4453d |
---|---|
62 m_opaque(false), | 62 m_opaque(false), |
63 m_smooth(false), | 63 m_smooth(false), |
64 m_peakResolution(256), | 64 m_peakResolution(256), |
65 m_miny(0), | 65 m_miny(0), |
66 m_maxy(0), | 66 m_maxy(0), |
67 m_synchronous(false), | |
67 m_peakCache(0), | 68 m_peakCache(0), |
68 m_peakCacheDivisor(8) | 69 m_peakCacheDivisor(8) |
69 { | 70 { |
70 QSettings settings; | 71 QSettings settings; |
71 settings.beginGroup("Preferences"); | 72 settings.beginGroup("Preferences"); |
76 Colour3DPlotLayer::~Colour3DPlotLayer() | 77 Colour3DPlotLayer::~Colour3DPlotLayer() |
77 { | 78 { |
78 delete m_cache; | 79 delete m_cache; |
79 delete m_peaksCache; //!!! this one is to go... | 80 delete m_peaksCache; //!!! this one is to go... |
80 delete m_peakCache; | 81 delete m_peakCache; |
82 } | |
83 | |
84 void | |
85 Colour3DPlotLayer::setSynchronousPainting(bool synchronous) | |
86 { | |
87 m_synchronous = synchronous; | |
81 } | 88 } |
82 | 89 |
83 void | 90 void |
84 Colour3DPlotLayer::setModel(const DenseThreeDimensionalModel *model) | 91 Colour3DPlotLayer::setModel(const DenseThreeDimensionalModel *model) |
85 { | 92 { |
1316 | 1323 |
1317 return m_renderers[v->getId()]; | 1324 return m_renderers[v->getId()]; |
1318 } | 1325 } |
1319 | 1326 |
1320 void | 1327 void |
1328 Colour3DPlotLayer::paintAlternative(LayerGeometryProvider *v, QPainter &paint, QRect rect) const | |
1329 { | |
1330 static int depth = 0; | |
1331 | |
1332 Colour3DPlotRenderer *renderer = getRenderer(v); | |
1333 | |
1334 if (m_synchronous) { | |
1335 (void)renderer->render(v, paint, rect); | |
1336 return; | |
1337 } | |
1338 | |
1339 ++depth; | |
1340 cerr << "paint depth " << depth << endl; | |
1341 | |
1342 (void)renderer->renderTimeConstrained(v, paint, rect); | |
1343 | |
1344 //!!! + mag range | |
1345 | |
1346 QRect uncached = renderer->getLargestUncachedRect(); | |
1347 if (uncached.width() > 0) { | |
1348 cerr << "updating rect at " << uncached.x() << " width " | |
1349 << uncached.width() << endl; | |
1350 v->updatePaintRect(uncached); | |
1351 } | |
1352 | |
1353 cerr << "exiting paint depth " << depth << endl; | |
1354 --depth; | |
1355 } | |
1356 | |
1357 void | |
1321 Colour3DPlotLayer::paint(LayerGeometryProvider *v, QPainter &paint, QRect rect) const | 1358 Colour3DPlotLayer::paint(LayerGeometryProvider *v, QPainter &paint, QRect rect) const |
1322 { | 1359 { |
1323 /* | 1360 /* |
1324 if (m_model) { | 1361 if (m_model) { |
1325 SVDEBUG << "Colour3DPlotLayer::paint: model says shouldUseLogValueScale = " << m_model->shouldUseLogValueScale() << endl; | 1362 SVDEBUG << "Colour3DPlotLayer::paint: model says shouldUseLogValueScale = " << m_model->shouldUseLogValueScale() << endl; |
1344 cerr << "Colour3DPlotLayer::paint(): model width == 0, " | 1381 cerr << "Colour3DPlotLayer::paint(): model width == 0, " |
1345 << "nothing to paint (yet)" << endl; | 1382 << "nothing to paint (yet)" << endl; |
1346 #endif | 1383 #endif |
1347 return; | 1384 return; |
1348 } | 1385 } |
1386 | |
1387 //!!! why is the setLayerDormant(false) found here in | |
1388 //!!! SpectrogramLayer not present in Colour3DPlotLayer? | |
1389 //!!! unnecessary? vestigial? forgotten? | |
1390 | |
1391 paintAlternative(v, paint, rect); | |
1392 return; | |
1393 | |
1394 //!!!??? | |
1349 | 1395 |
1350 if (m_normalization == ColumnOp::NormalizeVisibleArea) { | 1396 if (m_normalization == ColumnOp::NormalizeVisibleArea) { |
1351 rect = v->getPaintRect(); | 1397 rect = v->getPaintRect(); |
1352 } | 1398 } |
1353 | 1399 |