From 28e40d502a972ecae453a0f3642ca8439a0f0b8b Mon Sep 17 00:00:00 2001 From: Maicon Santana Date: Fri, 27 Feb 2026 07:19:06 +0000 Subject: [PATCH] #if reduced as possible (#5600) --- src/platforms/rcore_desktop_glfw.c | 13 +++---------- src/platforms/rcore_desktop_rgfw.c | 12 +++--------- src/platforms/rcore_desktop_sdl.c | 1 - 3 files changed, 6 insertions(+), 20 deletions(-) diff --git a/src/platforms/rcore_desktop_glfw.c b/src/platforms/rcore_desktop_glfw.c index 9d2cd018d..5b62339e2 100644 --- a/src/platforms/rcore_desktop_glfw.c +++ b/src/platforms/rcore_desktop_glfw.c @@ -1048,11 +1048,8 @@ Image GetClipboardImage(void) { Image image = { 0 }; -#if SUPPORT_CLIPBOARD_IMAGE -#if SUPPORT_MODULE_RTEXTURES +#if SUPPORT_CLIPBOARD_IMAGE && SUPPORT_MODULE_RTEXTURES #if defined(_WIN32) - -#if SUPPORT_FILEFORMAT_BMP unsigned long long int dataSize = 0; void *bmpData = NULL; int width = 0; @@ -1062,15 +1059,11 @@ Image GetClipboardImage(void) if (bmpData == NULL) TRACELOG(LOG_WARNING, "Clipboard image: Couldn't get clipboard data."); else image = LoadImageFromMemory(".bmp", (const unsigned char *)bmpData, (int)dataSize); -#else - TRACELOG(LOG_WARNING, "WARNING: Enabling SUPPORT_CLIPBOARD_IMAGE requires SUPPORT_FILEFORMAT_BMP, specially on Windows"); -#endif // SUPPORT_FILEFORMAT_BMP #else TRACELOG(LOG_WARNING, "GetClipboardImage() not implemented on target platform"); #endif // defined(_WIN32) -#else // !SUPPORT_MODULE_RTEXTURES - TRACELOG(LOG_WARNING, "Enabling SUPPORT_CLIPBOARD_IMAGE requires SUPPORT_MODULE_RTEXTURES to work properly"); -#endif // SUPPORT_MODULE_RTEXTURES +#else + TRACELOG(LOG_WARNING, "Clipboard image: SUPPORT_CLIPBOARD_IMAGE requires SUPPORT_MODULE_RTEXTURES to work properly"); #endif // SUPPORT_CLIPBOARD_IMAGE return image; diff --git a/src/platforms/rcore_desktop_rgfw.c b/src/platforms/rcore_desktop_rgfw.c index 532371f35..ed471645c 100755 --- a/src/platforms/rcore_desktop_rgfw.c +++ b/src/platforms/rcore_desktop_rgfw.c @@ -1006,11 +1006,9 @@ const char *GetClipboardText(void) Image GetClipboardImage(void) { Image image = { 0 }; -#if SUPPORT_CLIPBOARD_IMAGE -#if SUPPORT_MODULE_RTEXTURES +#if SUPPORT_CLIPBOARD_IMAGE && SUPPORT_MODULE_RTEXTURES #if defined(_WIN32) -#if SUPPORT_FILEFORMAT_BMP unsigned long long int dataSize = 0; // moved into _WIN32 scope until other platforms gain support void *fileData = NULL; // moved into _WIN32 scope until other platforms gain support @@ -1020,15 +1018,11 @@ Image GetClipboardImage(void) if (fileData == NULL) TRACELOG(LOG_WARNING, "Clipboard image: Couldn't get clipboard data"); else image = LoadImageFromMemory(".bmp", (const unsigned char *)fileData, dataSize); -#else - TRACELOG(LOG_WARNING, "WARNING: Enabling SUPPORT_CLIPBOARD_IMAGE requires SUPPORT_FILEFORMAT_BMP, specially on Windows"); -#endif // SUPPORT_FILEFORMAT_BMP #else TRACELOG(LOG_WARNING, "Clipboard image: PLATFORM_DESKTOP_RGFW doesn't implement GetClipboardImage() for this OS"); #endif // defined(_WIN32) -#else // !SUPPORT_MODULE_RTEXTURES - TRACELOG(LOG_WARNING, "Enabling SUPPORT_CLIPBOARD_IMAGE requires SUPPORT_MODULE_RTEXTURES to work properly"); -#endif // SUPPORT_MODULE_RTEXTURES +#else + TRACELOG(LOG_WARNING, "Clipboard image: SUPPORT_CLIPBOARD_IMAGE requires SUPPORT_MODULE_RTEXTURES to work properly"); #endif // SUPPORT_CLIPBOARD_IMAGE return image; diff --git a/src/platforms/rcore_desktop_sdl.c b/src/platforms/rcore_desktop_sdl.c index 90d388b95..b20fded9c 100644 --- a/src/platforms/rcore_desktop_sdl.c +++ b/src/platforms/rcore_desktop_sdl.c @@ -1177,7 +1177,6 @@ Image GetClipboardImage(void) // From what I've tested applications on Wayland saves images on clipboard as PNG #if (!SUPPORT_FILEFORMAT_PNG || !SUPPORT_FILEFORMAT_JPG) && !defined(_WIN32) TRACELOG(LOG_WARNING, "WARNING: Getting image from the clipboard might not work without SUPPORT_FILEFORMAT_PNG or SUPPORT_FILEFORMAT_JPG"); - return image; #endif // Let's hope compiler put these arrays in static memory const char *imageFormats[] = {