comparison src/render/opengles/SDL_render_gles.c @ 5229:2178ffe17222

Added function SDL_RenderSetClipRect()
author Sam Lantinga <slouken@libsdl.org>
date Mon, 07 Feb 2011 20:06:26 -0800
parents 115fff0641ee
children 710d00cb3a6a
comparison
equal deleted inserted replaced
5228:ab0d7cecc0f6 5229:2178ffe17222
54 int pitch); 54 int pitch);
55 static int GLES_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, 55 static int GLES_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
56 const SDL_Rect * rect, void **pixels, int *pitch); 56 const SDL_Rect * rect, void **pixels, int *pitch);
57 static void GLES_UnlockTexture(SDL_Renderer * renderer, 57 static void GLES_UnlockTexture(SDL_Renderer * renderer,
58 SDL_Texture * texture); 58 SDL_Texture * texture);
59 static void GLES_SetClipRect(SDL_Renderer * renderer, const SDL_Rect * rect);
59 static int GLES_RenderDrawPoints(SDL_Renderer * renderer, 60 static int GLES_RenderDrawPoints(SDL_Renderer * renderer,
60 const SDL_Point * points, int count); 61 const SDL_Point * points, int count);
61 static int GLES_RenderDrawLines(SDL_Renderer * renderer, 62 static int GLES_RenderDrawLines(SDL_Renderer * renderer,
62 const SDL_Point * points, int count); 63 const SDL_Point * points, int count);
63 static int GLES_RenderFillRects(SDL_Renderer * renderer, 64 static int GLES_RenderFillRects(SDL_Renderer * renderer,
170 renderer->WindowEvent = GLES_WindowEvent; 171 renderer->WindowEvent = GLES_WindowEvent;
171 renderer->CreateTexture = GLES_CreateTexture; 172 renderer->CreateTexture = GLES_CreateTexture;
172 renderer->UpdateTexture = GLES_UpdateTexture; 173 renderer->UpdateTexture = GLES_UpdateTexture;
173 renderer->LockTexture = GLES_LockTexture; 174 renderer->LockTexture = GLES_LockTexture;
174 renderer->UnlockTexture = GLES_UnlockTexture; 175 renderer->UnlockTexture = GLES_UnlockTexture;
176 renderer->SetClipRect = GLES_SetClipRect;
175 renderer->RenderDrawPoints = GLES_RenderDrawPoints; 177 renderer->RenderDrawPoints = GLES_RenderDrawPoints;
176 renderer->RenderDrawLines = GLES_RenderDrawLines; 178 renderer->RenderDrawLines = GLES_RenderDrawLines;
177 renderer->RenderFillRects = GLES_RenderFillRects; 179 renderer->RenderFillRects = GLES_RenderFillRects;
178 renderer->RenderCopy = GLES_RenderCopy; 180 renderer->RenderCopy = GLES_RenderCopy;
179 renderer->RenderPresent = GLES_RenderPresent; 181 renderer->RenderPresent = GLES_RenderPresent;
439 glBindTexture(data->type, data->texture); 441 glBindTexture(data->type, data->texture);
440 glTexSubImage2D(data->type, 0, 0, 0, texture->w, 442 glTexSubImage2D(data->type, 0, 0, 0, texture->w,
441 texture->h, data->format, data->formattype, 443 texture->h, data->format, data->formattype,
442 data->pixels); 444 data->pixels);
443 glDisable(data->type); 445 glDisable(data->type);
446 }
447
448 static void
449 GLES_SetClipRect(SDL_Renderer * renderer, const SDL_Rect * rect)
450 {
451 GL_ActivateRenderer(renderer);
452
453 if (rect) {
454 int w, h;
455
456 SDL_GetWindowSize(renderer->window, &w, &h);
457 glScissor(rect->x, (h-(rect->y+rect->h)), rect->w, rect->h);
458 glEnable(GL_SCISSOR_TEST);
459 } else {
460 glDisable(GL_SCISSOR_TEST);
461 }
444 } 462 }
445 463
446 static void 464 static void
447 GLES_SetBlendMode(GLES_RenderData * data, int blendMode) 465 GLES_SetBlendMode(GLES_RenderData * data, int blendMode)
448 { 466 {