From 3770de7a03879a8ff6b8cf22b402217c19fa2b53 Mon Sep 17 00:00:00 2001 From: Spartan322 Date: Mon, 18 Dec 2023 21:41:57 -0500 Subject: Change colour_t to be a strongly typed structure Make RGB default of `colour_t` Distinguish RGB and ARGB colors by type and colour_traits Add `_colour` and `_argb` colour user-defined literals Add `OpenVic::utility::unreachable` --- src/openvic-simulation/utility/BMP.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/openvic-simulation/utility/BMP.cpp') diff --git a/src/openvic-simulation/utility/BMP.cpp b/src/openvic-simulation/utility/BMP.cpp index d4e7cf7..83d26c4 100644 --- a/src/openvic-simulation/utility/BMP.cpp +++ b/src/openvic-simulation/utility/BMP.cpp @@ -102,7 +102,7 @@ bool BMP::read_header() { if (header.num_colours != 0 && header.bits_per_pixel > PALETTE_BITS_PER_PIXEL_LIMIT) { Logger::error( "Invalid BMP palette size: ", header.num_colours, " (should be 0 as bits per pixel is ", header.bits_per_pixel, - " > 8)" + " > ", PALETTE_BITS_PER_PIXEL_LIMIT, ")" ); header_validated = false; } @@ -207,7 +207,7 @@ bool BMP::read_pixel_data() { Logger::error("Failed to move to the pixel data in the BMP file!"); return false; } - const size_t pixel_data_size = get_width() * get_height() * header.bits_per_pixel / 8; + const size_t pixel_data_size = get_width() * get_height() * header.bits_per_pixel / CHAR_BIT; pixel_data.resize(pixel_data_size); file.read(reinterpret_cast(pixel_data.data()), pixel_data_size); if (file.fail()) { -- cgit v1.2.3-56-ga3b1