Mercurial > sdl-ios-xcode
diff src/video/SDL_video.c @ 1907:06c27a737b7a
Streamlined the API a bit and optimized the software renderer.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 15 Jul 2006 09:46:36 +0000 |
parents | 36d52b1f0504 |
children | 8f1ab2f7c722 |
line wrap: on
line diff
--- a/src/video/SDL_video.c Fri Jul 14 08:24:43 2006 +0000 +++ b/src/video/SDL_video.c Sat Jul 15 09:46:36 2006 +0000 @@ -1277,12 +1277,24 @@ int SDL_GetRendererInfo(int index, SDL_RendererInfo * info) { - if (index < 0 || index >= SDL_GetNumRenderers()) { + if (!_this) { + return -1; + } + + if (index >= SDL_GetNumRenderers()) { SDL_SetError("index must be in the range of 0 - %d", SDL_GetNumRenderers() - 1); return -1; } - *info = SDL_CurrentDisplay.render_drivers[index].info; + 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; + } return 0; } @@ -1307,11 +1319,6 @@ 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; } @@ -1734,22 +1741,6 @@ renderer->DirtyTexture(renderer, texture, numrects, rects); } -void -SDL_SelectRenderTexture(SDL_TextureID textureID) -{ - SDL_Texture *texture = SDL_GetTextureFromID(textureID); - SDL_Renderer *renderer; - - if (!texture || texture->access != SDL_TextureAccess_Render) { - return; - } - renderer = texture->renderer; - if (!renderer->SelectRenderTexture) { - return; - } - renderer->SelectRenderTexture(renderer, texture); -} - int SDL_RenderFill(const SDL_Rect * rect, Uint32 color) { @@ -1821,60 +1812,6 @@ &real_dstrect, blendMode, scaleMode); } -int -SDL_RenderReadPixels(const SDL_Rect * rect, void *pixels, int pitch) -{ - SDL_Renderer *renderer; - SDL_Rect full_rect; - - if (!_this) { - return -1; - } - - renderer = SDL_CurrentDisplay.current_renderer; - if (!renderer || !renderer->RenderReadPixels) { - return -1; - } - - if (!rect) { - SDL_Window *window = SDL_GetWindowFromID(renderer->window); - full_rect.x = 0; - full_rect.y = 0; - full_rect.w = window->w; - full_rect.h = window->h; - rect = &full_rect; - } - - return renderer->RenderReadPixels(renderer, rect, pixels, pitch); -} - -int -SDL_RenderWritePixels(const SDL_Rect * rect, const void *pixels, int pitch) -{ - SDL_Renderer *renderer; - SDL_Rect full_rect; - - if (!_this) { - return -1; - } - - renderer = SDL_CurrentDisplay.current_renderer; - if (!renderer || !renderer->RenderWritePixels) { - return -1; - } - - if (!rect) { - SDL_Window *window = SDL_GetWindowFromID(renderer->window); - full_rect.x = 0; - full_rect.y = 0; - full_rect.w = window->w; - full_rect.h = window->h; - rect = &full_rect; - } - - return renderer->RenderWritePixels(renderer, rect, pixels, pitch); -} - void SDL_RenderPresent(void) { @@ -1888,10 +1825,6 @@ if (!renderer || !renderer->RenderPresent) { return; } - - if (renderer->SelectRenderTexture) { - renderer->SelectRenderTexture(renderer, NULL); - } renderer->RenderPresent(renderer); }