Mercurial > hg > svgui
diff layer/ColourScale.cpp @ 1105:ea5ae9dd10ba spectrogram-minor-refactor
Convert ColourScaleType into an enum class
author | Chris Cannam |
---|---|
date | Thu, 14 Jul 2016 16:52:16 +0100 |
parents | 7ebfb61b1701 |
children | 9fb8dfd7ce4c |
line wrap: on
line diff
--- a/layer/ColourScale.cpp Thu Jul 14 16:12:05 2016 +0100 +++ b/layer/ColourScale.cpp Thu Jul 14 16:52:16 2016 +0100 @@ -33,16 +33,16 @@ m_mappedMin = m_params.minValue; m_mappedMax = m_params.maxValue; - if (m_params.scale == LogColourScale) { + if (m_params.scale == ColourScaleType::Log) { LogRange::mapRange(m_mappedMin, m_mappedMax); - } else if (m_params.scale == PlusMinusOneScale) { + } else if (m_params.scale == ColourScaleType::PlusMinusOne) { m_mappedMin = -1.0; m_mappedMax = 1.0; - } else if (m_params.scale == AbsoluteScale) { + } else if (m_params.scale == ColourScaleType::Absolute) { m_mappedMin = fabs(m_mappedMin); m_mappedMax = fabs(m_mappedMax); @@ -60,7 +60,7 @@ { } -ColourScale::Scale +ColourScaleType ColourScale::getScale() const { return m_params.scale; @@ -71,7 +71,7 @@ { double maxPixF = m_maxPixel; - if (m_params.scale == PhaseColourScale) { + if (m_params.scale == ColourScaleType::Phase) { double half = (maxPixF - 1.f) / 2.f; return 1 + int((value * half) / M_PI + half); } @@ -82,12 +82,12 @@ double mapped = value; - if (m_params.scale == LogColourScale) { + if (m_params.scale == ColourScaleType::Log) { mapped = LogRange::map(value); - } else if (m_params.scale == PlusMinusOneScale) { + } else if (m_params.scale == ColourScaleType::PlusMinusOne) { if (mapped < -1.f) mapped = -1.f; if (mapped > 1.f) mapped = 1.f; - } else if (m_params.scale == AbsoluteScale) { + } else if (m_params.scale == ColourScaleType::Absolute) { if (mapped < 0.f) mapped = -mapped; } @@ -102,7 +102,7 @@ int pixel = 0; - if (m_params.scale == MeterColourScale) { + if (m_params.scale == ColourScaleType::Meter) { pixel = AudioLevel::multiplier_to_preview(proportion, m_maxPixel-1) + 1; } else { pixel = int(proportion * maxPixF) + 1;