comparison src/render/direct3d/SDL_render_d3d.c @ 5229:2178ffe17222

Added function SDL_RenderSetClipRect()
author Sam Lantinga <slouken@libsdl.org>
date Mon, 07 Feb 2011 20:06:26 -0800
parents 25ffd4e5255c
children 710d00cb3a6a
comparison
equal deleted inserted replaced
5228:ab0d7cecc0f6 5229:2178ffe17222
94 const SDL_Rect * rect, const void *pixels, 94 const SDL_Rect * rect, const void *pixels,
95 int pitch); 95 int pitch);
96 static int D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, 96 static int D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
97 const SDL_Rect * rect, void **pixels, int *pitch); 97 const SDL_Rect * rect, void **pixels, int *pitch);
98 static void D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture); 98 static void D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
99 static void D3D_SetClipRect(SDL_Renderer * renderer, const SDL_Rect * rect);
99 static int D3D_RenderDrawPoints(SDL_Renderer * renderer, 100 static int D3D_RenderDrawPoints(SDL_Renderer * renderer,
100 const SDL_Point * points, int count); 101 const SDL_Point * points, int count);
101 static int D3D_RenderDrawLines(SDL_Renderer * renderer, 102 static int D3D_RenderDrawLines(SDL_Renderer * renderer,
102 const SDL_Point * points, int count); 103 const SDL_Point * points, int count);
103 static int D3D_RenderFillRects(SDL_Renderer * renderer, 104 static int D3D_RenderFillRects(SDL_Renderer * renderer,
306 307
307 renderer->CreateTexture = D3D_CreateTexture; 308 renderer->CreateTexture = D3D_CreateTexture;
308 renderer->UpdateTexture = D3D_UpdateTexture; 309 renderer->UpdateTexture = D3D_UpdateTexture;
309 renderer->LockTexture = D3D_LockTexture; 310 renderer->LockTexture = D3D_LockTexture;
310 renderer->UnlockTexture = D3D_UnlockTexture; 311 renderer->UnlockTexture = D3D_UnlockTexture;
312 renderer->SetClipRect = D3D_SetClipRect;
311 renderer->RenderDrawPoints = D3D_RenderDrawPoints; 313 renderer->RenderDrawPoints = D3D_RenderDrawPoints;
312 renderer->RenderDrawLines = D3D_RenderDrawLines; 314 renderer->RenderDrawLines = D3D_RenderDrawLines;
313 renderer->RenderFillRects = D3D_RenderFillRects; 315 renderer->RenderFillRects = D3D_RenderFillRects;
314 renderer->RenderCopy = D3D_RenderCopy; 316 renderer->RenderCopy = D3D_RenderCopy;
315 renderer->RenderReadPixels = D3D_RenderReadPixels; 317 renderer->RenderReadPixels = D3D_RenderReadPixels;
600 602
601 IDirect3DTexture9_UnlockRect(data->texture, 0); 603 IDirect3DTexture9_UnlockRect(data->texture, 0);
602 } 604 }
603 605
604 static void 606 static void
607 D3D_SetClipRect(SDL_Renderer * renderer, const SDL_Rect * rect)
608 {
609 D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
610
611 if (rect) {
612 RECT d3drect;
613
614 d3drect.left = rect->x;
615 d3drect.right = rect->x + rect->w;
616 d3drect.top = rect->y;
617 d3drect.bottom = rect->y + rect->h;
618 IDirect3DDevice9_SetScissorRect(data->device, &d3drect);
619 IDirect3DDevice9_SetRenderState(data->device, D3DRS_SCISSORTESTENABLE,
620 TRUE);
621 } else {
622 IDirect3DDevice9_SetRenderState(data->device, D3DRS_SCISSORTESTENABLE,
623 FALSE);
624 }
625 }
626
627 static void
605 D3D_SetBlendMode(D3D_RenderData * data, int blendMode) 628 D3D_SetBlendMode(D3D_RenderData * data, int blendMode)
606 { 629 {
607 switch (blendMode) { 630 switch (blendMode) {
608 case SDL_BLENDMODE_NONE: 631 case SDL_BLENDMODE_NONE:
609 IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE, 632 IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE,