From e35c80b61c742935bc71c044f01b11ca192813a2 Mon Sep 17 00:00:00 2001 From: BlueCube3310 <53150244+BlueCube3310@users.noreply.github.com> Date: Mon, 23 Jun 2025 18:21:04 +0200 Subject: [PATCH] Image: Fix `is_invisible` detection for RGBAH and RGBAF --- core/io/image.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/io/image.cpp b/core/io/image.cpp index e2bb626f997..f308ee6b8a3 100644 --- a/core/io/image.cpp +++ b/core/io/image.cpp @@ -2451,22 +2451,22 @@ bool Image::is_invisible() const { } break; case FORMAT_RGBAH: { // The alpha mask accounts for the sign bit. - const int pixel_count = len / 4; + const int pixel_count = len / 8; const uint16_t *pixeldata = reinterpret_cast(data.ptr()); - for (int i = 0; i < pixel_count; i += 4) { - if ((pixeldata[i + 3] & 0x7FFF) != 0) { + for (int i = 0; i < pixel_count; i++) { + if ((pixeldata[i * 4 + 3] & 0x7FFF) != 0) { return false; } } } break; case FORMAT_RGBAF: { // The alpha mask accounts for the sign bit. - const int pixel_count = len / 4; + const int pixel_count = len / 16; const uint32_t *pixeldata = reinterpret_cast(data.ptr()); - for (int i = 0; i < pixel_count; i += 4) { - if ((pixeldata[i + 3] & 0x7FFFFFFF) != 0) { + for (int i = 0; i < pixel_count; i++) { + if ((pixeldata[i * 4 + 3] & 0x7FFFFFFF) != 0) { return false; } }