Fixed bug 2646 - Problems with software renderer when SDL_SetRenderLogicalSize set

Fixed setting the software renderer clip rectangle when a viewport is set
This commit is contained in:
Sam Lantinga 2017-08-13 22:50:23 -07:00
parent f8de064c0a
commit f8e1874d01
1 changed files with 7 additions and 2 deletions

View File

@ -371,9 +371,14 @@ SW_UpdateClipRect(SDL_Renderer * renderer)
SDL_Surface *surface = data->surface; SDL_Surface *surface = data->surface;
if (surface) { if (surface) {
if (renderer->clipping_enabled) { if (renderer->clipping_enabled) {
SDL_SetClipRect(surface, &renderer->clip_rect); SDL_Rect clip_rect;
clip_rect = renderer->clip_rect;
clip_rect.x += renderer->viewport.x;
clip_rect.y += renderer->viewport.y;
SDL_IntersectRect(&renderer->viewport, &clip_rect, &clip_rect);
SDL_SetClipRect(surface, &clip_rect);
} else { } else {
SDL_SetClipRect(surface, NULL); SDL_SetClipRect(surface, &renderer->viewport);
} }
} }
return 0; return 0;