Mercurial > sdl-ios-xcode
diff src/video/SDL_video.c @ 2901:133601e3b255
Added RenderPiont() API
Merged the drawing tests into a single test program
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 21 Dec 2008 17:39:41 +0000 |
parents | ca6499468250 |
children | aa6ba38c1714 |
line wrap: on
line diff
--- a/src/video/SDL_video.c Sun Dec 21 08:59:56 2008 +0000 +++ b/src/video/SDL_video.c Sun Dec 21 17:39:41 2008 +0000 @@ -2070,6 +2070,70 @@ return 0; } +int +SDL_RenderPoint(int x, int y) +{ + SDL_Renderer *renderer; + SDL_Window *window; + SDL_Rect real_rect; + + if (!_this) { + SDL_UninitializedVideo(); + return -1; + } + renderer = SDL_CurrentDisplay.current_renderer; + if (!renderer) { + return -1; + } + if (!renderer->RenderPoint) { + SDL_Unsupported(); + return -1; + } + window = SDL_GetWindowFromID(renderer->window); + if (x < 0 || y < 0 || x >= window->w || y >= window->h) { + return 0; + } + return renderer->RenderPoint(renderer, x, y); +} + +int +SDL_RenderLine(int x1, int y1, int x2, int y2) +{ + SDL_Renderer *renderer; + SDL_Window *window; + SDL_Rect real_rect; + + if (x1 == x2 && y1 == y2) { + return SDL_RenderPoint(x1, y1); + } + + if (!_this) { + SDL_UninitializedVideo(); + return -1; + } + renderer = SDL_CurrentDisplay.current_renderer; + if (!renderer) { + return -1; + } + if (!renderer->RenderLine) { + SDL_Unsupported(); + return -1; + } +#if 0 + //FIXME: Need line intersect routine + window = SDL_GetWindowFromID(renderer->window); + real_rect.x = 0; + real_rect.y = 0; + real_rect.w = window->w; + real_rect.h = window->h; + if (rect) { + if (!SDL_IntersectRect(rect, &real_rect, &real_rect)) { + return 0; + } + } +#endif + return renderer->RenderLine(renderer, x1, y1, x2, y2); +} int SDL_RenderFill(const SDL_Rect * rect) @@ -2104,41 +2168,6 @@ } int -SDL_RenderLine(int x1, int y1, int x2, int y2) -{ - SDL_Renderer *renderer; - SDL_Window *window; - SDL_Rect real_rect; - - if (!_this) { - SDL_UninitializedVideo(); - return -1; - } - renderer = SDL_CurrentDisplay.current_renderer; - if (!renderer) { - return -1; - } - if (!renderer->RenderLine) { - SDL_Unsupported(); - return -1; - } -#if 0 - //FIXME: Need line intersect routine - window = SDL_GetWindowFromID(renderer->window); - real_rect.x = 0; - real_rect.y = 0; - real_rect.w = window->w; - real_rect.h = window->h; - if (rect) { - if (!SDL_IntersectRect(rect, &real_rect, &real_rect)) { - return 0; - } - } -#endif - return renderer->RenderLine(renderer, x1, y1, x2, y2); -} - -int SDL_RenderCopy(SDL_TextureID textureID, const SDL_Rect * srcrect, const SDL_Rect * dstrect) {