comparison layer/Colour3DPlotRenderer.h @ 1079:7ebfb61b1701 spectrogram-minor-refactor

More filling in render & cache code
author Chris Cannam
date Thu, 30 Jun 2016 15:46:14 +0100
parents e536dfc6b250
children 2e5945b87aca
comparison
equal deleted inserted replaced
1078:ee01a4062747 1079:7ebfb61b1701
74 bool invertVertical; 74 bool invertVertical;
75 }; 75 };
76 76
77 Colour3DPlotRenderer(Sources sources, Parameters parameters) : 77 Colour3DPlotRenderer(Sources sources, Parameters parameters) :
78 m_sources(sources), 78 m_sources(sources),
79 m_params(parameters), 79 m_params(parameters)
80 m_bufferResolution(PixelResolution)
81 { } 80 { }
82 81
83 struct RenderResult { 82 struct RenderResult {
84 /** 83 /**
85 * The rect that was actually rendered. May be equal to the 84 * The rect that was actually rendered. May be equal to the
141 // at view height (not model height) and is cleared and repainted 140 // at view height (not model height) and is cleared and repainted
142 // on each fragment render. The only reason it's stored as a data 141 // on each fragment render. The only reason it's stored as a data
143 // member is to avoid reallocation. 142 // member is to avoid reallocation.
144 QImage m_drawBuffer; 143 QImage m_drawBuffer;
145 144
146 // Indicates whether the draw buffer is rendered at bin resolution
147 // or at pixel resolution. Pixel resolution is used when the zoom
148 // level is such that each pixel is backed by more than one bin;
149 // bin resolution is used when the zoom level is such that each
150 // bin is drawn to more than one pixel.
151 enum BufferResolution {
152 BinResolution,
153 PixelResolution
154 };
155 BufferResolution m_bufferResolution;
156
157 // Image cache is our persistent record of the visible area. It is 145 // Image cache is our persistent record of the visible area. It is
158 // always the same size as the view (i.e. the paint size reported 146 // always the same size as the view (i.e. the paint size reported
159 // by the LayerGeometryProvider) and is scrolled and partially 147 // by the LayerGeometryProvider) and is scrolled and partially
160 // repainted internally as appropriate. A render request is 148 // repainted internally as appropriate. A render request is
161 // carried out by repainting to cache (via the draw buffer) any 149 // carried out by repainting to cache (via the draw buffer) any
162 // area that is being requested but is not valid in the cache, and 150 // area that is being requested but is not valid in the cache, and
163 // then repainting from cache to the requested painter. 151 // then repainting from cache to the requested painter.
164 ScrollableImageCache m_cache; 152 ScrollableImageCache m_cache;
165 153
166 RenderResult render(QPainter &paint, QRect rect, bool timeConstrained); 154 RenderResult render(QPainter &paint, QRect rect, bool timeConstrained);
167 155 QRect renderToCache(int x0, int repaintWidth, bool timeConstrained);
168 //!!! fft model scaling? 156 void clearDrawBuffer(int w, int h);
169
170 //!!! should we own the Dense3DModelPeakCache here? or should it persist
171 }; 157 };
172 158
173 #endif 159 #endif
174 160