diff layer/Colour3DPlotRenderer.cpp @ 1161:436df5f24bda 3.0-integration

Fix forehead-slapping failure to use the right model when rendering 3d plot in peaks cache mode (i.e. when zoomed quite far out)
author Chris Cannam
date Fri, 04 Nov 2016 16:32:41 +0000
parents c53ed1a6fcbd
children 081c7ebf1fea
line wrap: on
line diff
--- a/layer/Colour3DPlotRenderer.cpp	Thu Nov 03 14:57:00 2016 +0000
+++ b/layer/Colour3DPlotRenderer.cpp	Fri Nov 04 16:32:41 2016 +0000
@@ -286,7 +286,8 @@
 }
 
 ColumnOp::Column
-Colour3DPlotRenderer::getColumn(int sx, int minbin, int nbins) const
+Colour3DPlotRenderer::getColumn(int sx, int minbin, int nbins,
+                                bool usePeaksCache) const
 {
     // order:
     // get column -> scale -> normalise -> record extents ->
@@ -307,7 +308,9 @@
 
     } else {
                     
-        ColumnOp::Column fullColumn = m_sources.source->getColumn(sx);
+        ColumnOp::Column fullColumn =
+            (usePeaksCache ? m_sources.peaks : m_sources.source)->
+            getColumn(sx);
                 
         column = vector<float>(fullColumn.data() + minbin,
                                fullColumn.data() + minbin + nbins);
@@ -384,7 +387,7 @@
             // peak pick -> distribute/interpolate -> apply display gain
 
             // this does the first three:
-            preparedColumn = getColumn(sx, minbin, nbins);
+            preparedColumn = getColumn(sx, minbin, nbins, false);
             
             magRange.sample(preparedColumn);
 
@@ -784,10 +787,6 @@
         // source column index
         
         ++columnCount;
-
-#ifdef DEBUG_COLOUR_PLOT_REPAINT
-        cerr << "x = " << x << ", binforx[x] = " << binforx[x] << endl;
-#endif
         
         if (binforx[x] < 0) continue;
 
@@ -798,15 +797,15 @@
         if (sx0 < 0) continue;
         if (sx1 <= sx0) sx1 = sx0 + 1;
 
+#ifdef DEBUG_COLOUR_PLOT_REPAINT
+        cerr << "x = " << x << ", binforx[x] = " << binforx[x] << ", sx range " << sx0 << " -> " << sx1 << endl;
+#endif
+
         vector<float> pixelPeakColumn;
         MagnitudeRange magRange;
         
         for (int sx = sx0; sx < sx1; ++sx) {
 
-#ifdef DEBUG_COLOUR_PLOT_REPAINT
-            cerr << "sx = " << sx << endl;
-#endif
-
             if (sx < 0 || sx >= modelWidth) {
                 continue;
             }
@@ -818,7 +817,8 @@
                 // peak pick -> distribute/interpolate -> apply display gain
 
                 // this does the first three:
-                ColumnOp::Column column = getColumn(sx, minbin, nbins);
+                ColumnOp::Column column = getColumn(sx, minbin, nbins,
+                                                    usePeaksCache);
 
                 magRange.sample(column);
                 
@@ -960,7 +960,7 @@
             }
 
             if (sx != psx) {
-                preparedColumn = getColumn(sx, minbin, nbins);
+                preparedColumn = getColumn(sx, minbin, nbins, false);
                 magRange.sample(preparedColumn);
                 psx = sx;
             }