mirror of
https://github.com/raysan5/raylib.git
synced 2026-04-10 01:09:10 -04:00
Compare commits
2 Commits
178aca0fd0
...
f583674327
| Author | SHA1 | Date | |
|---|---|---|---|
| f583674327 | |||
| 28e40d502a |
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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[] = {
|
||||
|
||||
@ -858,14 +858,15 @@ Image GenImageFontAtlas(const GlyphInfo *glyphs, Rectangle **glyphRecs, int glyp
|
||||
if (offsetY > (atlas.height - fontSize - padding))
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "FONT: Updating atlas size to fit all characters");
|
||||
|
||||
// TODO: Increment atlas size (atlas.height*2) and continue adding glyphs
|
||||
|
||||
// Update atlas size to fit all characters
|
||||
int updatedAtlasHeight = atlas.height*2;
|
||||
int updatedAtlasDataSize = atlas.width*atlas.height;
|
||||
int updatedAtlasDataSize = atlas.width*updatedAtlasHeight;
|
||||
unsigned char *updatedAtlasData = (unsigned char *)RL_CALLOC(updatedAtlasDataSize, 1);
|
||||
|
||||
memcpy(updatedAtlasData, atlas.data, atlasDataSize);
|
||||
RL_FREE(atlas.data);
|
||||
atlas.data = updatedAtlasData;
|
||||
atlas.height = updatedAtlasHeight;
|
||||
atlasDataSize = updatedAtlasDataSize;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user