From 1b5e43fa7750cc4025d32f18390593cbce3ba842 Mon Sep 17 00:00:00 2001 From: hop311 Date: Sun, 29 Oct 2023 14:11:10 +0000 Subject: Clang-format formatting (with manual cleanup) --- src/openvic-simulation/utility/BMP.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 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 cdd8ead..d4e7cf7 100644 --- a/src/openvic-simulation/utility/BMP.cpp +++ b/src/openvic-simulation/utility/BMP.cpp @@ -69,8 +69,10 @@ bool BMP::read_header() { // Validate sizes and dimensions // TODO - image_size_bytes can be 0 for non-compressed BMPs if (header.file_size != header.offset + header.image_size_bytes) { - Logger::error("Invalid BMP memory sizes: file size = ", header.file_size, " != ", header.offset + header.image_size_bytes, - " = ", header.offset, " + ", header.image_size_bytes, " = image data offset + image data size"); + Logger::error( + "Invalid BMP memory sizes: file size = ", header.file_size, " != ", header.offset + header.image_size_bytes, " = ", + header.offset, " + ", header.image_size_bytes, " = image data offset + image data size" + ); header_validated = false; } // TODO - support negative widths (i.e. horizontal flip) @@ -91,24 +93,25 @@ bool BMP::read_header() { #define STR(x) #x static const std::set BITS_PER_PIXEL { VALID_BITS_PER_PIXEL }; if (!BITS_PER_PIXEL.contains(header.bits_per_pixel)) { - Logger::error("Invalid BMP bits per pixel: ", header.bits_per_pixel, - " (must be one of " STR(VALID_BITS_PER_PIXEL) ")"); + Logger::error("Invalid BMP bits per pixel: ", header.bits_per_pixel, " (must be one of " STR(VALID_BITS_PER_PIXEL) ")"); header_validated = false; } #undef VALID_BITS_PER_PIXEL #undef STR static constexpr uint16_t PALETTE_BITS_PER_PIXEL_LIMIT = 8; 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)"); + Logger::error( + "Invalid BMP palette size: ", header.num_colours, " (should be 0 as bits per pixel is ", header.bits_per_pixel, + " > 8)" + ); header_validated = false; } // TODO - validate important_colours palette_size = header.bits_per_pixel > PALETTE_BITS_PER_PIXEL_LIMIT ? 0 // Use header.num_colours if it's greater than 0 and at most 1 << header.bits_per_pixel - : 0 < header.num_colours && header.num_colours - 1 >> header.bits_per_pixel == 0 ? header.num_colours - : 1 << header.bits_per_pixel; + : (0 < header.num_colours && header.num_colours - 1 >> header.bits_per_pixel == 0 + ? header.num_colours : 1 << header.bits_per_pixel); const uint32_t expected_offset = palette_size * PALETTE_COLOUR_SIZE + sizeof(header); if (header.offset != expected_offset) { -- cgit v1.2.3-56-ga3b1