Fixed bug updating the clip rect for the software renderer
This commit is contained in:
parent
a8055a9808
commit
54060becd3
1 changed files with 9 additions and 5 deletions
|
@ -118,6 +118,7 @@ SW_ActivateRenderer(SDL_Renderer * renderer)
|
||||||
renderer->viewport.h = surface->h;
|
renderer->viewport.h = surface->h;
|
||||||
|
|
||||||
SW_UpdateViewport(renderer);
|
SW_UpdateViewport(renderer);
|
||||||
|
SW_UpdateClipRect(renderer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return data->surface;
|
return data->surface;
|
||||||
|
@ -346,13 +347,16 @@ SW_UpdateViewport(SDL_Renderer * renderer)
|
||||||
static int
|
static int
|
||||||
SW_UpdateClipRect(SDL_Renderer * renderer)
|
SW_UpdateClipRect(SDL_Renderer * renderer)
|
||||||
{
|
{
|
||||||
|
SW_RenderData *data = (SW_RenderData *) renderer->driverdata;
|
||||||
|
SDL_Surface *surface = data->surface;
|
||||||
const SDL_Rect *rect = &renderer->clip_rect;
|
const SDL_Rect *rect = &renderer->clip_rect;
|
||||||
SDL_Surface* framebuffer = (SDL_Surface *) renderer->driverdata;
|
|
||||||
|
|
||||||
if (!SDL_RectEmpty(rect)) {
|
if (surface) {
|
||||||
SDL_SetClipRect(framebuffer, rect);
|
if (!SDL_RectEmpty(rect)) {
|
||||||
} else {
|
SDL_SetClipRect(surface, rect);
|
||||||
SDL_SetClipRect(framebuffer, NULL);
|
} else {
|
||||||
|
SDL_SetClipRect(surface, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue