src/render/software/SDL_render_sw.c
changeset 11281 42b62c737891
parent 11223 62db9336e07b
child 11811 5d94cb6b24d3
     1.1 --- a/src/render/software/SDL_render_sw.c	Sun Aug 13 22:26:44 2017 -0700
     1.2 +++ b/src/render/software/SDL_render_sw.c	Sun Aug 13 22:50:23 2017 -0700
     1.3 @@ -371,9 +371,14 @@
     1.4      SDL_Surface *surface = data->surface;
     1.5      if (surface) {
     1.6          if (renderer->clipping_enabled) {
     1.7 -            SDL_SetClipRect(surface, &renderer->clip_rect);
     1.8 +            SDL_Rect clip_rect;
     1.9 +            clip_rect = renderer->clip_rect;
    1.10 +            clip_rect.x += renderer->viewport.x;
    1.11 +            clip_rect.y += renderer->viewport.y;
    1.12 +            SDL_IntersectRect(&renderer->viewport, &clip_rect, &clip_rect);
    1.13 +            SDL_SetClipRect(surface, &clip_rect);
    1.14          } else {
    1.15 -            SDL_SetClipRect(surface, NULL);
    1.16 +            SDL_SetClipRect(surface, &renderer->viewport);
    1.17          }
    1.18      }
    1.19      return 0;