# HG changeset patch # User Chris Cannam # Date 1478277161 0 # Node ID 436df5f24bdacebfa7088f4d5a5eb9a24f26eadf # Parent a429b2acb45df713bc6ad98159f20e3b9504bd00 Fix forehead-slapping failure to use the right model when rendering 3d plot in peaks cache mode (i.e. when zoomed quite far out) diff -r a429b2acb45d -r 436df5f24bda layer/Colour3DPlotRenderer.cpp --- 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(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 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; } diff -r a429b2acb45d -r 436df5f24bda layer/Colour3DPlotRenderer.h --- a/layer/Colour3DPlotRenderer.h Thu Nov 03 14:57:00 2016 +0000 +++ b/layer/Colour3DPlotRenderer.h Fri Nov 04 16:32:41 2016 +0000 @@ -302,7 +302,8 @@ RenderType decideRenderType(const LayerGeometryProvider *) const; - ColumnOp::Column getColumn(int sx, int minbin, int nbins) const; + ColumnOp::Column getColumn(int sx, int minbin, int nbins, + bool usePeaksCache) const; }; #endif