Fixed clip rectangle calculation when there is a viewport offset
This commit is contained in:
parent
2a4efa3b11
commit
d727fa668a
5 changed files with 57 additions and 14 deletions
|
@ -1046,7 +1046,14 @@ GL_UpdateClipRect(SDL_Renderer * renderer)
|
|||
if (renderer->clipping_enabled) {
|
||||
const SDL_Rect *rect = &renderer->clip_rect;
|
||||
data->glEnable(GL_SCISSOR_TEST);
|
||||
data->glScissor(rect->x, renderer->viewport.h - rect->y - rect->h, rect->w, rect->h);
|
||||
if (renderer->target) {
|
||||
data->glScissor(renderer->viewport.x + rect->x, renderer->viewport.y + rect->y, rect->w, rect->h);
|
||||
} else {
|
||||
int w, h;
|
||||
|
||||
SDL_GetRendererOutputSize(renderer, &w, &h);
|
||||
data->glScissor(renderer->viewport.x + rect->x, (h - renderer->viewport.y - renderer->viewport.h) + rect->y, rect->w, rect->h);
|
||||
}
|
||||
} else {
|
||||
data->glDisable(GL_SCISSOR_TEST);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue