From 9eb400aa1b441e3d6b00abb068a18203a10adff4 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Wed, 25 Sep 2024 23:56:14 +0300
Subject: [PATCH] update after [Get|Set]RenderLogicalPresentation changes in
SDL3.
---
src/sdl2_compat.c | 21 ++++++++++-----------
src/sdl3_syms.h | 4 ++--
2 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index 8bbbab1..9eb9aa1 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -1353,7 +1353,7 @@ Event3to2(const SDL_Event *event3, SDL2_Event *event2)
renderer = SDL3_GetRenderer(SDL3_GetWindowFromID(event3->motion.windowID));
if (renderer) {
SDL_RendererLogicalPresentation mode = SDL_LOGICAL_PRESENTATION_DISABLED;
- SDL3_GetRenderLogicalPresentation(renderer, NULL, NULL, &mode, NULL);
+ SDL3_GetRenderLogicalPresentation(renderer, NULL, NULL, &mode);
if (mode != SDL_LOGICAL_PRESENTATION_DISABLED) {
SDL3_memcpy(&cvtevent3, event3, sizeof (SDL_Event));
SDL3_ConvertEventToRenderCoordinates(renderer, &cvtevent3);
@@ -1370,7 +1370,7 @@ Event3to2(const SDL_Event *event3, SDL2_Event *event2)
renderer = SDL3_GetRenderer(SDL3_GetWindowFromID(event3->button.windowID));
if (renderer) {
SDL_RendererLogicalPresentation mode = SDL_LOGICAL_PRESENTATION_DISABLED;
- SDL3_GetRenderLogicalPresentation(renderer, NULL, NULL, &mode, NULL);
+ SDL3_GetRenderLogicalPresentation(renderer, NULL, NULL, &mode);
if (mode != SDL_LOGICAL_PRESENTATION_DISABLED) {
SDL3_memcpy(&cvtevent3, event3, sizeof (SDL_Event));
SDL3_ConvertEventToRenderCoordinates(renderer, &cvtevent3);
@@ -1384,7 +1384,7 @@ Event3to2(const SDL_Event *event3, SDL2_Event *event2)
renderer = SDL3_GetRenderer(SDL3_GetWindowFromID(event3->wheel.windowID));
if (renderer) {
SDL_RendererLogicalPresentation mode = SDL_LOGICAL_PRESENTATION_DISABLED;
- SDL3_GetRenderLogicalPresentation(renderer, NULL, NULL, &mode, NULL);
+ SDL3_GetRenderLogicalPresentation(renderer, NULL, NULL, &mode);
if (mode != SDL_LOGICAL_PRESENTATION_DISABLED) {
SDL3_memcpy(&cvtevent3, event3, sizeof (SDL_Event));
SDL3_ConvertEventToRenderCoordinates(renderer, &cvtevent3);
@@ -4407,9 +4407,9 @@ SDL_RenderSetLogicalSize(SDL_Renderer *renderer, int w, int h)
{
int retval;
if (w == 0 && h == 0) {
- retval = SDL3_SetRenderLogicalPresentation(renderer, 0, 0, SDL_LOGICAL_PRESENTATION_DISABLED, SDL_SCALEMODE_NEAREST) ? 0 : -1;
+ retval = SDL3_SetRenderLogicalPresentation(renderer, 0, 0, SDL_LOGICAL_PRESENTATION_DISABLED) ? 0 : -1;
} else {
- retval = SDL3_SetRenderLogicalPresentation(renderer, w, h, SDL_LOGICAL_PRESENTATION_LETTERBOX, SDL_SCALEMODE_LINEAR) ? 0 : -1;
+ retval = SDL3_SetRenderLogicalPresentation(renderer, w, h, SDL_LOGICAL_PRESENTATION_LETTERBOX) ? 0 : -1;
}
return retval < 0 ? retval : FlushRendererIfNotBatching(renderer);
}
@@ -4417,18 +4417,17 @@ SDL_RenderSetLogicalSize(SDL_Renderer *renderer, int w, int h)
SDL_DECLSPEC void SDLCALL
SDL_RenderGetLogicalSize(SDL_Renderer *renderer, int *w, int *h)
{
- SDL3_GetRenderLogicalPresentation(renderer, w, h, NULL, NULL);
+ SDL3_GetRenderLogicalPresentation(renderer, w, h, NULL);
}
SDL_DECLSPEC int SDLCALL
SDL_RenderSetIntegerScale(SDL_Renderer *renderer, SDL2_bool enable)
{
- SDL_ScaleMode scale_mode;
SDL_RendererLogicalPresentation mode;
int w, h;
int retval;
- retval = SDL3_GetRenderLogicalPresentation(renderer, &w, &h, &mode, &scale_mode) ? 0 : -1;
+ retval = SDL3_GetRenderLogicalPresentation(renderer, &w, &h, &mode) ? 0 : -1;
if (retval < 0) {
return retval;
}
@@ -4442,9 +4441,9 @@ SDL_RenderSetIntegerScale(SDL_Renderer *renderer, SDL2_bool enable)
}
if (enable) {
- retval = SDL3_SetRenderLogicalPresentation(renderer, w, h, SDL_LOGICAL_PRESENTATION_INTEGER_SCALE, scale_mode) ? 0 : -1;
+ retval = SDL3_SetRenderLogicalPresentation(renderer, w, h, SDL_LOGICAL_PRESENTATION_INTEGER_SCALE) ? 0 : -1;
} else {
- retval = SDL3_SetRenderLogicalPresentation(renderer, w, h, SDL_LOGICAL_PRESENTATION_DISABLED, scale_mode) ? 0 : -1;
+ retval = SDL3_SetRenderLogicalPresentation(renderer, w, h, SDL_LOGICAL_PRESENTATION_DISABLED) ? 0 : -1;
}
return retval < 0 ? retval : FlushRendererIfNotBatching(renderer);
}
@@ -4453,7 +4452,7 @@ SDL_DECLSPEC SDL2_bool SDLCALL
SDL_RenderGetIntegerScale(SDL_Renderer *renderer)
{
SDL_RendererLogicalPresentation mode;
- if (SDL3_GetRenderLogicalPresentation(renderer, NULL, NULL, &mode, NULL)) {
+ if (SDL3_GetRenderLogicalPresentation(renderer, NULL, NULL, &mode)) {
if (mode == SDL_LOGICAL_PRESENTATION_INTEGER_SCALE) {
return SDL2_TRUE;
}
diff --git a/src/sdl3_syms.h b/src/sdl3_syms.h
index 641ad48..87de593 100644
--- a/src/sdl3_syms.h
+++ b/src/sdl3_syms.h
@@ -353,7 +353,7 @@ SDL3_SYM(bool,GetRenderClipRect,(SDL_Renderer *a, SDL_Rect *b),(a,b),return)
SDL3_SYM_PASSTHROUGH_RETCODE(bool,GetRenderDrawBlendMode,(SDL_Renderer *a, SDL_BlendMode *b),(a,b),return)
SDL3_SYM_PASSTHROUGH_RETCODE(bool,GetRenderDrawColor,(SDL_Renderer *a, Uint8 *b, Uint8 *c, Uint8 *d, Uint8 *e),(a,b,c,d,e),return)
SDL3_SYM(const char *,GetRenderDriver,(int a),(a),return);
-SDL3_SYM(bool,GetRenderLogicalPresentation,(SDL_Renderer *a, int *b, int *c, SDL_RendererLogicalPresentation *d, SDL_ScaleMode *e),(a,b,c,d,e),return)
+SDL3_SYM(bool,GetRenderLogicalPresentation,(SDL_Renderer *a, int *b, int *c, SDL_RendererLogicalPresentation *d),(a,b,c,d),return)
SDL3_SYM(bool,GetRenderScale,(SDL_Renderer *a, float *b, float *c),(a,b,c),return)
SDL3_SYM_PASSTHROUGH(SDL_Texture*,GetRenderTarget,(SDL_Renderer *a),(a),return)
SDL3_SYM(bool,GetRenderViewport,(SDL_Renderer *a, SDL_Rect *b),(a,b),return)
@@ -626,7 +626,7 @@ SDL3_SYM_PASSTHROUGH_RETCODE(bool,SetPrimarySelectionText,(const char *a),(a),re
SDL3_SYM(bool,SetRenderClipRect,(SDL_Renderer *a, const SDL_Rect *b),(a,b),return)
SDL3_SYM_PASSTHROUGH_RETCODE(bool,SetRenderDrawBlendMode,(SDL_Renderer *a, SDL_BlendMode b),(a,b),return)
SDL3_SYM_PASSTHROUGH_RETCODE(bool,SetRenderDrawColor,(SDL_Renderer *a, Uint8 b, Uint8 c, Uint8 d, Uint8 e),(a,b,c,d,e),return)
-SDL3_SYM(bool,SetRenderLogicalPresentation,(SDL_Renderer *a, int b, int c, SDL_RendererLogicalPresentation d, SDL_ScaleMode e),(a,b,c,d,e),return)
+SDL3_SYM(bool,SetRenderLogicalPresentation,(SDL_Renderer *a, int b, int c, SDL_RendererLogicalPresentation d),(a,b,c,d),return)
SDL3_SYM_PASSTHROUGH_RETCODE(bool,SetRenderTarget,(SDL_Renderer *a, SDL_Texture *b),(a,b),return)
SDL3_SYM(bool,SetRenderViewport,(SDL_Renderer *a, const SDL_Rect *b),(a,b),return)
SDL3_SYM(bool,SetStringProperty,(SDL_PropertiesID a, const char *b, const char *c),(a,b,c),return)