Skip to content

Commit

Permalink
Track::Graphics: use std::clamp instead of std::min/max
Browse files Browse the repository at this point in the history
  • Loading branch information
pierreguillot committed Oct 28, 2024
1 parent 43f3480 commit b985261
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Source/Track/AnlTrackGraphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ void Track::Graphics::performRendering(std::vector<Track::Result::Data::Columns>
using diff_t = decltype(values.cbegin())::difference_type;
auto const rval = *std::max_element(std::next(values.cbegin(), static_cast<diff_t>(startRow)), std::next(values.cbegin(), static_cast<diff_t>(endRow)));
auto const value = std::round((rval - valueStart) * valueScale);
auto const colorIndex = static_cast<size_t>(std::min(std::max(value, 0.0f), 255.0f));
auto const colorIndex = static_cast<size_t>(std::clamp(value, 0.0f, 255.0f));
reinterpret_cast<juce::PixelARGB*>(pixel)->set(colours[colorIndex]);
}
pixel -= lineStride;
Expand Down

0 comments on commit b985261

Please sign in to comment.