comparison layer/Colour3DPlotLayer.cpp @ 1414:fa986b91d77f

Merge from branch fix-static-analysis
author Chris Cannam
date Wed, 09 Jan 2019 15:24:51 +0000
parents 79032214f79d c8a6fd3f9dff
children 8e40faa56ffd
comparison
equal deleted inserted replaced
1413:0930a27ebea2 1414:fa986b91d77f
41 41
42 //#define DEBUG_COLOUR_3D_PLOT_LAYER_PAINT 1 42 //#define DEBUG_COLOUR_3D_PLOT_LAYER_PAINT 1
43 43
44 44
45 Colour3DPlotLayer::Colour3DPlotLayer() : 45 Colour3DPlotLayer::Colour3DPlotLayer() :
46 m_model(0), 46 m_model(nullptr),
47 m_colourScale(ColourScaleType::Linear), 47 m_colourScale(ColourScaleType::Linear),
48 m_colourScaleSet(false), 48 m_colourScaleSet(false),
49 m_colourMap(0), 49 m_colourMap(0),
50 m_colourInverted(false), 50 m_colourInverted(false),
51 m_gain(1.0), 51 m_gain(1.0),
57 m_smooth(false), 57 m_smooth(false),
58 m_peakResolution(256), 58 m_peakResolution(256),
59 m_miny(0), 59 m_miny(0),
60 m_maxy(0), 60 m_maxy(0),
61 m_synchronous(false), 61 m_synchronous(false),
62 m_peakCache(0), 62 m_peakCache(nullptr),
63 m_peakCacheDivisor(8) 63 m_peakCacheDivisor(8)
64 { 64 {
65 QSettings settings; 65 QSettings settings;
66 settings.beginGroup("Preferences"); 66 settings.beginGroup("Preferences");
67 setColourMap(settings.value("colour-3d-plot-colour", ColourMapper::Green).toInt()); 67 setColourMap(settings.value("colour-3d-plot-colour", ColourMapper::Green).toInt());
160 m_peakResolution = 128; 160 m_peakResolution = 128;
161 } 161 }
162 162
163 if (m_peakCache) m_peakCache->aboutToDelete(); 163 if (m_peakCache) m_peakCache->aboutToDelete();
164 delete m_peakCache; 164 delete m_peakCache;
165 m_peakCache = 0; 165 m_peakCache = nullptr;
166 166
167 invalidateRenderers(); 167 invalidateRenderers();
168 invalidateMagnitudes(); 168 invalidateMagnitudes();
169 169
170 emit modelReplaced(); 170 emit modelReplaced();
183 sv_frame_t /* endFrame */) 183 sv_frame_t /* endFrame */)
184 { 184 {
185 //!!! should do this only if the range is visible 185 //!!! should do this only if the range is visible
186 if (m_peakCache) m_peakCache->aboutToDelete(); 186 if (m_peakCache) m_peakCache->aboutToDelete();
187 delete m_peakCache; 187 delete m_peakCache;
188 m_peakCache = 0; 188 m_peakCache = nullptr;
189 189
190 invalidateRenderers(); 190 invalidateRenderers();
191 invalidateMagnitudes(); 191 invalidateMagnitudes();
192 } 192 }
193 193
458 Colour3DPlotLayer::getNewPropertyRangeMapper(const PropertyName &name) const 458 Colour3DPlotLayer::getNewPropertyRangeMapper(const PropertyName &name) const
459 { 459 {
460 if (name == "Gain") { 460 if (name == "Gain") {
461 return new LinearRangeMapper(-50, 50, -25, 25, tr("dB")); 461 return new LinearRangeMapper(-50, 50, -25, 25, tr("dB"));
462 } 462 }
463 return 0; 463 return nullptr;
464 } 464 }
465 465
466 void 466 void
467 Colour3DPlotLayer::setProperty(const PropertyName &name, int value) 467 Colour3DPlotLayer::setProperty(const PropertyName &name, int value)
468 { 468 {
748 } 748 }
749 749
750 RangeMapper * 750 RangeMapper *
751 Colour3DPlotLayer::getNewVerticalZoomRangeMapper() const 751 Colour3DPlotLayer::getNewVerticalZoomRangeMapper() const
752 { 752 {
753 if (!m_model) return 0; 753 if (!m_model) return nullptr;
754 754
755 return new LinearRangeMapper(0, m_model->getHeight(), 755 return new LinearRangeMapper(0, m_model->getHeight(),
756 0, m_model->getHeight(), ""); 756 0, m_model->getHeight(), "");
757 } 757 }
758 758
1018 1018
1019 if (m_renderers.find(viewId) == m_renderers.end()) { 1019 if (m_renderers.find(viewId) == m_renderers.end()) {
1020 1020
1021 Colour3DPlotRenderer::Sources sources; 1021 Colour3DPlotRenderer::Sources sources;
1022 sources.verticalBinLayer = this; 1022 sources.verticalBinLayer = this;
1023 sources.fft = 0; 1023 sources.fft = nullptr;
1024 sources.source = m_model; 1024 sources.source = m_model;
1025 sources.peakCaches.push_back(getPeakCache()); 1025 sources.peakCaches.push_back(getPeakCache());
1026 1026
1027 ColourScale::Parameters cparams; 1027 ColourScale::Parameters cparams;
1028 cparams.colourMap = m_colourMap; 1028 cparams.colourMap = m_colourMap;