Fixed calls to SDL_AddRenderDriver()
authorSam Lantinga <slouken@libsdl.org>
Fri, 04 Dec 2009 08:45:08 +0000
changeset 3520 83518f8fcd61
parent 3519 1374f9275de9
child 3521 76f9b76ddf0f
Fixed calls to SDL_AddRenderDriver()
src/video/SDL_renderer_gl.c
src/video/SDL_renderer_gles.c
src/video/directfb/SDL_DirectFB_render.c
src/video/dummy/SDL_nullvideo.c
src/video/nds/SDL_ndsvideo.c
src/video/ps3/SDL_ps3video.c
src/video/win32/SDL_ceddrawrender.c
src/video/win32/SDL_d3drender.c
src/video/win32/SDL_gapirender.c
src/video/win32/SDL_gdirender.c
src/video/x11/SDL_x11render.c
--- a/src/video/SDL_renderer_gl.c	Fri Dec 04 08:26:32 2009 +0000
+++ b/src/video/SDL_renderer_gl.c	Fri Dec 04 08:45:08 2009 +0000
@@ -257,14 +257,6 @@
     return 0;
 }
 
-void
-GL_AddRenderDriver(_THIS)
-{
-    if (_this->GL_CreateContext) {
-        SDL_AddRenderDriver(0, &GL_RenderDriver);
-    }
-}
-
 SDL_Renderer *
 GL_CreateRenderer(SDL_Window * window, Uint32 flags)
 {
--- a/src/video/SDL_renderer_gles.c	Fri Dec 04 08:26:32 2009 +0000
+++ b/src/video/SDL_renderer_gles.c	Fri Dec 04 08:45:08 2009 +0000
@@ -200,14 +200,6 @@
     return 0;
 }
 
-void
-GLES_AddRenderDriver(_THIS)
-{
-    if (_this->GL_CreateContext) {
-        SDL_AddRenderDriver(0, &GL_ES_RenderDriver);
-    }
-}
-
 SDL_Renderer *
 GLES_CreateRenderer(SDL_Window * window, Uint32 flags)
 {
--- a/src/video/directfb/SDL_DirectFB_render.c	Fri Dec 04 08:26:32 2009 +0000
+++ b/src/video/directfb/SDL_DirectFB_render.c	Fri Dec 04 08:45:08 2009 +0000
@@ -233,8 +233,10 @@
 DirectFB_AddRenderDriver(_THIS)
 {
     int i;
-    for (i = 0; i < _this->num_displays; i++)
+
+    for (i = 0; i < _this->num_displays; ++i) {
         SDL_AddRenderDriver(&_this->displays[i], &DirectFB_RenderDriver);
+    }
 }
 
 static int
--- a/src/video/dummy/SDL_nullvideo.c	Fri Dec 04 08:26:32 2009 +0000
+++ b/src/video/dummy/SDL_nullvideo.c	Fri Dec 04 08:45:08 2009 +0000
@@ -50,7 +50,7 @@
 
 /* Initialization/Query functions */
 static int DUMMY_VideoInit(_THIS);
-static int DUMMY_SetDisplayMode(_THIS, SDL_DisplayMode * mode);
+static int DUMMY_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
 static void DUMMY_VideoQuit(_THIS);
 
 /* DUMMY driver bootstrap functions */
@@ -115,8 +115,10 @@
     mode.h = 768;
     mode.refresh_rate = 0;
     mode.driverdata = NULL;
-    SDL_AddBasicVideoDisplay(&mode);
-    SDL_AddRenderDriver(0, &SDL_DUMMY_RenderDriver);
+    if (SDL_AddBasicVideoDisplay(&mode) < 0) {
+        return -1;
+    }
+    SDL_AddRenderDriver(&_this->displays[0], &SDL_DUMMY_RenderDriver);
 
     SDL_zero(mode);
     SDL_AddDisplayMode(0, &mode);
@@ -126,7 +128,7 @@
 }
 
 static int
-DUMMY_SetDisplayMode(_THIS, SDL_DisplayMode * mode)
+DUMMY_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
 {
     return 0;
 }
--- a/src/video/nds/SDL_ndsvideo.c	Fri Dec 04 08:26:32 2009 +0000
+++ b/src/video/nds/SDL_ndsvideo.c	Fri Dec 04 08:45:08 2009 +0000
@@ -110,8 +110,10 @@
     mode.refresh_rate = 60;
     mode.driverdata = NULL;
 
-    SDL_AddBasicVideoDisplay(&mode);
-    SDL_AddRenderDriver(0, &NDS_RenderDriver);
+    if (SDL_AddBasicVideoDisplay(&mode) < 0) {
+        return -1;
+    }
+    SDL_AddRenderDriver(&_this->displays[0], &NDS_RenderDriver);
 
     SDL_zero(mode);
     SDL_AddDisplayMode(0, &mode);
--- a/src/video/ps3/SDL_ps3video.c	Fri Dec 04 08:26:32 2009 +0000
+++ b/src/video/ps3/SDL_ps3video.c	Fri Dec 04 08:45:08 2009 +0000
@@ -124,6 +124,8 @@
 int
 PS3_VideoInit(_THIS)
 {
+    int i;
+
     deprintf(1, "PS3_VideoInit()\n");
 
     SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
@@ -181,7 +183,9 @@
     memset(data->frame_buffer, 0x00, fb_finfo.smem_len);
 
     PS3_InitModes(_this);
-    SDL_AddRenderDriver(0, &SDL_PS3_RenderDriver);
+    for (i = 0; i < _this->num_displays; ++i) {
+        SDL_AddRenderDriver(&_this->displays[i], &SDL_PS3_RenderDriver);
+    }
 
     /* We're done! */
     return 0;
--- a/src/video/win32/SDL_ceddrawrender.c	Fri Dec 04 08:26:32 2009 +0000
+++ b/src/video/win32/SDL_ceddrawrender.c	Fri Dec 04 08:45:08 2009 +0000
@@ -428,7 +428,9 @@
         info->texture_formats[info->num_texture_formats++] =
             SDL_PIXELFORMAT_YVYU;
 
-        SDL_AddRenderDriver(0, &DDRAW_RenderDriver);
+        for (i = 0; i < _this->num_displays; ++i)
+            SDL_AddRenderDriver(&_this->displays[i], &DDRAW_RenderDriver);
+        }
     }
 }
 
--- a/src/video/win32/SDL_d3drender.c	Fri Dec 04 08:26:32 2009 +0000
+++ b/src/video/win32/SDL_d3drender.c	Fri Dec 04 08:45:08 2009 +0000
@@ -327,7 +327,9 @@
         info->texture_formats[info->num_texture_formats++] =
             SDL_PIXELFORMAT_YVYU;
 
-        SDL_AddRenderDriver(0, &D3D_RenderDriver);
+        for (i = 0; i < _this->num_displays; ++i) {
+            SDL_AddRenderDriver(&_this->displays[i], &D3D_RenderDriver);
+        }
     }
 }
 
--- a/src/video/win32/SDL_gapirender.c	Fri Dec 04 08:26:32 2009 +0000
+++ b/src/video/win32/SDL_gapirender.c	Fri Dec 04 08:45:08 2009 +0000
@@ -92,6 +92,8 @@
 void
 GAPI_AddRenderDriver(_THIS)
 {
+    int i;
+
     /* TODO: should we check for support of GetRawFramebuffer here?
      */
 #if USE_GAPI_EMU
@@ -125,7 +127,9 @@
 #undef LINK
     }
 
-    SDL_AddRenderDriver(0, &GAPI_RenderDriver);
+    for (i = 0; i < _this->num_displays; ++i) {
+        SDL_AddRenderDriver(&_this->displays[i], &GAPI_RenderDriver);
+    }
 }
 
 typedef enum
--- a/src/video/win32/SDL_gdirender.c	Fri Dec 04 08:26:32 2009 +0000
+++ b/src/video/win32/SDL_gdirender.c	Fri Dec 04 08:45:08 2009 +0000
@@ -147,7 +147,10 @@
 void
 GDI_AddRenderDriver(_THIS)
 {
-    SDL_AddRenderDriver(0, &GDI_RenderDriver);
+    int i;
+    for (i = 0; i < _this->num_displays; ++i) {
+        SDL_AddRenderDriver(&_this->displays[i], &GDI_RenderDriver);
+    }
 }
 
 SDL_Renderer *
--- a/src/video/x11/SDL_x11render.c	Fri Dec 04 08:26:32 2009 +0000
+++ b/src/video/x11/SDL_x11render.c	Fri Dec 04 08:45:08 2009 +0000
@@ -144,6 +144,7 @@
     SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
     SDL_RendererInfo *info = &X11_RenderDriver.info;
     SDL_DisplayMode *mode = &SDL_CurrentDisplay.desktop_mode;
+    int i;
 
     info->texture_formats[info->num_texture_formats++] = mode->format;
     info->texture_formats[info->num_texture_formats++] = SDL_PIXELFORMAT_YV12;
@@ -152,7 +153,9 @@
     info->texture_formats[info->num_texture_formats++] = SDL_PIXELFORMAT_UYVY;
     info->texture_formats[info->num_texture_formats++] = SDL_PIXELFORMAT_YVYU;
 
-    SDL_AddRenderDriver(0, &X11_RenderDriver);
+    for (i = 0; i < _this->num_displays; ++i) {
+        SDL_AddRenderDriver(&_this->displays[i], &X11_RenderDriver);
+    }
 }
 
 SDL_Renderer *