src/render/software/SDL_render_sw.c
changeset 7141 e276777b4247
parent 7037 3fedf1f25b94
child 7239 04dda95ba22c
     1.1 --- a/src/render/software/SDL_render_sw.c	Fri May 03 14:11:41 2013 +0930
     1.2 +++ b/src/render/software/SDL_render_sw.c	Sat May 04 04:46:00 2013 -0700
     1.3 @@ -54,6 +54,7 @@
     1.4  static void SW_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
     1.5  static int SW_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture);
     1.6  static int SW_UpdateViewport(SDL_Renderer * renderer);
     1.7 +static int SW_UpdateClipRect(SDL_Renderer * renderer);
     1.8  static int SW_RenderClear(SDL_Renderer * renderer);
     1.9  static int SW_RenderDrawPoints(SDL_Renderer * renderer,
    1.10                                 const SDL_FPoint * points, int count);
    1.11 @@ -151,6 +152,7 @@
    1.12      renderer->UnlockTexture = SW_UnlockTexture;
    1.13      renderer->SetRenderTarget = SW_SetRenderTarget;
    1.14      renderer->UpdateViewport = SW_UpdateViewport;
    1.15 +    renderer->UpdateClipRect = SW_UpdateClipRect;
    1.16      renderer->RenderClear = SW_RenderClear;
    1.17      renderer->RenderDrawPoints = SW_RenderDrawPoints;
    1.18      renderer->RenderDrawLines = SW_RenderDrawLines;
    1.19 @@ -321,6 +323,20 @@
    1.20  }
    1.21  
    1.22  static int
    1.23 +SW_UpdateClipRect(SDL_Renderer * renderer)
    1.24 +{
    1.25 +    const SDL_Rect *rect = &renderer->clip_rect;
    1.26 +    SDL_Surface* framebuffer = (SDL_Surface *) renderer->driverdata;
    1.27 +
    1.28 +    if (!SDL_RectEmpty(rect)) {
    1.29 +        SDL_SetClipRect(framebuffer, rect);
    1.30 +    } else {
    1.31 +        SDL_SetClipRect(framebuffer, NULL);
    1.32 +    }
    1.33 +    return 0;
    1.34 +}
    1.35 +
    1.36 +static int
    1.37  SW_RenderClear(SDL_Renderer * renderer)
    1.38  {
    1.39      SDL_Surface *surface = SW_ActivateRenderer(renderer);