diff src/video/SDL_video.c @ 5171:db487f28419e

Fixed recursion crash when setting SDL_VIDEO_RENDERER=software
author Sam Lantinga <slouken@libsdl.org>
date Thu, 03 Feb 2011 17:42:58 -0800
parents 4d39eeaad00b
children ededa1ccf91c
line wrap: on
line diff
--- a/src/video/SDL_video.c	Thu Feb 03 16:57:38 2011 -0800
+++ b/src/video/SDL_video.c	Thu Feb 03 17:42:58 2011 -0800
@@ -126,7 +126,19 @@
 
     renderer = data->renderer;
     if (!renderer) {
-        renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
+        SDL_RendererInfo info;
+        int i;
+
+        /* We need to make sure we don't get a software renderer */
+        for (i = 0; i < SDL_GetNumRenderDrivers(); ++i) {
+            SDL_GetRenderDriverInfo(i, &info);
+            if (SDL_strcmp(info.name, "software") != 0) {
+                renderer = SDL_CreateRenderer(window, i, 0);
+                if (renderer) {
+                    break;
+                }
+            }
+        }
         if (!renderer) {
             return -1;
         }