Mercurial > sdl-ios-xcode
diff src/video/dummy/SDL_nullrender.c @ 3596:f638ded38b8a
Added SDL_RenderClear() as a fast method of clearing the screen to the drawing color.
Renamed SDL_RenderPoint() and SDL_RenderLine() to SDL_RenderDrawPoint() and SDL_RenderDrawLine().
Added API for rectangle drawing (as opposed to filling)
Added placeholder API functions for circles and ellipses ... I'm not sure whether these will stay.
Optimized software line drawing quite a bit.
Added support for Wu's anti-aliased line drawing, currently disabled by default.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 23 Dec 2009 01:55:00 +0000 |
parents | 0267b8b1595c |
children | 64ce267332c6 |
line wrap: on
line diff
--- a/src/video/dummy/SDL_nullrender.c Fri Dec 18 08:19:18 2009 +0000 +++ b/src/video/dummy/SDL_nullrender.c Wed Dec 23 01:55:00 2009 +0000 @@ -31,12 +31,14 @@ static SDL_Renderer *SDL_DUMMY_CreateRenderer(SDL_Window * window, Uint32 flags); -static int SDL_DUMMY_RenderPoints(SDL_Renderer * renderer, - const SDL_Point * points, int count); -static int SDL_DUMMY_RenderLines(SDL_Renderer * renderer, - const SDL_Point * points, int count); -static int SDL_DUMMY_RenderRects(SDL_Renderer * renderer, - const SDL_Rect ** rects, int count); +static int SDL_DUMMY_RenderDrawPoints(SDL_Renderer * renderer, + const SDL_Point * points, int count); +static int SDL_DUMMY_RenderDrawLines(SDL_Renderer * renderer, + const SDL_Point * points, int count); +static int SDL_DUMMY_RenderDrawRects(SDL_Renderer * renderer, + const SDL_Rect ** rects, int count); +static int SDL_DUMMY_RenderFillRects(SDL_Renderer * renderer, + const SDL_Rect ** rects, int count); static int SDL_DUMMY_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * srcrect, @@ -100,9 +102,10 @@ } SDL_zerop(data); - renderer->RenderPoints = SDL_DUMMY_RenderPoints; - renderer->RenderLines = SDL_DUMMY_RenderLines; - renderer->RenderRects = SDL_DUMMY_RenderRects; + renderer->RenderDrawPoints = SDL_DUMMY_RenderDrawPoints; + renderer->RenderDrawLines = SDL_DUMMY_RenderDrawLines; + renderer->RenderDrawRects = SDL_DUMMY_RenderDrawRects; + renderer->RenderFillRects = SDL_DUMMY_RenderFillRects; renderer->RenderCopy = SDL_DUMMY_RenderCopy; renderer->RenderReadPixels = SDL_DUMMY_RenderReadPixels; renderer->RenderWritePixels = SDL_DUMMY_RenderWritePixels; @@ -140,8 +143,8 @@ } static int -SDL_DUMMY_RenderPoints(SDL_Renderer * renderer, - const SDL_Point * points, int count) +SDL_DUMMY_RenderDrawPoints(SDL_Renderer * renderer, + const SDL_Point * points, int count) { SDL_DUMMY_RenderData *data = (SDL_DUMMY_RenderData *) renderer->driverdata; @@ -162,8 +165,8 @@ } static int -SDL_DUMMY_RenderLines(SDL_Renderer * renderer, - const SDL_Point * points, int count) +SDL_DUMMY_RenderDrawLines(SDL_Renderer * renderer, + const SDL_Point * points, int count) { SDL_DUMMY_RenderData *data = (SDL_DUMMY_RenderData *) renderer->driverdata; @@ -184,8 +187,31 @@ } static int -SDL_DUMMY_RenderRects(SDL_Renderer * renderer, const SDL_Rect ** rects, - int count) +SDL_DUMMY_RenderDrawRects(SDL_Renderer * renderer, const SDL_Rect ** rects, + int count) +{ + SDL_DUMMY_RenderData *data = + (SDL_DUMMY_RenderData *) renderer->driverdata; + SDL_Surface *target = data->screens[data->current_screen]; + + 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); + + return SDL_DrawRects(target, rects, count, color); + } else { + return SDL_BlendRects(target, rects, count, + renderer->blendMode, + renderer->r, renderer->g, renderer->b, + renderer->a); + } +} + +static int +SDL_DUMMY_RenderFillRects(SDL_Renderer * renderer, const SDL_Rect ** rects, + int count) { SDL_DUMMY_RenderData *data = (SDL_DUMMY_RenderData *) renderer->driverdata; @@ -199,10 +225,10 @@ return SDL_FillRects(target, rects, count, color); } else { - return SDL_BlendRects(target, rects, count, - renderer->blendMode, - renderer->r, renderer->g, renderer->b, - renderer->a); + return SDL_BlendFillRects(target, rects, count, + renderer->blendMode, + renderer->r, renderer->g, renderer->b, + renderer->a); } }