Mercurial > hg > svgui
comparison layer/Colour3DPlotRenderer.cpp @ 1499:e4c9d38d304d
Debug concerns
| author | Chris Cannam |
|---|---|
| date | Tue, 10 Sep 2019 16:35:28 +0100 |
| parents | 78d9282519b0 |
| children | ac5a82e57d23 |
comparison
equal
deleted
inserted
replaced
| 1498:76b388d4d19c | 1499:e4c9d38d304d |
|---|---|
| 107 timeConstrained = false; | 107 timeConstrained = false; |
| 108 | 108 |
| 109 } else if (m_secondsPerXPixelValid) { | 109 } else if (m_secondsPerXPixelValid) { |
| 110 double predicted = m_secondsPerXPixel * rect.width(); | 110 double predicted = m_secondsPerXPixel * rect.width(); |
| 111 #ifdef DEBUG_COLOUR_PLOT_REPAINT | 111 #ifdef DEBUG_COLOUR_PLOT_REPAINT |
| 112 SVDEBUG << "Predicted time for width " << rect.width() << " = " | 112 SVDEBUG << "render " << m_sources.source |
| 113 << ": Predicted time for width " << rect.width() << " = " | |
| 113 << predicted << " (" << m_secondsPerXPixel << " x " | 114 << predicted << " (" << m_secondsPerXPixel << " x " |
| 114 << rect.width() << ")" << endl; | 115 << rect.width() << ")" << endl; |
| 115 #endif | 116 #endif |
| 116 if (predicted < 0.175) { | 117 if (predicted < 0.175) { |
| 117 #ifdef DEBUG_COLOUR_PLOT_REPAINT | 118 #ifdef DEBUG_COLOUR_PLOT_REPAINT |
| 118 SVDEBUG << "Predicted time looks fast enough: no partial renders" | 119 SVDEBUG << "render " << m_sources.source |
| 120 << ": Predicted time looks fast enough: no partial renders" | |
| 119 << endl; | 121 << endl; |
| 120 #endif | 122 #endif |
| 121 timeConstrained = false; | 123 timeConstrained = false; |
| 122 } | 124 } |
| 123 } | 125 } |
| 144 MagnitudeRange range = renderDirectTranslucent(v, paint, rect); | 146 MagnitudeRange range = renderDirectTranslucent(v, paint, rect); |
| 145 return { rect, range }; | 147 return { rect, range }; |
| 146 } | 148 } |
| 147 | 149 |
| 148 #ifdef DEBUG_COLOUR_PLOT_REPAINT | 150 #ifdef DEBUG_COLOUR_PLOT_REPAINT |
| 149 SVDEBUG << "cache start " << m_cache.getStartFrame() | 151 SVDEBUG << "render " << m_sources.source |
| 150 << " valid left " << m_cache.getValidLeft() | 152 << ": cache start " << m_cache.getStartFrame() |
| 151 << " valid right " << m_cache.getValidRight() | 153 << " valid left " << m_cache.getValidLeft() |
| 152 << endl; | 154 << " valid right " << m_cache.getValidRight() |
| 155 << endl; | |
| 153 SVDEBUG << " view start " << startFrame | 156 SVDEBUG << " view start " << startFrame |
| 154 << " x0 " << x0 | 157 << " x0 " << x0 |
| 155 << " x1 " << x1 | 158 << " x1 " << x1 |
| 156 << endl; | 159 << endl; |
| 157 #endif | 160 #endif |
| 158 | 161 |
| 159 static HitCount count("Colour3DPlotRenderer: image cache"); | 162 static HitCount count("Colour3DPlotRenderer: image cache"); |
| 160 | 163 |
| 161 if (m_cache.isValid()) { // some part of the cache is valid | 164 if (m_cache.isValid()) { // some part of the cache is valid |
| 295 renderToCacheBinResolution(v, x0, x1 - x0); | 298 renderToCacheBinResolution(v, x0, x1 - x0); |
| 296 | 299 |
| 297 } else { // must be DrawBufferPixelResolution, handled DirectTranslucent earlier | 300 } else { // must be DrawBufferPixelResolution, handled DirectTranslucent earlier |
| 298 | 301 |
| 299 if (timeConstrained && justInvalidated) { | 302 if (timeConstrained && justInvalidated) { |
| 300 SVDEBUG << "render: just invalidated cache in time-constrained context, that's all we're doing for now - wait for next update to start filling" << endl; | 303 SVDEBUG << "render " << m_sources.source << ": just invalidated cache in time-constrained context, that's all we're doing for now - wait for next update to start filling" << endl; |
| 301 } else { | 304 } else { |
| 302 renderToCachePixelResolution(v, x0, x1 - x0, rightToLeft, timeConstrained); | 305 renderToCachePixelResolution(v, x0, x1 - x0, rightToLeft, timeConstrained); |
| 303 } | 306 } |
| 304 } | 307 } |
| 305 | 308 |
| 324 } | 327 } |
| 325 | 328 |
| 326 MagnitudeRange range = m_magCache.getRange(reqx0, reqx1 - reqx0); | 329 MagnitudeRange range = m_magCache.getRange(reqx0, reqx1 - reqx0); |
| 327 | 330 |
| 328 #ifdef DEBUG_COLOUR_PLOT_REPAINT | 331 #ifdef DEBUG_COLOUR_PLOT_REPAINT |
| 329 SVDEBUG << "render: returning rect rendered as " << pr.x() << "," << pr.y() | 332 SVDEBUG << "render " << m_sources.source |
| 333 << ": returning rect rendered as " << pr.x() << "," << pr.y() | |
| 330 << " " << pr.width() << "x" << pr.height() << endl; | 334 << " " << pr.width() << "x" << pr.height() << endl; |
| 331 SVDEBUG << "render: mag range from cache in x-range " << reqx0 | 335 SVDEBUG << "render " << m_sources.source |
| 336 << ": mag range from cache in x-range " << reqx0 | |
| 332 << " to " << reqx1 << " is " << range.getMin() << " -> " | 337 << " to " << reqx1 << " is " << range.getMin() << " -> " |
| 333 << range.getMax() << endl; | 338 << range.getMax() << endl; |
| 334 #endif | 339 #endif |
| 335 | 340 |
| 336 return { pr, range }; | 341 return { pr, range }; |
| 650 } | 655 } |
| 651 } | 656 } |
| 652 } | 657 } |
| 653 | 658 |
| 654 #ifdef DEBUG_COLOUR_PLOT_REPAINT | 659 #ifdef DEBUG_COLOUR_PLOT_REPAINT |
| 655 SVDEBUG << "getPreferredPeakCache: zoomLevel = " << zoomLevel | 660 SVDEBUG << "render " << m_sources.source |
| 661 << ": getPreferredPeakCache: zoomLevel = " << zoomLevel | |
| 656 << ", binResolution " << binResolution | 662 << ", binResolution " << binResolution |
| 657 << ", peakCaches " << m_sources.peakCaches.size() | 663 << ", peakCaches " << m_sources.peakCaches.size() |
| 658 << ": preferring peakCacheIndex " << peakCacheIndex | 664 << ": preferring peakCacheIndex " << peakCacheIndex |
| 659 << " for binsPerPeak " << binsPerPeak | 665 << " for binsPerPeak " << binsPerPeak |
| 660 << endl; | 666 << endl; |
| 667 bool rightToLeft, | 673 bool rightToLeft, |
| 668 bool timeConstrained) | 674 bool timeConstrained) |
| 669 { | 675 { |
| 670 Profiler profiler("Colour3DPlotRenderer::renderToCachePixelResolution"); | 676 Profiler profiler("Colour3DPlotRenderer::renderToCachePixelResolution"); |
| 671 #ifdef DEBUG_COLOUR_PLOT_REPAINT | 677 #ifdef DEBUG_COLOUR_PLOT_REPAINT |
| 672 SVDEBUG << "renderToCachePixelResolution" << endl; | 678 SVDEBUG << "render " << m_sources.source |
| 679 << ": renderToCachePixelResolution" << endl; | |
| 673 #endif | 680 #endif |
| 674 | 681 |
| 675 // Draw to the draw buffer, and then copy from there. The draw | 682 // Draw to the draw buffer, and then copy from there. The draw |
| 676 // buffer is at the same resolution as the target in the cache, so | 683 // buffer is at the same resolution as the target in the cache, so |
| 677 // no extra scaling needed. | 684 // no extra scaling needed. |
| 806 Colour3DPlotRenderer::renderToCacheBinResolution(const LayerGeometryProvider *v, | 813 Colour3DPlotRenderer::renderToCacheBinResolution(const LayerGeometryProvider *v, |
| 807 int x0, int repaintWidth) | 814 int x0, int repaintWidth) |
| 808 { | 815 { |
| 809 Profiler profiler("Colour3DPlotRenderer::renderToCacheBinResolution"); | 816 Profiler profiler("Colour3DPlotRenderer::renderToCacheBinResolution"); |
| 810 #ifdef DEBUG_COLOUR_PLOT_REPAINT | 817 #ifdef DEBUG_COLOUR_PLOT_REPAINT |
| 811 SVDEBUG << "renderToCacheBinResolution" << endl; | 818 SVDEBUG << "render " << m_sources.source |
| 819 << ": renderToCacheBinResolution" << endl; | |
| 812 #endif | 820 #endif |
| 813 | 821 |
| 814 // Draw to the draw buffer, and then scale-copy from there. Draw | 822 // Draw to the draw buffer, and then scale-copy from there. Draw |
| 815 // buffer is at bin resolution, i.e. buffer x == source column | 823 // buffer is at bin resolution, i.e. buffer x == source column |
| 816 // number. We use toolkit smooth scaling for interpolation. | 824 // number. We use toolkit smooth scaling for interpolation. |
| 1339 m_secondsPerXPixelValid = true; | 1347 m_secondsPerXPixelValid = true; |
| 1340 | 1348 |
| 1341 #ifdef DEBUG_COLOUR_PLOT_REPAINT | 1349 #ifdef DEBUG_COLOUR_PLOT_REPAINT |
| 1342 SVDEBUG << "across " << xPixelCount << " x-pixels, seconds per x-pixel = " | 1350 SVDEBUG << "across " << xPixelCount << " x-pixels, seconds per x-pixel = " |
| 1343 << m_secondsPerXPixel << " (total = " | 1351 << m_secondsPerXPixel << " (total = " |
| 1344 << (xPixelCount * m_secondsPerXPixel) << endl; | 1352 << (xPixelCount * m_secondsPerXPixel) << ")" << endl; |
| 1345 #endif | 1353 #endif |
| 1346 } | 1354 } |
| 1347 } | 1355 } |
| 1348 | 1356 |
| 1349 void | 1357 void |
