From 8248c44538ad13bd510b0ff5c3b345d46b51c464 Mon Sep 17 00:00:00 2001 From: John Sennesael Date: Fri, 26 Feb 2021 11:13:15 -0600 Subject: [PATCH] missing namespace --- bmp2asc.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/bmp2asc.cpp b/bmp2asc.cpp index c283f5c..b8f7e3a 100644 --- a/bmp2asc.cpp +++ b/bmp2asc.cpp @@ -514,8 +514,8 @@ using Bitmap = std::vector; struct Image { - uint32_t width{0}; - uint32_t height{0}; + std::uint32_t width{0}; + std::uint32_t height{0}; Bitmap bitmap; }; @@ -643,7 +643,7 @@ std::vector toMask(const Image& image, const Color& alpha) return result; } -char percentMatch(const std::vector& a, const std::vector& b) +float percentMatch(const std::vector& a, const std::vector& b) { std::uint32_t matches{0}; std::uint32_t i{0}; @@ -652,19 +652,17 @@ char percentMatch(const std::vector& a, const std::vector& b) if (c == b[i]) matches++; i++; } - return static_cast( - (static_cast(matches) / static_cast(a.size()) ) * 100.0f - ); + return (static_cast(matches) / static_cast(a.size())) * 100.0f; } std::string findMatch(const Image& image, const Color& alpha) { const auto imageMask = toMask(image, alpha); - char maxPercent{0}; + float maxPercent{0.0f}; std::string result; for (const auto ctb: charToBitmap) { - const char pm = percentMatch(imageMask, ctb.second); + const float pm = percentMatch(imageMask, ctb.second); if (pm > maxPercent) { result = ctb.first;