diff options
author | Hop311 <Hop3114@gmail.com> | 2023-10-29 21:14:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-29 21:14:55 +0100 |
commit | 06cc0606156d009026930c785c62434276fbe782 (patch) | |
tree | d37fcb69766ec029ea4e3e2816c419f9d7e05f7c /src/openvic-simulation/utility/BMP.cpp | |
parent | d8ec90f07342876e9331819bd3cc372050f78248 (diff) | |
parent | 1b5e43fa7750cc4025d32f18390593cbce3ba842 (diff) |
Merge pull request #67 from OpenVicProject/format
Formating
Diffstat (limited to 'src/openvic-simulation/utility/BMP.cpp')
-rw-r--r-- | src/openvic-simulation/utility/BMP.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/openvic-simulation/utility/BMP.cpp b/src/openvic-simulation/utility/BMP.cpp index 2fa9417..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) @@ -98,15 +100,18 @@ bool BMP::read_header() { #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) { |