diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2018-05-01 08:35:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-01 08:35:10 +0200 |
commit | 4cce6f34170d693be994d9a451b4b5f96a084cfb (patch) | |
tree | 74fa8c76ccd7eb2f289f08bb38a095c4cc74cb59 /core/image.cpp | |
parent | 613a8bee415381a8564d34092b479e1f159e8e60 (diff) | |
parent | e6deba8d196a206ff350bc4d9fff783f78395d33 (diff) | |
download | redot-engine-4cce6f34170d693be994d9a451b4b5f96a084cfb.tar.gz |
Merge pull request #18321 from Crazy-P/Fixes-logically-dead-code
Fixes logically dead code (Coverity)
Diffstat (limited to 'core/image.cpp')
-rw-r--r-- | core/image.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/core/image.cpp b/core/image.cpp index 1f4498af9b..58f49d69e6 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -366,6 +366,8 @@ int Image::get_mipmap_count() const { template <uint32_t read_bytes, bool read_alpha, uint32_t write_bytes, bool write_alpha, bool read_gray, bool write_gray> static void _convert(int p_width, int p_height, const uint8_t *p_src, uint8_t *p_dst) { + uint32_t max_bytes = MAX(read_bytes, write_bytes); + for (int y = 0; y < p_height; y++) { for (int x = 0; x < p_width; x++) { @@ -379,7 +381,8 @@ static void _convert(int p_width, int p_height, const uint8_t *p_src, uint8_t *p rgba[1] = rofs[0]; rgba[2] = rofs[0]; } else { - for (uint32_t i = 0; i < MAX(read_bytes, write_bytes); i++) { + + for (uint32_t i = 0; i < max_bytes; i++) { rgba[i] = (i < read_bytes) ? rofs[i] : 0; } |