comparison layer/Colour3DPlotRenderer.h @ 1113:261a00010918 spectrogram-minor-refactor

Consts and willRenderOpaque
author Chris Cannam
date Tue, 19 Jul 2016 14:49:46 +0100
parents d578b685d912
children be5b91ec81a0
comparison
equal deleted inserted replaced
1112:d578b685d912 1113:261a00010918
118 * std::logic_error exception. The model must be ready and the 118 * std::logic_error exception. The model must be ready and the
119 * layer requesting the render must not be dormant in its view, so 119 * layer requesting the render must not be dormant in its view, so
120 * that the LayerGeometryProvider returns valid results; it is the 120 * that the LayerGeometryProvider returns valid results; it is the
121 * caller's responsibility to ensure these. 121 * caller's responsibility to ensure these.
122 */ 122 */
123 RenderResult render(LayerGeometryProvider *v, QPainter &paint, QRect rect); 123 RenderResult render(const LayerGeometryProvider *v, QPainter &paint, QRect rect);
124 124
125 /** 125 /**
126 * Render the requested area using the given painter, obtaining 126 * Render the requested area using the given painter, obtaining
127 * geometry (e.g. start frame) from the stored 127 * geometry (e.g. start frame) from the stored
128 * LayerGeometryProvider. 128 * LayerGeometryProvider.
145 * std::logic_error exception. The model must be ready and the 145 * std::logic_error exception. The model must be ready and the
146 * layer requesting the render must not be dormant in its view, so 146 * layer requesting the render must not be dormant in its view, so
147 * that the LayerGeometryProvider returns valid results; it is the 147 * that the LayerGeometryProvider returns valid results; it is the
148 * caller's responsibility to ensure these. 148 * caller's responsibility to ensure these.
149 */ 149 */
150 RenderResult renderTimeConstrained(LayerGeometryProvider *v, 150 RenderResult renderTimeConstrained(const LayerGeometryProvider *v,
151 QPainter &paint, QRect rect); 151 QPainter &paint, QRect rect);
152 152
153 /** 153 /**
154 * Return the area of the largest rectangle within the entire area 154 * Return the area of the largest rectangle within the entire area
155 * of the cache that is unavailable in the cache. This is only 155 * of the cache that is unavailable in the cache. This is only
161 * cleared). 161 * cleared).
162 * 162 *
163 * Returns an empty QRect if the cache is entirely valid. 163 * Returns an empty QRect if the cache is entirely valid.
164 */ 164 */
165 QRect getLargestUncachedRect(); 165 QRect getLargestUncachedRect();
166
167 /**
168 * Return true if the rendering will be opaque. This may be used
169 * by the calling layer to determine whether it can scroll
170 * directly without regard to any other layers beneath.
171 */
172 bool willRenderOpaque(const LayerGeometryProvider *v) {
173 return decideRenderType(v) != DirectTranslucent;
174 }
166 175
167 private: 176 private:
168 Sources m_sources; 177 Sources m_sources;
169 Parameters m_params; 178 Parameters m_params;
170 179
181 // carried out by repainting to cache (via the draw buffer) any 190 // carried out by repainting to cache (via the draw buffer) any
182 // area that is being requested but is not valid in the cache, and 191 // area that is being requested but is not valid in the cache, and
183 // then repainting from cache to the requested painter. 192 // then repainting from cache to the requested painter.
184 ScrollableImageCache m_cache; 193 ScrollableImageCache m_cache;
185 194
186 RenderResult render(LayerGeometryProvider *v, 195 RenderResult render(const LayerGeometryProvider *v,
187 QPainter &paint, QRect rect, bool timeConstrained); 196 QPainter &paint, QRect rect, bool timeConstrained);
188 197
189 void renderDirectTranslucent(LayerGeometryProvider *v, 198 void renderDirectTranslucent(const LayerGeometryProvider *v,
190 QPainter &paint, QRect rect); 199 QPainter &paint, QRect rect);
191 200
192 void renderToCachePixelResolution(LayerGeometryProvider *v, int x0, 201 void renderToCachePixelResolution(const LayerGeometryProvider *v, int x0,
193 int repaintWidth, bool rightToLeft, 202 int repaintWidth, bool rightToLeft,
194 bool timeConstrained); 203 bool timeConstrained);
195 204
196 void renderToCacheBinResolution(LayerGeometryProvider *v, int x0, 205 void renderToCacheBinResolution(const LayerGeometryProvider *v, int x0,
197 int repaintWidth); 206 int repaintWidth);
198 207
199 int renderDrawBuffer(int w, int h, 208 int renderDrawBuffer(int w, int h,
200 const std::vector<int> &binforx, 209 const std::vector<int> &binforx,
201 const std::vector<double> &binfory, 210 const std::vector<double> &binfory,
202 bool usePeaksCache, 211 bool usePeaksCache,
203 bool rightToLeft, 212 bool rightToLeft,
204 bool timeConstrained); 213 bool timeConstrained);
205 214
206 int renderDrawBufferPeakFrequencies(LayerGeometryProvider *v, 215 int renderDrawBufferPeakFrequencies(const LayerGeometryProvider *v,
207 int w, int h, 216 int w, int h,
208 const std::vector<int> &binforx, 217 const std::vector<int> &binforx,
209 const std::vector<double> &binfory, 218 const std::vector<double> &binfory,
210 bool rightToLeft, 219 bool rightToLeft,
211 bool timeConstrained); 220 bool timeConstrained);
217 DrawBufferPixelResolution, 226 DrawBufferPixelResolution,
218 DrawBufferBinResolution, 227 DrawBufferBinResolution,
219 DirectTranslucent 228 DirectTranslucent
220 }; 229 };
221 230
222 RenderType decideRenderType(LayerGeometryProvider *) const; 231 RenderType decideRenderType(const LayerGeometryProvider *) const;
223 }; 232 };
224 233
225 #endif 234 #endif
226 235