diff options
author | Andrey Nazarov <skuller@skuller.net> | 2007-12-02 18:33:17 +0000 |
---|---|---|
committer | Andrey Nazarov <skuller@skuller.net> | 2007-12-02 18:33:17 +0000 |
commit | 54124502cfb00c497ed24cbc8a9afefff1ba1b3a (patch) | |
tree | 981e7fcfbea28b5e1f9d913e56752bbf5750b89c /source/gl_draw.c | |
parent | 93bdbd9e43c4616d2fa647374bc7d43fa5cc0220 (diff) |
Implemented UI scaling, added ui_scale variable.
Draw_ClipRect now operates correctly on scaled coordinates.
Diffstat (limited to 'source/gl_draw.c')
-rw-r--r-- | source/gl_draw.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/source/gl_draw.c b/source/gl_draw.c index 388019f..4813441 100644 --- a/source/gl_draw.c +++ b/source/gl_draw.c @@ -47,6 +47,7 @@ void Draw_SetColor( uint32 flags, const color_t color ) { void Draw_SetClipRect( uint32 flags, const clipRect_t *clip ) { clipRect_t rc; + float scale; if( ( draw.flags & DRAW_CLIP_MASK ) == flags ) { return; @@ -60,22 +61,24 @@ void Draw_SetClipRect( uint32 flags, const clipRect_t *clip ) { return; } + scale = 1 / draw.scale; + rc.left = 0; rc.top = 0; if( flags & DRAW_CLIP_LEFT ) { - rc.left = clip->left; + rc.left = clip->left * scale; } if( flags & DRAW_CLIP_TOP ) { - rc.top = clip->top; + rc.top = clip->top * scale; } rc.right = gl_config.vidWidth; rc.bottom = gl_config.vidHeight; if( flags & DRAW_CLIP_RIGHT ) { - rc.right = clip->right; + rc.right = clip->right * scale; } if( flags & DRAW_CLIP_BOTTOM ) { - rc.bottom = clip->bottom; + rc.bottom = clip->bottom * scale; } qglEnable( GL_SCISSOR_TEST ); |