Skip to content

Commit 05a34b0

Browse files
Swaping #pragma message with TRACELOG inside the clipboard_image function (#5596)
Co-authored-by: Ray <raysan5@gmail.com>
1 parent d8861cc commit 05a34b0

File tree

5 files changed

+39
-21
lines changed

5 files changed

+39
-21
lines changed

src/platforms/rcore_desktop_glfw.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,10 @@ Image GetClipboardImage(void)
10491049
Image image = { 0 };
10501050

10511051
#if SUPPORT_CLIPBOARD_IMAGE
1052+
#if SUPPORT_MODULE_RTEXTURES
10521053
#if defined(_WIN32)
1054+
1055+
#if SUPPORT_FILEFORMAT_BMP
10531056
unsigned long long int dataSize = 0;
10541057
void *bmpData = NULL;
10551058
int width = 0;
@@ -1059,10 +1062,16 @@ Image GetClipboardImage(void)
10591062

10601063
if (bmpData == NULL) TRACELOG(LOG_WARNING, "Clipboard image: Couldn't get clipboard data.");
10611064
else image = LoadImageFromMemory(".bmp", (const unsigned char *)bmpData, (int)dataSize);
1065+
#else
1066+
TRACELOG(LOG_WARNING, "WARNING: Enabling SUPPORT_CLIPBOARD_IMAGE requires SUPPORT_FILEFORMAT_BMP, specially on Windows");
1067+
#endif // SUPPORT_FILEFORMAT_BMP
10621068
#else
10631069
TRACELOG(LOG_WARNING, "GetClipboardImage() not implemented on target platform");
1064-
#endif
1065-
#endif
1070+
#endif // defined(_WIN32)
1071+
#else // !SUPPORT_MODULE_RTEXTURES
1072+
TRACELOG(LOG_WARNING, "Enabling SUPPORT_CLIPBOARD_IMAGE requires SUPPORT_MODULE_RTEXTURES to work properly");
1073+
#endif // SUPPORT_MODULE_RTEXTURES
1074+
#endif // SUPPORT_CLIPBOARD_IMAGE
10661075

10671076
return image;
10681077
}

src/platforms/rcore_desktop_rgfw.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,10 @@ Image GetClipboardImage(void)
10071007
{
10081008
Image image = { 0 };
10091009
#if SUPPORT_CLIPBOARD_IMAGE
1010+
#if SUPPORT_MODULE_RTEXTURES
10101011
#if defined(_WIN32)
1012+
1013+
#if SUPPORT_FILEFORMAT_BMP
10111014
unsigned long long int dataSize = 0; // moved into _WIN32 scope until other platforms gain support
10121015
void *fileData = NULL; // moved into _WIN32 scope until other platforms gain support
10131016

@@ -1017,9 +1020,15 @@ Image GetClipboardImage(void)
10171020

10181021
if (fileData == NULL) TRACELOG(LOG_WARNING, "Clipboard image: Couldn't get clipboard data");
10191022
else image = LoadImageFromMemory(".bmp", (const unsigned char *)fileData, dataSize);
1023+
#else
1024+
TRACELOG(LOG_WARNING, "WARNING: Enabling SUPPORT_CLIPBOARD_IMAGE requires SUPPORT_FILEFORMAT_BMP, specially on Windows");
1025+
#endif // SUPPORT_FILEFORMAT_BMP
10201026
#else
10211027
TRACELOG(LOG_WARNING, "Clipboard image: PLATFORM_DESKTOP_RGFW doesn't implement GetClipboardImage() for this OS");
1022-
#endif
1028+
#endif // defined(_WIN32)
1029+
#else // !SUPPORT_MODULE_RTEXTURES
1030+
TRACELOG(LOG_WARNING, "Enabling SUPPORT_CLIPBOARD_IMAGE requires SUPPORT_MODULE_RTEXTURES to work properly");
1031+
#endif // SUPPORT_MODULE_RTEXTURES
10231032
#endif // SUPPORT_CLIPBOARD_IMAGE
10241033

10251034
return image;

src/platforms/rcore_desktop_sdl.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1163,6 +1163,22 @@ Image GetClipboardImage(void)
11631163
Image image = { 0 };
11641164

11651165
#if SUPPORT_CLIPBOARD_IMAGE
1166+
#if !SUPPORT_MODULE_RTEXTURES
1167+
TRACELOG(LOG_WARNING, "Enabling SUPPORT_CLIPBOARD_IMAGE requires SUPPORT_MODULE_RTEXTURES to work properly");
1168+
return image;
1169+
#endif
1170+
1171+
// It's nice to have support Bitmap on Linux as well, but not as necessary as Windows
1172+
#if !SUPPORT_FILEFORMAT_BMP && defined(_WIN32)
1173+
TRACELOG(LOG_WARNING, "WARNING: Enabling SUPPORT_CLIPBOARD_IMAGE requires SUPPORT_FILEFORMAT_BMP, specially on Windows");
1174+
return image;
1175+
#endif
1176+
1177+
// From what I've tested applications on Wayland saves images on clipboard as PNG
1178+
#if (!SUPPORT_FILEFORMAT_PNG || !SUPPORT_FILEFORMAT_JPG) && !defined(_WIN32)
1179+
TRACELOG(LOG_WARNING, "WARNING: Getting image from the clipboard might not work without SUPPORT_FILEFORMAT_PNG or SUPPORT_FILEFORMAT_JPG");
1180+
return image;
1181+
#endif
11661182
// Let's hope compiler put these arrays in static memory
11671183
const char *imageFormats[] = {
11681184
"image/bmp",
@@ -1197,7 +1213,7 @@ Image GetClipboardImage(void)
11971213
}
11981214

11991215
if (!IsImageValid(image)) TRACELOG(LOG_WARNING, "Clipboard: Couldn't get clipboard data. ERROR: %s", SDL_GetError());
1200-
#endif
1216+
#endif // SUPPORT_CLIPBOARD_IMAGE
12011217

12021218
return image;
12031219
}

src/raymath.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2708,7 +2708,7 @@ RMAPI void MatrixDecompose(Matrix mat, Vector3 *translation, Quaternion *rotatio
27082708
stabilizer = fmaxf(stabilizer, fabsf(matColumns[i].x));
27092709
stabilizer = fmaxf(stabilizer, fabsf(matColumns[i].y));
27102710
stabilizer = fmaxf(stabilizer, fabsf(matColumns[i].z));
2711-
};
2711+
}
27122712
matColumns[0] = Vector3Scale(matColumns[0], 1.0f / stabilizer);
27132713
matColumns[1] = Vector3Scale(matColumns[1], 1.0f / stabilizer);
27142714
matColumns[2] = Vector3Scale(matColumns[2], 1.0f / stabilizer);

src/rcore.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -529,22 +529,6 @@ const char *TextFormat(const char *text, ...); // Formatting of text with variab
529529
#define PLATFORM_DESKTOP_GLFW
530530
#endif
531531

532-
// Using '#pragma message' because '#warning' is not adopted by MSVC
533-
#if SUPPORT_CLIPBOARD_IMAGE
534-
#if !SUPPORT_MODULE_RTEXTURES
535-
#pragma message ("WARNING: Enabling SUPPORT_CLIPBOARD_IMAGE requires SUPPORT_MODULE_RTEXTURES to work properly")
536-
#endif
537-
538-
// It's nice to have support Bitmap on Linux as well, but not as necessary as Windows
539-
#if !SUPPORT_FILEFORMAT_BMP && defined(_WIN32)
540-
#pragma message ("WARNING: Enabling SUPPORT_CLIPBOARD_IMAGE requires SUPPORT_FILEFORMAT_BMP, specially on Windows")
541-
#endif
542-
543-
// From what I've tested applications on Wayland saves images on clipboard as PNG
544-
#if (!SUPPORT_FILEFORMAT_PNG || !SUPPORT_FILEFORMAT_JPG) && !defined(_WIN32)
545-
#pragma message ("WARNING: Getting image from the clipboard might not work without SUPPORT_FILEFORMAT_PNG or SUPPORT_FILEFORMAT_JPG")
546-
#endif
547-
#endif
548532

549533
// Include platform-specific submodules
550534
#if defined(PLATFORM_DESKTOP_GLFW)

0 commit comments

Comments
 (0)