Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed bug updating the clip rect for the software renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jun 27, 2013
1 parent 2e9dc2b commit 44e52e5
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/render/software/SDL_render_sw.c
Expand Up @@ -118,6 +118,7 @@ SW_ActivateRenderer(SDL_Renderer * renderer)
renderer->viewport.h = surface->h;

SW_UpdateViewport(renderer);
SW_UpdateClipRect(renderer);
}
}
return data->surface;
Expand Down Expand Up @@ -346,13 +347,16 @@ SW_UpdateViewport(SDL_Renderer * renderer)
static int
SW_UpdateClipRect(SDL_Renderer * renderer)
{
SW_RenderData *data = (SW_RenderData *) renderer->driverdata;
SDL_Surface *surface = data->surface;
const SDL_Rect *rect = &renderer->clip_rect;
SDL_Surface* framebuffer = (SDL_Surface *) renderer->driverdata;

if (!SDL_RectEmpty(rect)) {
SDL_SetClipRect(framebuffer, rect);
} else {
SDL_SetClipRect(framebuffer, NULL);
if (surface) {
if (!SDL_RectEmpty(rect)) {
SDL_SetClipRect(surface, rect);
} else {
SDL_SetClipRect(surface, NULL);
}
}
return 0;
}
Expand Down

0 comments on commit 44e52e5

Please sign in to comment.