src/render/SDL_render.c
changeset 8728 c7174f961388
parent 8654 275c4c82803b
child 9078 230e7558f76a
     1.1 --- a/src/render/SDL_render.c	Sat Apr 19 10:17:36 2014 -0700
     1.2 +++ b/src/render/SDL_render.c	Sat Apr 19 13:15:41 2014 -0700
     1.3 @@ -1071,6 +1071,7 @@
     1.4          /* Make a backup of the viewport */
     1.5          renderer->viewport_backup = renderer->viewport;
     1.6          renderer->clip_rect_backup = renderer->clip_rect;
     1.7 +        renderer->clipping_enabled_backup = renderer->clipping_enabled;
     1.8          renderer->scale_backup = renderer->scale;
     1.9          renderer->logical_w_backup = renderer->logical_w;
    1.10          renderer->logical_h_backup = renderer->logical_h;
    1.11 @@ -1093,6 +1094,7 @@
    1.12      } else {
    1.13          renderer->viewport = renderer->viewport_backup;
    1.14          renderer->clip_rect = renderer->clip_rect_backup;
    1.15 +        renderer->clipping_enabled = renderer->clipping_enabled_backup;
    1.16          renderer->scale = renderer->scale_backup;
    1.17          renderer->logical_w = renderer->logical_w_backup;
    1.18          renderer->logical_h = renderer->logical_h_backup;
    1.19 @@ -1233,11 +1235,13 @@
    1.20      CHECK_RENDERER_MAGIC(renderer, -1)
    1.21  
    1.22      if (rect) {
    1.23 +        renderer->clipping_enabled = SDL_TRUE;
    1.24          renderer->clip_rect.x = (int)SDL_floor(rect->x * renderer->scale.x);
    1.25          renderer->clip_rect.y = (int)SDL_floor(rect->y * renderer->scale.y);
    1.26          renderer->clip_rect.w = (int)SDL_ceil(rect->w * renderer->scale.x);
    1.27          renderer->clip_rect.h = (int)SDL_ceil(rect->h * renderer->scale.y);
    1.28      } else {
    1.29 +        renderer->clipping_enabled = SDL_FALSE;
    1.30          SDL_zero(renderer->clip_rect);
    1.31      }
    1.32      return renderer->UpdateClipRect(renderer);
    1.33 @@ -1256,6 +1260,13 @@
    1.34      }
    1.35  }
    1.36  
    1.37 +SDL_bool
    1.38 +SDL_RenderIsClipEnabled(SDL_Renderer * renderer)
    1.39 +{
    1.40 +    CHECK_RENDERER_MAGIC(renderer, SDL_FALSE)
    1.41 +    return renderer->clipping_enabled;
    1.42 +}
    1.43 +
    1.44  int
    1.45  SDL_RenderSetScale(SDL_Renderer * renderer, float scaleX, float scaleY)
    1.46  {