src/render/direct3d/SDL_render_d3d.c
changeset 5224 2178ffe17222
parent 5203 25ffd4e5255c
child 5226 710d00cb3a6a
     1.1 --- a/src/render/direct3d/SDL_render_d3d.c	Mon Feb 07 20:05:52 2011 -0800
     1.2 +++ b/src/render/direct3d/SDL_render_d3d.c	Mon Feb 07 20:06:26 2011 -0800
     1.3 @@ -96,6 +96,7 @@
     1.4  static int D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
     1.5                             const SDL_Rect * rect, void **pixels, int *pitch);
     1.6  static void D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
     1.7 +static void D3D_SetClipRect(SDL_Renderer * renderer, const SDL_Rect * rect);
     1.8  static int D3D_RenderDrawPoints(SDL_Renderer * renderer,
     1.9                                  const SDL_Point * points, int count);
    1.10  static int D3D_RenderDrawLines(SDL_Renderer * renderer,
    1.11 @@ -308,6 +309,7 @@
    1.12      renderer->UpdateTexture = D3D_UpdateTexture;
    1.13      renderer->LockTexture = D3D_LockTexture;
    1.14      renderer->UnlockTexture = D3D_UnlockTexture;
    1.15 +    renderer->SetClipRect = D3D_SetClipRect;
    1.16      renderer->RenderDrawPoints = D3D_RenderDrawPoints;
    1.17      renderer->RenderDrawLines = D3D_RenderDrawLines;
    1.18      renderer->RenderFillRects = D3D_RenderFillRects;
    1.19 @@ -602,6 +604,27 @@
    1.20  }
    1.21  
    1.22  static void
    1.23 +D3D_SetClipRect(SDL_Renderer * renderer, const SDL_Rect * rect)
    1.24 +{
    1.25 +    D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
    1.26 +
    1.27 +    if (rect) {
    1.28 +        RECT d3drect;
    1.29 +
    1.30 +        d3drect.left = rect->x;
    1.31 +        d3drect.right = rect->x + rect->w;
    1.32 +        d3drect.top = rect->y;
    1.33 +        d3drect.bottom = rect->y + rect->h;
    1.34 +        IDirect3DDevice9_SetScissorRect(data->device, &d3drect);
    1.35 +        IDirect3DDevice9_SetRenderState(data->device, D3DRS_SCISSORTESTENABLE,
    1.36 +                                        TRUE);
    1.37 +    } else {
    1.38 +        IDirect3DDevice9_SetRenderState(data->device, D3DRS_SCISSORTESTENABLE,
    1.39 +                                        FALSE);
    1.40 +    }
    1.41 +}
    1.42 +
    1.43 +static void
    1.44  D3D_SetBlendMode(D3D_RenderData * data, int blendMode)
    1.45  {
    1.46      switch (blendMode) {