summaryrefslogtreecommitdiff
path: root/source/gl_draw.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/gl_draw.c')
-rw-r--r--source/gl_draw.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/source/gl_draw.c b/source/gl_draw.c
index 4813441..0482d3f 100644
--- a/source/gl_draw.c
+++ b/source/gl_draw.c
@@ -67,20 +67,39 @@ void Draw_SetClipRect( uint32 flags, const clipRect_t *clip ) {
rc.top = 0;
if( flags & DRAW_CLIP_LEFT ) {
rc.left = clip->left * scale;
+ if( rc.left < 0 ) {
+ rc.left = 0;
+ }
}
if( flags & DRAW_CLIP_TOP ) {
rc.top = clip->top * scale;
+ if( rc.top < 0 ) {
+ rc.top = 0;
+ }
}
rc.right = gl_config.vidWidth;
rc.bottom = gl_config.vidHeight;
if( flags & DRAW_CLIP_RIGHT ) {
rc.right = clip->right * scale;
+ if( rc.right > gl_config.vidWidth ) {
+ rc.right = gl_config.vidWidth;
+ }
}
if( flags & DRAW_CLIP_BOTTOM ) {
rc.bottom = clip->bottom * scale;
+ if( rc.bottom > gl_config.vidHeight ) {
+ rc.bottom = gl_config.vidHeight;
+ }
}
+ if( rc.right < rc.left ) {
+ rc.right = rc.left;
+ }
+ if( rc.bottom < rc.top ) {
+ rc.bottom = rc.top;
+ }
+
qglEnable( GL_SCISSOR_TEST );
qglScissor( rc.left, gl_config.vidHeight - rc.bottom,
rc.right - rc.left, rc.bottom - rc.top );