diff --git a/src/external/rlsw.h b/src/external/rlsw.h index bb6e11679..6ca1cecf1 100644 --- a/src/external/rlsw.h +++ b/src/external/rlsw.h @@ -4307,8 +4307,8 @@ void swScissor(int x, int y, int width, int height) RLSW.scClipMin[0] = (2.0f*(float)RLSW.scMin[0]/(float)RLSW.vpSize[0]) - 1.0f; RLSW.scClipMax[0] = (2.0f*(float)RLSW.scMax[0]/(float)RLSW.vpSize[0]) - 1.0f; - RLSW.scClipMax[1] = 1.0f - (2.0f*(float)RLSW.scMin[1]/(float)RLSW.vpSize[1]); - RLSW.scClipMin[1] = 1.0f - (2.0f*(float)RLSW.scMax[1]/(float)RLSW.vpSize[1]); + RLSW.scClipMin[1] = (2.0f*(float)RLSW.scMin[1]/(float)RLSW.vpSize[1]) - 1.0f; + RLSW.scClipMax[1] = (2.0f*(float)RLSW.scMax[1]/(float)RLSW.vpSize[1]) - 1.0f; } void swClearColor(float r, float g, float b, float a) diff --git a/src/platforms/rcore_desktop_sdl.c b/src/platforms/rcore_desktop_sdl.c index f51eedd97..0936dda0e 100644 --- a/src/platforms/rcore_desktop_sdl.c +++ b/src/platforms/rcore_desktop_sdl.c @@ -1255,12 +1255,14 @@ Image GetClipboardImage(void) for (int i = 0; i < SDL_arraysize(imageFormats); i++) { - // NOTE: This pointer should be free with SDL_free() at some point fileData = SDL_GetClipboardData(imageFormats[i], &dataSize); if (fileData) { image = LoadImageFromMemory(imageExtensions[i], fileData, (int)dataSize); + + SDL_free(fileData); + if (IsImageValid(image)) { TRACELOG(LOG_INFO, "Clipboard: Got image from clipboard successfully: %s", imageExtensions[i]); diff --git a/src/rtext.c b/src/rtext.c index 35c6f7307..248857975 100644 --- a/src/rtext.c +++ b/src/rtext.c @@ -1699,7 +1699,7 @@ const char *TextSubtext(const char *text, int position, int length) static char buffer[MAX_TEXT_BUFFER_LENGTH] = { 0 }; memset(buffer, 0, MAX_TEXT_BUFFER_LENGTH); - if ((text != NULL) && (position > 0) && (length > 0)) + if ((text != NULL) && (position >= 0) && (length > 0)) { int textLength = TextLength(text); diff --git a/src/rtextures.c b/src/rtextures.c index b33ab5c50..850161548 100644 --- a/src/rtextures.c +++ b/src/rtextures.c @@ -1231,9 +1231,9 @@ Image ImageFromImage(Image image, Rectangle rec) Image result = { 0 }; // Basic rectangle validation: size smaller than image size - if ((rec.x > 0) && (rec.y > 0) && (rec.width > 0) && (rec.height > 0) && - (((int)rec.x + (int)rec.width) < image.width) && - (((int)rec.y + (int)rec.height) < image.height)) + if ((rec.x >= 0) && (rec.y >= 0) && (rec.width > 0) && (rec.height > 0) && + (((int)rec.x + (int)rec.width) <= image.width) && + (((int)rec.y + (int)rec.height) <= image.height)) { int bytesPerPixel = GetPixelDataSize(1, 1, image.format);