sdl2-compat: update for SDL_DisplayMode after SDL3 side changes

From c40688188d2efa45a97c7efab3b50a7ef72352f6 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Wed, 25 Jan 2023 23:40:02 +0300
Subject: [PATCH] update for SDL_DisplayMode after SDL3 side changes

See https://github.com/libsdl-org/SDL/pull/7148
---
 src/sdl2_compat.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index 892be6a..e5e8676 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -3211,6 +3211,7 @@ DisplayMode_2to3(const SDL2_DisplayMode *in, SDL_DisplayMode *out) {
         out->w = in->w;
         out->h = in->h;
         out->refresh_rate = (float) in->refresh_rate;
+        out->display_scale = 1.0f;
         out->driverdata = in->driverdata;
     }
 }
@@ -3219,8 +3220,8 @@ static void
 DisplayMode_3to2(const SDL_DisplayMode *in, SDL2_DisplayMode *out) {
     if (in && out) {
         out->format = in->format;
-        out->w = in->w;
-        out->h = in->h;
+        out->w = SDL3_lroundf(in->w / in->display_scale);
+        out->h = SDL3_lroundf(in->h / in->display_scale);
         out->refresh_rate = (int) SDL_ceil(in->refresh_rate);
         out->driverdata = in->driverdata;
     }