diff src/video/SDL_video.c @ 1905:36d52b1f0504

Prefer the D3D renderer over GDI, at least for testing. Added support for the SDL_VIDEO_RENDERER environment variable to pick the desired render driver. Implemented WritePixels support for the D3D renderer.
author Sam Lantinga <slouken@libsdl.org>
date Fri, 14 Jul 2006 08:22:45 +0000
parents c2a27da60b18
children 06c27a737b7a
line wrap: on
line diff
--- a/src/video/SDL_video.c	Fri Jul 14 07:41:16 2006 +0000
+++ b/src/video/SDL_video.c	Fri Jul 14 08:22:45 2006 +0000
@@ -1296,18 +1296,25 @@
     }
 
     if (index < 0) {
+        const char *override = SDL_getenv("SDL_VIDEO_RENDERER");
         int n = SDL_GetNumRenderers();
         for (index = 0; index < n; ++index) {
             SDL_RenderDriver *driver =
                 &SDL_CurrentDisplay.render_drivers[index];
 
-            /* Skip minimal drivers in automatic scans */
-            if (!(flags & SDL_Renderer_Minimal)
-                && (driver->info.flags & SDL_Renderer_Minimal)) {
-                continue;
-            }
-            if ((driver->info.flags & flags) == flags) {
-                break;
+            if (override) {
+                if (SDL_strcasecmp(override, driver->info.name) == 0) {
+                    break;
+                }
+            } else {
+                /* Skip minimal drivers in automatic scans */
+                if (!(flags & SDL_Renderer_Minimal)
+                    && (driver->info.flags & SDL_Renderer_Minimal)) {
+                    continue;
+                }
+                if ((driver->info.flags & flags) == flags) {
+                    break;
+                }
             }
         }
         if (index == n) {