Skip to content

Commit bf9346c

Browse files
committed
Merge pull request #107898 from BlueCube3310/image-invis-fix
Image: Fix `is_invisible` detection for RGBAH and RGBAF
2 parents 5256281 + e35c80b commit bf9346c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

core/io/image.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2451,22 +2451,22 @@ bool Image::is_invisible() const {
24512451
} break;
24522452
case FORMAT_RGBAH: {
24532453
// The alpha mask accounts for the sign bit.
2454-
const int pixel_count = len / 4;
2454+
const int pixel_count = len / 8;
24552455
const uint16_t *pixeldata = reinterpret_cast<const uint16_t *>(data.ptr());
24562456

2457-
for (int i = 0; i < pixel_count; i += 4) {
2458-
if ((pixeldata[i + 3] & 0x7FFF) != 0) {
2457+
for (int i = 0; i < pixel_count; i++) {
2458+
if ((pixeldata[i * 4 + 3] & 0x7FFF) != 0) {
24592459
return false;
24602460
}
24612461
}
24622462
} break;
24632463
case FORMAT_RGBAF: {
24642464
// The alpha mask accounts for the sign bit.
2465-
const int pixel_count = len / 4;
2465+
const int pixel_count = len / 16;
24662466
const uint32_t *pixeldata = reinterpret_cast<const uint32_t *>(data.ptr());
24672467

2468-
for (int i = 0; i < pixel_count; i += 4) {
2469-
if ((pixeldata[i + 3] & 0x7FFFFFFF) != 0) {
2468+
for (int i = 0; i < pixel_count; i++) {
2469+
if ((pixeldata[i * 4 + 3] & 0x7FFFFFFF) != 0) {
24702470
return false;
24712471
}
24722472
}

0 commit comments

Comments
 (0)