Mercurial > sdl-ios-xcode
comparison src/render/opengl/SDL_render_gl.c @ 5229:2178ffe17222
Added function SDL_RenderSetClipRect()
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 07 Feb 2011 20:06:26 -0800 |
parents | daa5463466c5 |
children | 710d00cb3a6a |
comparison
equal
deleted
inserted
replaced
5228:ab0d7cecc0f6 | 5229:2178ffe17222 |
---|---|
50 const SDL_Rect * rect, const void *pixels, | 50 const SDL_Rect * rect, const void *pixels, |
51 int pitch); | 51 int pitch); |
52 static int GL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, | 52 static int GL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, |
53 const SDL_Rect * rect, void **pixels, int *pitch); | 53 const SDL_Rect * rect, void **pixels, int *pitch); |
54 static void GL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture); | 54 static void GL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture); |
55 static void GL_SetClipRect(SDL_Renderer * renderer, const SDL_Rect * rect); | |
55 static int GL_RenderClear(SDL_Renderer * renderer); | 56 static int GL_RenderClear(SDL_Renderer * renderer); |
56 static int GL_RenderDrawPoints(SDL_Renderer * renderer, | 57 static int GL_RenderDrawPoints(SDL_Renderer * renderer, |
57 const SDL_Point * points, int count); | 58 const SDL_Point * points, int count); |
58 static int GL_RenderDrawLines(SDL_Renderer * renderer, | 59 static int GL_RenderDrawLines(SDL_Renderer * renderer, |
59 const SDL_Point * points, int count); | 60 const SDL_Point * points, int count); |
197 renderer->WindowEvent = GL_WindowEvent; | 198 renderer->WindowEvent = GL_WindowEvent; |
198 renderer->CreateTexture = GL_CreateTexture; | 199 renderer->CreateTexture = GL_CreateTexture; |
199 renderer->UpdateTexture = GL_UpdateTexture; | 200 renderer->UpdateTexture = GL_UpdateTexture; |
200 renderer->LockTexture = GL_LockTexture; | 201 renderer->LockTexture = GL_LockTexture; |
201 renderer->UnlockTexture = GL_UnlockTexture; | 202 renderer->UnlockTexture = GL_UnlockTexture; |
203 renderer->SetClipRect = GL_SetClipRect; | |
202 renderer->RenderClear = GL_RenderClear; | 204 renderer->RenderClear = GL_RenderClear; |
203 renderer->RenderDrawPoints = GL_RenderDrawPoints; | 205 renderer->RenderDrawPoints = GL_RenderDrawPoints; |
204 renderer->RenderDrawLines = GL_RenderDrawLines; | 206 renderer->RenderDrawLines = GL_RenderDrawLines; |
205 renderer->RenderFillRects = GL_RenderFillRects; | 207 renderer->RenderFillRects = GL_RenderFillRects; |
206 renderer->RenderCopy = GL_RenderCopy; | 208 renderer->RenderCopy = GL_RenderCopy; |
509 data->format, data->formattype, data->pixels); | 511 data->format, data->formattype, data->pixels); |
510 renderdata->glDisable(data->type); | 512 renderdata->glDisable(data->type); |
511 } | 513 } |
512 | 514 |
513 static void | 515 static void |
516 GL_SetClipRect(SDL_Renderer * renderer, const SDL_Rect * rect) | |
517 { | |
518 GL_RenderData *data = (GL_RenderData *) renderer->driverdata; | |
519 | |
520 GL_ActivateRenderer(renderer); | |
521 | |
522 if (rect) { | |
523 int w, h; | |
524 | |
525 SDL_GetWindowSize(renderer->window, &w, &h); | |
526 data->glScissor(rect->x, (h-(rect->y+rect->h)), rect->w, rect->h); | |
527 data->glEnable(GL_SCISSOR_TEST); | |
528 } else { | |
529 data->glDisable(GL_SCISSOR_TEST); | |
530 } | |
531 } | |
532 | |
533 static void | |
514 GL_SetBlendMode(GL_RenderData * data, int blendMode) | 534 GL_SetBlendMode(GL_RenderData * data, int blendMode) |
515 { | 535 { |
516 if (blendMode != data->blendMode) { | 536 if (blendMode != data->blendMode) { |
517 switch (blendMode) { | 537 switch (blendMode) { |
518 case SDL_BLENDMODE_NONE: | 538 case SDL_BLENDMODE_NONE: |