Mercurial > sdl-ios-xcode
diff src/video/dummy/SDL_nullrender.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 | 32e8bbba1e94 |
children | 2133d2d300fd |
line wrap: on
line diff
--- a/src/video/dummy/SDL_nullrender.c Sun Dec 21 08:59:56 2008 +0000 +++ b/src/video/dummy/SDL_nullrender.c Sun Dec 21 17:39:41 2008 +0000 @@ -33,6 +33,7 @@ Uint32 flags); static int SDL_DUMMY_SetDrawColor(SDL_Renderer * renderer); static int SDL_DUMMY_SetDrawBlendMode(SDL_Renderer * renderer); +static int SDL_DUMMY_RenderPoint(SDL_Renderer * renderer, int x, int y); static int SDL_DUMMY_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2); static int SDL_DUMMY_RenderFill(SDL_Renderer * renderer, @@ -94,6 +95,7 @@ renderer->SetDrawColor = SDL_DUMMY_SetDrawColor; renderer->SetDrawBlendMode = SDL_DUMMY_SetDrawBlendMode; + renderer->RenderPoint = SDL_DUMMY_RenderPoint; renderer->RenderLine = SDL_DUMMY_RenderLine; renderer->RenderFill = SDL_DUMMY_RenderFill; renderer->RenderCopy = SDL_DUMMY_RenderCopy; @@ -143,6 +145,29 @@ } static int +SDL_DUMMY_RenderPoint(SDL_Renderer * renderer, int x, int y) +{ + SDL_DUMMY_RenderData *data = + (SDL_DUMMY_RenderData *) renderer->driverdata; + SDL_Surface *target = data->screens[data->current_screen]; + int status; + + if (renderer->blendMode == SDL_BLENDMODE_NONE || + renderer->blendMode == SDL_BLENDMODE_MASK) { + Uint32 color = + SDL_MapRGBA(target->format, renderer->r, renderer->g, renderer->b, + renderer->a); + + status = SDL_DrawPoint(target, x, y, color); + } else { + status = + SDL_BlendPoint(target, x, y, renderer->blendMode, renderer->r, + renderer->g, renderer->b, renderer->a); + } + return status; +} + +static int SDL_DUMMY_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2) { SDL_DUMMY_RenderData *data = @@ -150,7 +175,8 @@ SDL_Surface *target = data->screens[data->current_screen]; int status; - if (renderer->blendMode == SDL_BLENDMODE_NONE) { + if (renderer->blendMode == SDL_BLENDMODE_NONE || + renderer->blendMode == SDL_BLENDMODE_MASK) { Uint32 color = SDL_MapRGBA(target->format, renderer->r, renderer->g, renderer->b, renderer->a);