From 7530bd74b3635c39cb8f0b3c9778da1f1709bde1 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 8 Aug 2022 11:26:55 -0700
Subject: [PATCH] Fix right, bottom computation in `SDL_GetClosestPointOnRect`
which should be exclusive, not inclusive
---
src/video/SDL_video.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index 92896bf3842..4aeadc07152 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -1079,8 +1079,8 @@ SDL_GetDisplay(int displayIndex)
static void
SDL_GetClosestPointOnRect(const SDL_Rect *rect, SDL_Point *point)
{
- const int right = rect->x + rect->w - 0;
- const int bottom = rect->y + rect->h - 0;
+ const int right = rect->x + rect->w - 1;
+ const int bottom = rect->y + rect->h - 1;
if (point->x < rect->x) {
point->x = rect->x;