From 0c0b7d85053dfd5c3d72830648d60afbc85d63c9 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 10 Feb 2025 11:30:53 -0800
Subject: [PATCH] Fixed partial alpha in ICO and CUR images
Fixes https://github.com/libsdl-org/SDL_image/issues/518
(cherry picked from commit be3ddf22568dd31aa88ba7461ad06638d22ed04e)
---
CHANGES.txt | 3 +++
src/IMG_bmp.c | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/CHANGES.txt b/CHANGES.txt
index 3325e9fa5..372ef0433 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,6 @@
+2.8.6:
+ * Fixed partial alpha in ICO and CUR images
+
2.8.5:
* Handle WEBP animation composition
diff --git a/src/IMG_bmp.c b/src/IMG_bmp.c
index d49b95ed8..e5f21f95a 100644
--- a/src/IMG_bmp.c
+++ b/src/IMG_bmp.c
@@ -411,7 +411,7 @@ LoadICOCUR_RW(SDL_RWops * src, int type, int freesrc)
goto done;
}
}
- *((Uint32 *) bits + i) |= ((pixel >> shift) ? 0 : 0xFF000000);
+ *((Uint32 *) bits + i) &= ((pixel >> shift) ? 0 : 0xFFFFFFFF);
pixel <<= ExpandBMP;
}
/* Skip padding bytes, ugh */