comparison layer/Colour3DPlotRenderer.h @ 1221:eaab8bab3522

Measure time taken to render per pixel, and use the time last time around to decide whether to be time constrained this time around
author Chris Cannam
date Thu, 26 Jan 2017 11:55:11 +0000
parents 34df6ff25472
children fc40742bb911
comparison
equal deleted inserted replaced
1220:2954e9952b78 1221:eaab8bab3522
30 class LayerGeometryProvider; 30 class LayerGeometryProvider;
31 class VerticalBinLayer; 31 class VerticalBinLayer;
32 class DenseThreeDimensionalModel; 32 class DenseThreeDimensionalModel;
33 class Dense3DModelPeakCache; 33 class Dense3DModelPeakCache;
34 class FFTModel; 34 class FFTModel;
35 class RenderTimer;
35 36
36 enum class BinDisplay { 37 enum class BinDisplay {
37 AllBins, 38 AllBins,
38 PeakBins, 39 PeakBins,
39 PeakFrequencies 40 PeakFrequencies
109 int colourRotation; 110 int colourRotation;
110 }; 111 };
111 112
112 Colour3DPlotRenderer(Sources sources, Parameters parameters) : 113 Colour3DPlotRenderer(Sources sources, Parameters parameters) :
113 m_sources(sources), 114 m_sources(sources),
114 m_params(parameters) 115 m_params(parameters),
116 m_secondsPerXPixel(0.0),
117 m_secondsPerXPixelValid(false)
115 { } 118 { }
116 119
117 struct RenderResult { 120 struct RenderResult {
118 /** 121 /**
119 * The rect that was actually rendered. May be equal to the 122 * The rect that was actually rendered. May be equal to the
261 // indices match up across both. Our cache update mechanism 264 // indices match up across both. Our cache update mechanism
262 // guarantees that every valid column in the image cache has a 265 // guarantees that every valid column in the image cache has a
263 // valid range in the magnitude cache, but not necessarily vice 266 // valid range in the magnitude cache, but not necessarily vice
264 // versa (as the image cache is limited to contiguous ranges). 267 // versa (as the image cache is limited to contiguous ranges).
265 ScrollableMagRangeCache m_magCache; 268 ScrollableMagRangeCache m_magCache;
269
270 double m_secondsPerXPixel;
271 bool m_secondsPerXPixelValid;
266 272
267 RenderResult render(const LayerGeometryProvider *v, 273 RenderResult render(const LayerGeometryProvider *v,
268 QPainter &paint, QRect rect, bool timeConstrained); 274 QPainter &paint, QRect rect, bool timeConstrained);
269 275
270 MagnitudeRange renderDirectTranslucent(const LayerGeometryProvider *v, 276 MagnitudeRange renderDirectTranslucent(const LayerGeometryProvider *v,
308 ColumnOp::Column getColumn(int sx, int minbin, int nbins, 314 ColumnOp::Column getColumn(int sx, int minbin, int nbins,
309 int peakCacheIndex) const; // -1 => don't use cache 315 int peakCacheIndex) const; // -1 => don't use cache
310 316
311 void getPreferredPeakCache(const LayerGeometryProvider *, 317 void getPreferredPeakCache(const LayerGeometryProvider *,
312 int &peakCacheIndex, int &binsPerPeak) const; 318 int &peakCacheIndex, int &binsPerPeak) const;
319
320 void updateTimings(const RenderTimer &timer, int xPixelCount);
313 }; 321 };
314 322
315 #endif 323 #endif
316 324