Mercurial > hg > svgui
comparison layer/SpectrogramLayer.h @ 1106:8abdefce36a6 spectrogram-minor-refactor
Remove all of the "old" paint logic from SpectrogramLayer, even where it hasn't been completely replaced yet
author | Chris Cannam |
---|---|
date | Thu, 14 Jul 2016 17:03:40 +0100 |
parents | ea5ae9dd10ba |
children | 6d720fe1c8cc |
comparison
equal
deleted
inserted
replaced
1105:ea5ae9dd10ba | 1106:8abdefce36a6 |
---|---|
248 int m_colourRotation; | 248 int m_colourRotation; |
249 int m_initialRotation; | 249 int m_initialRotation; |
250 int m_minFrequency; | 250 int m_minFrequency; |
251 int m_maxFrequency; | 251 int m_maxFrequency; |
252 int m_initialMaxFrequency; | 252 int m_initialMaxFrequency; |
253 ColourScaleType m_colourScale; | 253 ColourScaleType m_colourScale; |
254 int m_colourMap; | 254 int m_colourMap; |
255 QColor m_crosshairColour; | 255 QColor m_crosshairColour; |
256 BinScale m_binScale; | 256 BinScale m_binScale; |
257 BinDisplay m_binDisplay; | 257 BinDisplay m_binDisplay; |
258 ColumnNormalization m_normalization; // of individual columns | 258 ColumnNormalization m_normalization; // of individual columns |
265 static ColourScaleType convertToColourScale(int value); | 265 static ColourScaleType convertToColourScale(int value); |
266 static int convertFromColourScale(ColourScaleType); | 266 static int convertFromColourScale(ColourScaleType); |
267 static std::pair<ColumnNormalization, bool> convertToColumnNorm(int value); | 267 static std::pair<ColumnNormalization, bool> convertToColumnNorm(int value); |
268 static int convertFromColumnNorm(ColumnNormalization norm, bool visible); | 268 static int convertFromColumnNorm(ColumnNormalization norm, bool visible); |
269 | 269 |
270 enum { NO_VALUE = 0 }; // colour index for unused pixels | |
271 | |
272 class Palette | |
273 { | |
274 public: | |
275 QColor getColour(unsigned char index) const { | |
276 return m_colours[index]; | |
277 } | |
278 | |
279 void setColour(unsigned char index, QColor colour) { | |
280 m_colours[index] = colour; | |
281 } | |
282 | |
283 private: | |
284 QColor m_colours[256]; | |
285 }; | |
286 | |
287 Palette m_palette; | |
288 | |
289 typedef std::map<int, ScrollableImageCache> ViewImageCache; // key is view id | |
290 void invalidateImageCaches(); | |
291 mutable ViewImageCache m_imageCaches; | |
292 ScrollableImageCache &getImageCacheReference(const LayerGeometryProvider *) const; | |
293 | |
294 /** | |
295 * When painting, we draw directly onto the draw buffer and then | |
296 * copy this to the part of the image cache that needed refreshing | |
297 * before copying the image cache onto the window. (Remind me why | |
298 * we don't draw directly onto the cache?) (Answer: it's because | |
299 * we usually apply scaling and smoothing in the x axis when | |
300 * copying from draw buffer to cache) | |
301 */ | |
302 mutable QImage m_drawBuffer; | |
303 | |
304 bool m_exiting; | 270 bool m_exiting; |
305 | |
306 void initialisePalette(); | |
307 void rotatePalette(int distance); | |
308 | |
309 unsigned char getDisplayValue(LayerGeometryProvider *v, double input) const; | |
310 | 271 |
311 int getColourScaleWidth(QPainter &) const; | 272 int getColourScaleWidth(QPainter &) const; |
312 | 273 |
313 void illuminateLocalFeatures(LayerGeometryProvider *v, QPainter &painter) const; | 274 void illuminateLocalFeatures(LayerGeometryProvider *v, QPainter &painter) const; |
314 | 275 |
346 bool updateViewMagnitudes(LayerGeometryProvider *v) const; | 307 bool updateViewMagnitudes(LayerGeometryProvider *v) const; |
347 | 308 |
348 typedef std::map<int, Colour3DPlotRenderer *> ViewRendererMap; // key is view id | 309 typedef std::map<int, Colour3DPlotRenderer *> ViewRendererMap; // key is view id |
349 mutable ViewRendererMap m_renderers; | 310 mutable ViewRendererMap m_renderers; |
350 Colour3DPlotRenderer *getRenderer(LayerGeometryProvider *) const; | 311 Colour3DPlotRenderer *getRenderer(LayerGeometryProvider *) const; |
312 void invalidateRenderers(); | |
351 | 313 |
352 FFTModel *getFFTModel() const; | 314 FFTModel *getFFTModel() const; |
353 Dense3DModelPeakCache *getPeakCache() const; | 315 Dense3DModelPeakCache *getPeakCache() const; |
354 void invalidateFFTModel(); | 316 void invalidateFFTModel(); |
355 | 317 |
356 void paintAlternative(LayerGeometryProvider *v, QPainter &paint, QRect rect) const; | 318 void paintWithRenderer(LayerGeometryProvider *v, QPainter &paint, QRect rect) const; |
357 | |
358 int paintDrawBuffer(LayerGeometryProvider *v, int w, int h, | |
359 const std::vector<int> &binforx, | |
360 const std::vector<double> &binfory, | |
361 bool usePeaksCache, | |
362 MagnitudeRange &overallMag, | |
363 bool &overallMagChanged, | |
364 bool rightToLeft, | |
365 double softTimeLimit) const; | |
366 int paintDrawBufferPeakFrequencies(LayerGeometryProvider *v, int w, int h, | |
367 const std::vector<int> &binforx, | |
368 int minbin, | |
369 int maxbin, | |
370 double displayMinFreq, | |
371 double displayMaxFreq, | |
372 bool logarithmic, | |
373 MagnitudeRange &overallMag, | |
374 bool &overallMagChanged, | |
375 bool rightToLeft, | |
376 double softTimeLimit) const; | |
377 | |
378 std::vector<float> getColumnFromFFTModel(FFTModel *model, | |
379 int sx, | |
380 int minbin, | |
381 int bincount) const; | |
382 | |
383 std::vector<float> getColumnFromGenericModel(DenseThreeDimensionalModel *model, | |
384 int sx, | |
385 int minbin, | |
386 int bincount) const; | |
387 | |
388 void recordColumnExtents(const std::vector<float> &col, | |
389 int sx, | |
390 MagnitudeRange &overallMag, | |
391 bool &overallMagChanged) const; | |
392 | 319 |
393 virtual void updateMeasureRectYCoords(LayerGeometryProvider *v, | 320 virtual void updateMeasureRectYCoords(LayerGeometryProvider *v, |
394 const MeasureRect &r) const; | 321 const MeasureRect &r) const; |
395 virtual void setMeasureRectYCoord(LayerGeometryProvider *v, | 322 virtual void setMeasureRectYCoord(LayerGeometryProvider *v, |
396 MeasureRect &r, bool start, int y) const; | 323 MeasureRect &r, bool start, int y) const; |