aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/core.c b/src/core.c
index 2018b3b0..aab60f13 100644
--- a/src/core.c
+++ b/src/core.c
@@ -780,24 +780,23 @@ void ToggleFullscreen(void)
}
// Set icon for window (only PLATFORM_DESKTOP)
+// NOTE: Image must be in RGBA format, 8bit per channel
void SetWindowIcon(Image image)
{
#if defined(PLATFORM_DESKTOP)
- Image imicon = ImageCopy(image);
- ImageFormat(&imicon, UNCOMPRESSED_R8G8B8A8);
-
- GLFWimage icon[1] = { 0 };
-
- icon[0].width = imicon.width;
- icon[0].height = imicon.height;
- icon[0].pixels = (unsigned char *)imicon.data;
+ if (image.format == UNCOMPRESSED_R8G8B8A8)
+ {
+ GLFWimage icon[1] = { 0 };
- // NOTE 1: We only support one image icon
- // NOTE 2: The specified image data is copied before this function returns
- glfwSetWindowIcon(window, 1, icon);
+ icon[0].width = image.width;
+ icon[0].height = image.height;
+ icon[0].pixels = (unsigned char *)image.data;
- // TODO: Support multi-image icons --> image.mipmaps
- UnloadImage(imicon);
+ // NOTE 1: We only support one image icon
+ // NOTE 2: The specified image data is copied before this function returns
+ glfwSetWindowIcon(window, 1, icon);
+ }
+ else TraceLog(LOG_WARNING, "Window icon image must be in R8G8B8A8 pixel format");
#endif
}