Added function SDL_RenderSetClipRect()

This commit is contained in:
Sam Lantinga 2011-02-07 20:06:26 -08:00
parent 42bac7a31e
commit 8253658837
9 changed files with 140 additions and 24 deletions

View file

@ -50,6 +50,7 @@ static int SW_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
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 @@ SW_CreateRendererForSurface(SDL_Surface * surface)
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 @@ SW_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
{
}
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)