소스 검색

(video) fix SDL_GetClosestFullscreenDisplayMode aspect ratio & refresh rate picking logic

som3a-dev 4 주 전
부모
커밋
0231ff03de
1개의 변경된 파일4개의 추가작업 그리고 4개의 파일을 삭제
  1. 4 4
      src/video/SDL_video.c

+ 4 - 4
src/video/SDL_video.c

@@ -1416,14 +1416,14 @@ bool SDL_GetClosestFullscreenDisplayMode(SDL_DisplayID displayID, int w, int h,
         if (closest) {
         if (closest) {
             float current_aspect_ratio = (float)mode->w / mode->h;
             float current_aspect_ratio = (float)mode->w / mode->h;
             float closest_aspect_ratio = (float)closest->w / closest->h;
             float closest_aspect_ratio = (float)closest->w / closest->h;
-            if (SDL_fabsf(aspect_ratio - closest_aspect_ratio) < SDL_fabsf(aspect_ratio - current_aspect_ratio)) {
-                // The mode we already found has a better aspect ratio match
+            if (SDL_fabsf(aspect_ratio - closest_aspect_ratio) <= SDL_fabsf(aspect_ratio - current_aspect_ratio)) {
+                // The mode we already found has a similar or better aspect ratio match
                 continue;
                 continue;
             }
             }
 
 
             if (mode->w == closest->w && mode->h == closest->h &&
             if (mode->w == closest->w && mode->h == closest->h &&
-                SDL_fabsf(closest->refresh_rate - refresh_rate) < SDL_fabsf(mode->refresh_rate - refresh_rate)) {
-                /* We already found a mode and the new mode is further from our
+                SDL_fabsf(closest->refresh_rate - refresh_rate) <= SDL_fabsf(mode->refresh_rate - refresh_rate)) {
+                /* We already found a mode and the new mode's refresh rate is the same or is further away from our
                  * refresh rate target */
                  * refresh rate target */
                 continue;
                 continue;
             }
             }