[Commits] SDL: Fixed bug 3981 - Inverted logic bug in SDL_renderer "oversc...

libsdl.org revision control commits-owner at libsdl.org
Tue Dec 12 16:34:19 PST 2017


details:   https://hg.libsdl.org/SDL/rev/cb68160b3ace
changeset: 11771:cb68160b3ace
user:      Sam Lantinga <slouken at libsdl.org>
date:      Tue Dec 12 16:34:16 2017 -0800
description:
Fixed bug 3981 - Inverted logic bug in SDL_renderer "overscan" feature

Eric wing

There is a tiny bug in the new overscan code for the SDL_renderer.

In SDL_renderer.c, line 1265, the if check for SDL_strcasecmp with "direct3d" needs to be inverted.

Instead of:
if(SDL_strcasecmp("direct3d", SDL_GetCurrentVideoDriver())) {

It should be:
if(0 == SDL_strcasecmp("direct3d", SDL_GetCurrentVideoDriver())) {

This bug causes the "overscan" mode to pretty much be completely ignored in all cases and all things remain letterboxed (as before the feature).

diffstat:

 src/render/SDL_render.c |  25 +++++++++++--------------
 1 files changed, 11 insertions(+), 14 deletions(-)

diffs (46 lines):

diff -r 58a69c196061 -r cb68160b3ace src/render/SDL_render.c
--- a/src/render/SDL_render.c	Tue Dec 12 16:25:43 2017 -0800
+++ b/src/render/SDL_render.c	Tue Dec 12 16:34:16 2017 -0800
@@ -1248,7 +1248,7 @@
     SDL_Rect viewport;
     /* 0 is for letterbox, 1 is for overscan */
     int scale_policy = 0;
-    const char *hint = SDL_GetHint(SDL_HINT_RENDER_LOGICAL_SIZE_MODE);
+    const char *hint;
 
     if (!renderer->logical_w || !renderer->logical_h) {
         return 0;
@@ -1257,23 +1257,20 @@
         return -1;
     }
 
-    if (!hint) {
-        scale_policy = 0;
-    } else if ( *hint == '1' || SDL_strcasecmp(hint, "overscan") == 0)  {
-        /* Unfortunately, Direct3D 9 does't support negative viewport numbers
-        which the main overscan implementation relies on.
-        D3D11 does support negative values and uses a different id string
-        so overscan will work for D3D11.
+    hint = SDL_GetHint(SDL_HINT_RENDER_LOGICAL_SIZE_MODE);
+    if (hint && (*hint == '1' || SDL_strcasecmp(hint, "overscan") == 0))  {
+        SDL_bool overscan_supported = SDL_TRUE;
+        /* Unfortunately, Direct3D 9 doesn't support negative viewport numbers
+           which the overscan implementation relies on.
         */
-        if(SDL_strcasecmp("direct3d", SDL_GetCurrentVideoDriver())) {
-            scale_policy = 0;
-        } else {
+        if (SDL_strcasecmp(SDL_GetCurrentVideoDriver(), "direct3d") == 0) {
+            overscan_supported = SDL_FALSE;
+        }
+        if (overscan_supported) {
             scale_policy = 1;
         }
-    } else {
-        scale_policy = 0;
     }
-    
+
     want_aspect = (float)renderer->logical_w / renderer->logical_h;
     real_aspect = (float)w / h;
 


More information about the commits mailing list