diff options
Diffstat (limited to 'src/GFX/Image/PPMParser.cpp')
| -rw-r--r-- | src/GFX/Image/PPMParser.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/GFX/Image/PPMParser.cpp b/src/GFX/Image/PPMParser.cpp index cf1bf77..f002db8 100644 --- a/src/GFX/Image/PPMParser.cpp +++ b/src/GFX/Image/PPMParser.cpp @@ -66,7 +66,7 @@ RawImage::Pixel PPMParser::parse_pixel(uint8_t max_color) { throw std::runtime_error("Sample can not be greater than Maxval."); } - auto map_to_range = [=](uint64_t s) -> uint8_t { return (s * 255) / max_color; }; + auto map_to_range = [=](uint64_t s) -> uint8_t { return s * 255 / max_color; }; RawImage::Pixel pixel{}; pixel.r = map_to_range(r_sample); @@ -120,9 +120,8 @@ std::string_view PPMParser::chomp_part() { } void PPMParser::skip_whitespace() { - uint8_t c; while (!is_eof()) { - c = m_source[m_cursor]; + uint8_t c = m_source[m_cursor]; if (c == '#') { skip_comment(); continue; @@ -147,7 +146,7 @@ void PPMParser::skip_comment() { } } -bool PPMParser::is_eof() { +bool PPMParser::is_eof() const { return m_cursor >= m_source.size(); } |
