Skip to content

Commit

Permalink
Use std::optional::value_or
Browse files Browse the repository at this point in the history
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
  • Loading branch information
sakertooth and messmerd authored Nov 11, 2024
1 parent 168e6fb commit 49ee728
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/gui/SampleWaveform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ void SampleWaveform::visualize(QPainter& painter, const QRect& rect, float ampli
{
if (!m_buffer || m_size == 0) { return; }

const auto sampleBegin = from.has_value() ? from.value() : 0;
const auto sampleEnd = to.has_value() ? to.value() : m_size;
const auto sampleBegin = from.value_or(0);
const auto sampleEnd = to.value_or(m_size);
const auto samplesPerPixel = std::max(1, static_cast<int>(sampleEnd - sampleBegin) / rect.width());

const auto downsampledLevelLow = static_cast<int>(std::log2(samplesPerPixel));
Expand Down

0 comments on commit 49ee728

Please sign in to comment.