diff options
author | Ian Romanick <[email protected]> | 2006-10-30 22:17:39 +0000 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2006-10-30 22:17:39 +0000 |
commit | 86a465412d5b305356460e778c29107722b93f0f (patch) | |
tree | 11df7126dc171cb94264ed5431e70faecaab94f2 /src/mesa/drivers/dri/mga | |
parent | 5af5260f3cc6642c16d6b32b3f42693ffd50374b (diff) |
Refactor mgaXMesaSetFrontClipRects and mgaXMesaSetBackClipRects.
Combine mgaXMesaSetFrontClipRects and mgaXMesaSetBackClipRects into a
single new function called mga_set_cliprects. This enables a small
refactor in mgaDDDrawBuffer.
Diffstat (limited to 'src/mesa/drivers/dri/mga')
-rw-r--r-- | src/mesa/drivers/dri/mga/mgastate.c | 41 |
1 files changed, 8 insertions, 33 deletions
diff --git a/src/mesa/drivers/dri/mga/mgastate.c b/src/mesa/drivers/dri/mga/mgastate.c index 783de53197a..26fd863dadb 100644 --- a/src/mesa/drivers/dri/mga/mgastate.c +++ b/src/mesa/drivers/dri/mga/mgastate.c @@ -744,32 +744,12 @@ static void mgaDDLogicOp( GLcontext *ctx, GLenum opcode ) } -static void mgaXMesaSetFrontClipRects( mgaContextPtr mmesa ) +static void mga_set_cliprects(mgaContextPtr mmesa) { __DRIdrawablePrivate *driDrawable = mmesa->driDrawable; - if (driDrawable->numClipRects == 0) { - static drm_clip_rect_t zeroareacliprect = {0,0,0,0}; - mmesa->numClipRects = 1; - mmesa->pClipRects = &zeroareacliprect; - } else { - mmesa->numClipRects = driDrawable->numClipRects; - mmesa->pClipRects = driDrawable->pClipRects; - } - mmesa->drawX = driDrawable->x; - mmesa->drawY = driDrawable->y; - - mmesa->setup.dstorg = mmesa->drawOffset; - mmesa->dirty |= MGA_UPLOAD_CONTEXT | MGA_UPLOAD_CLIPRECTS; -} - - -static void mgaXMesaSetBackClipRects( mgaContextPtr mmesa ) -{ - __DRIdrawablePrivate *driDrawable = mmesa->driDrawable; - - if (driDrawable->numBackClipRects == 0) - { + if ((mmesa->draw_buffer != MGA_FRONT) + || (driDrawable->numBackClipRects == 0)) { if (driDrawable->numClipRects == 0) { static drm_clip_rect_t zeroareacliprect = {0,0,0,0}; mmesa->numClipRects = 1; @@ -801,10 +781,7 @@ void mgaUpdateRects( mgaContextPtr mmesa, GLuint buffers ) DRI_VALIDATE_DRAWABLE_INFO(mmesa->driScreen, driDrawable); mmesa->dirty_cliprects = 0; - if (mmesa->draw_buffer == MGA_FRONT) - mgaXMesaSetFrontClipRects( mmesa ); - else - mgaXMesaSetBackClipRects( mmesa ); + mga_set_cliprects(mmesa); sarea->req_drawable = driDrawable->draw; sarea->req_draw_buffer = mmesa->draw_buffer; @@ -828,23 +805,21 @@ static void mgaDDDrawBuffer(GLcontext *ctx, GLenum mode ) switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) { case BUFFER_BIT_FRONT_LEFT: mmesa->setup.dstorg = mmesa->mgaScreen->frontOffset; - mmesa->dirty |= MGA_UPLOAD_CONTEXT; mmesa->draw_buffer = MGA_FRONT; - mgaXMesaSetFrontClipRects( mmesa ); - FALLBACK( ctx, MGA_FALLBACK_DRAW_BUFFER, GL_FALSE ); break; case BUFFER_BIT_BACK_LEFT: mmesa->setup.dstorg = mmesa->mgaScreen->backOffset; mmesa->draw_buffer = MGA_BACK; - mmesa->dirty |= MGA_UPLOAD_CONTEXT; - mgaXMesaSetBackClipRects( mmesa ); - FALLBACK( ctx, MGA_FALLBACK_DRAW_BUFFER, GL_FALSE ); break; default: /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */ FALLBACK( ctx, MGA_FALLBACK_DRAW_BUFFER, GL_TRUE ); return; } + + mmesa->dirty |= MGA_UPLOAD_CONTEXT; + mga_set_cliprects(mmesa); + FALLBACK(ctx, MGA_FALLBACK_DRAW_BUFFER, GL_FALSE); } |