7 Commits

Author SHA1 Message Date
Ray
4640c84920 WARNING: Not updating mouse.previousPosition when SeMousePosition() #5962
This could be a sensible change, not sure if it can break anything...
2026-07-13 19:32:30 +02:00
Ray
af98e3126e Merge branch 'master' of https://github.com/raysan5/raylib 2026-07-13 19:25:08 +02:00
Ray
e063385c47 Fix #5965 2026-07-13 19:24:49 +02:00
7a247ff40f Fix swScissor() Y-axis clipping inversion in software renderer (#5976) 2026-07-13 19:19:02 +02:00
5de8c3521f fix: ImageFromImage rectangle validation use >= and <= (#5979) 2026-07-13 15:13:12 +02:00
b631fb3d05 Fix TextSubtext() returning empty string when position is 0 (#5975) 2026-07-13 15:11:42 +02:00
fb4649a3fe [rcore][desktop] Fix clipboard image memory leak (#5968)
* [rcore][desktop] Fix clipboard image memory leak

* [delete] delete comment GetClipboardImage into  NOTE about where put SDL_free() .
2026-07-13 15:10:27 +02:00
15 changed files with 14 additions and 20 deletions

View File

@ -99,7 +99,7 @@ vec3 ComputePBR()
vec3 N = normalize(fragNormal); vec3 N = normalize(fragNormal);
if (useTexNormal == 1) if (useTexNormal == 1)
{ {
N = texture2D(normalMap, vec2(fragTexCoord.x*tiling.x + offset.y, fragTexCoord.y*tiling.y + offset.y)).rgb; N = texture2D(normalMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y)).rgb;
N = normalize(N*2.0 - 1.0); N = normalize(N*2.0 - 1.0);
N = normalize(N*TBN); N = normalize(N*TBN);
} }

View File

@ -97,7 +97,7 @@ vec3 ComputePBR()
vec3 N = normalize(fragNormal); vec3 N = normalize(fragNormal);
if (useTexNormal == 1) if (useTexNormal == 1)
{ {
N = texture2D(normalMap, vec2(fragTexCoord.x*tiling.x + offset.y, fragTexCoord.y*tiling.y + offset.y)).rgb; N = texture2D(normalMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y)).rgb;
N = normalize(N*2.0 - 1.0); N = normalize(N*2.0 - 1.0);
N = normalize(N*TBN); N = normalize(N*TBN);
} }

View File

@ -100,7 +100,7 @@ vec3 ComputePBR()
vec3 N = normalize(fragNormal); vec3 N = normalize(fragNormal);
if (useTexNormal == 1) if (useTexNormal == 1)
{ {
N = texture(normalMap, vec2(fragTexCoord.x*tiling.x + offset.y, fragTexCoord.y*tiling.y + offset.y)).rgb; N = texture(normalMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y)).rgb;
N = normalize(N*2.0 - 1.0); N = normalize(N*2.0 - 1.0);
N = normalize(N*TBN); N = normalize(N*TBN);
} }

4
src/external/rlsw.h vendored
View File

@ -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.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[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] = (2.0f*(float)RLSW.scMin[1]/(float)RLSW.vpSize[1]) - 1.0f;
RLSW.scClipMin[1] = 1.0f - (2.0f*(float)RLSW.scMax[1]/(float)RLSW.vpSize[1]); 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) void swClearColor(float r, float g, float b, float a)

View File

@ -726,7 +726,6 @@ void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float d
void SetMousePosition(int x, int y) void SetMousePosition(int x, int y)
{ {
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y }; CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
CORE.Input.Mouse.previousPosition = CORE.Input.Mouse.currentPosition;
} }
// Set mouse cursor // Set mouse cursor

View File

@ -1237,7 +1237,6 @@ void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float d
void SetMousePosition(int x, int y) void SetMousePosition(int x, int y)
{ {
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y }; CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
CORE.Input.Mouse.previousPosition = CORE.Input.Mouse.currentPosition;
// NOTE: emscripten not implemented // NOTE: emscripten not implemented
glfwSetCursorPos(platform.handle, CORE.Input.Mouse.currentPosition.x, CORE.Input.Mouse.currentPosition.y); glfwSetCursorPos(platform.handle, CORE.Input.Mouse.currentPosition.x, CORE.Input.Mouse.currentPosition.y);

View File

@ -1526,7 +1526,6 @@ void SetMousePosition(int x, int y)
{ {
RGFW_window_moveMouse(platform.window, x, y); RGFW_window_moveMouse(platform.window, x, y);
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y }; CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
CORE.Input.Mouse.previousPosition = CORE.Input.Mouse.currentPosition;
} }
// Set mouse cursor // Set mouse cursor

View File

@ -1255,12 +1255,14 @@ Image GetClipboardImage(void)
for (int i = 0; i < SDL_arraysize(imageFormats); i++) 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); fileData = SDL_GetClipboardData(imageFormats[i], &dataSize);
if (fileData) if (fileData)
{ {
image = LoadImageFromMemory(imageExtensions[i], fileData, (int)dataSize); image = LoadImageFromMemory(imageExtensions[i], fileData, (int)dataSize);
SDL_free(fileData);
if (IsImageValid(image)) if (IsImageValid(image))
{ {
TRACELOG(LOG_INFO, "Clipboard: Got image from clipboard successfully: %s", imageExtensions[i]); TRACELOG(LOG_INFO, "Clipboard: Got image from clipboard successfully: %s", imageExtensions[i]);
@ -1409,7 +1411,6 @@ void SetMousePosition(int x, int y)
SDL_WarpMouseInWindow(platform.window, x, y); SDL_WarpMouseInWindow(platform.window, x, y);
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y }; CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
CORE.Input.Mouse.previousPosition = CORE.Input.Mouse.currentPosition;
} }
// Set mouse cursor // Set mouse cursor

View File

@ -1299,8 +1299,8 @@ void SetMousePosition(int x, int y)
if (!CORE.Input.Mouse.cursorLocked) if (!CORE.Input.Mouse.cursorLocked)
{ {
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y }; CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
CORE.Input.Mouse.previousPosition = CORE.Input.Mouse.currentPosition;
TRACELOG(LOG_WARNING, "SetMousePosition not implemented"); TRACELOG(LOG_WARNING, "SetMousePosition not implemented at platform level");
} }
else TRACELOG(LOG_WARNING, "INPUT: MOUSE: Cursor not enabled"); else TRACELOG(LOG_WARNING, "INPUT: MOUSE: Cursor not enabled");
} }

View File

@ -1042,7 +1042,6 @@ void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float d
void SetMousePosition(int x, int y) void SetMousePosition(int x, int y)
{ {
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y }; CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
CORE.Input.Mouse.previousPosition = CORE.Input.Mouse.currentPosition;
} }
// Set mouse cursor // Set mouse cursor

View File

@ -420,7 +420,6 @@ void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float d
void SetMousePosition(int x, int y) void SetMousePosition(int x, int y)
{ {
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y }; CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
CORE.Input.Mouse.previousPosition = CORE.Input.Mouse.currentPosition;
} }
// Set mouse cursor // Set mouse cursor

View File

@ -395,7 +395,6 @@ void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float d
void SetMousePosition(int x, int y) void SetMousePosition(int x, int y)
{ {
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y }; CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
CORE.Input.Mouse.previousPosition = CORE.Input.Mouse.currentPosition;
} }
// Set mouse cursor // Set mouse cursor

View File

@ -1047,7 +1047,6 @@ void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float d
void SetMousePosition(int x, int y) void SetMousePosition(int x, int y)
{ {
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y }; CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
CORE.Input.Mouse.previousPosition = CORE.Input.Mouse.currentPosition;
if (CORE.Input.Mouse.cursorLocked) CORE.Input.Mouse.lockedPosition = CORE.Input.Mouse.currentPosition; if (CORE.Input.Mouse.cursorLocked) CORE.Input.Mouse.lockedPosition = CORE.Input.Mouse.currentPosition;

View File

@ -1699,7 +1699,7 @@ const char *TextSubtext(const char *text, int position, int length)
static char buffer[MAX_TEXT_BUFFER_LENGTH] = { 0 }; static char buffer[MAX_TEXT_BUFFER_LENGTH] = { 0 };
memset(buffer, 0, MAX_TEXT_BUFFER_LENGTH); 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); int textLength = TextLength(text);

View File

@ -1231,9 +1231,9 @@ Image ImageFromImage(Image image, Rectangle rec)
Image result = { 0 }; Image result = { 0 };
// Basic rectangle validation: size smaller than image size // Basic rectangle validation: size smaller than image size
if ((rec.x > 0) && (rec.y > 0) && (rec.width > 0) && (rec.height > 0) && if ((rec.x >= 0) && (rec.y >= 0) && (rec.width > 0) && (rec.height > 0) &&
(((int)rec.x + (int)rec.width) < image.width) && (((int)rec.x + (int)rec.width) <= image.width) &&
(((int)rec.y + (int)rec.height) < image.height)) (((int)rec.y + (int)rec.height) <= image.height))
{ {
int bytesPerPixel = GetPixelDataSize(1, 1, image.format); int bytesPerPixel = GetPixelDataSize(1, 1, image.format);