Mercurial > sdl-ios-xcode
diff src/video/SDL_video.c @ 1969:5d3724f64f2b
Clarified the difference between render drivers and render contexts
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 06 Aug 2006 00:09:04 +0000 |
parents | 01e29c3e9a29 |
children | db3ba6c0d0df |
line wrap: on
line diff
--- a/src/video/SDL_video.c Sat Aug 05 22:41:33 2006 +0000 +++ b/src/video/SDL_video.c Sun Aug 06 00:09:04 2006 +0000 @@ -1362,7 +1362,7 @@ } int -SDL_GetNumRenderers(void) +SDL_GetNumRenderDrivers(void) { if (_this) { return SDL_CurrentDisplay.num_render_drivers; @@ -1371,27 +1371,19 @@ } int -SDL_GetRendererInfo(int index, SDL_RendererInfo * info) +SDL_GetRenderDriverInfo(int index, SDL_RendererInfo * info) { if (!_this) { SDL_UninitializedVideo(); return -1; } - if (index >= SDL_GetNumRenderers()) { + if (index < 0 || index >= SDL_GetNumRenderDrivers()) { SDL_SetError("index must be in the range of 0 - %d", - SDL_GetNumRenderers() - 1); + SDL_GetNumRenderDrivers() - 1); return -1; } - if (index < 0) { - if (!SDL_CurrentDisplay.current_renderer) { - SDL_SetError("There is no current renderer"); - return -1; - } - *info = SDL_CurrentDisplay.current_renderer->info; - } else { - *info = SDL_CurrentDisplay.render_drivers[index].info; - } + *info = SDL_CurrentDisplay.render_drivers[index].info; return 0; } @@ -1406,7 +1398,7 @@ if (index < 0) { const char *override = SDL_getenv("SDL_VIDEO_RENDERER"); - int n = SDL_GetNumRenderers(); + int n = SDL_GetNumRenderDrivers(); for (index = 0; index < n; ++index) { SDL_RenderDriver *driver = &SDL_CurrentDisplay.render_drivers[index]; @@ -1427,9 +1419,9 @@ } } - if (index >= SDL_GetNumRenderers()) { + if (index >= SDL_GetNumRenderDrivers()) { SDL_SetError("index must be -1 or in the range of 0 - %d", - SDL_GetNumRenderers() - 1); + SDL_GetNumRenderDrivers() - 1); return -1; } @@ -1464,6 +1456,22 @@ return 0; } +int +SDL_GetRendererInfo(SDL_RendererInfo * info) +{ + if (!_this) { + SDL_UninitializedVideo(); + return -1; + } + + if (!SDL_CurrentDisplay.current_renderer) { + SDL_SetError("There is no current renderer"); + return -1; + } + *info = SDL_CurrentDisplay.current_renderer->info; + return 0; +} + SDL_TextureID SDL_CreateTexture(Uint32 format, int access, int w, int h) {