Mercurial > sdl-ios-xcode
diff src/render/software/SDL_render_sw.c @ 5229:2178ffe17222
Added function SDL_RenderSetClipRect()
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 07 Feb 2011 20:06:26 -0800 |
parents | bb45ecd958d8 |
children | 710d00cb3a6a |
line wrap: on
line diff
--- a/src/render/software/SDL_render_sw.c Mon Feb 07 20:05:52 2011 -0800 +++ b/src/render/software/SDL_render_sw.c Mon Feb 07 20:06:26 2011 -0800 @@ -50,6 +50,7 @@ static int SW_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, void **pixels, int *pitch); static void SW_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture); +static void SW_SetClipRect(SDL_Renderer * renderer, const SDL_Rect * rect); static int SW_RenderDrawPoints(SDL_Renderer * renderer, const SDL_Point * points, int count); static int SW_RenderDrawLines(SDL_Renderer * renderer, @@ -125,6 +126,7 @@ renderer->UpdateTexture = SW_UpdateTexture; renderer->LockTexture = SW_LockTexture; renderer->UnlockTexture = SW_UnlockTexture; + renderer->SetClipRect = SW_SetClipRect; renderer->DestroyTexture = SW_DestroyTexture; renderer->RenderDrawPoints = SW_RenderDrawPoints; renderer->RenderDrawLines = SW_RenderDrawLines; @@ -266,6 +268,17 @@ { } +static void +SW_SetClipRect(SDL_Renderer * renderer, const SDL_Rect * rect) +{ + SDL_Surface *surface = SW_ActivateRenderer(renderer); + + if (!surface) { + return; + } + SDL_SetClipRect(surface, rect); +} + static int SW_RenderDrawPoints(SDL_Renderer * renderer, const SDL_Point * points, int count)