diff options
author | Ian Romanick <[email protected]> | 2013-12-09 11:54:41 -0800 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2014-01-20 11:31:59 -0800 |
commit | 5232a7ded0c3a302ee0b551436b8f64a298d221c (patch) | |
tree | c96ac9aab3336ce29da06c6437e2e5722cfecf7a /src | |
parent | 799265aadcec6a7cf8918b5a8b4792016534b9c2 (diff) |
mesa: Refactor scissor rectangle setting even more
Create an internal function that just writes data into the scissor
rectangle. In future patches this will see more use because we only
want to call dd_function_table::Scissor once after setting all of the
scissor rectangles instead of once per scissor rectangle.
Signed-off-by: Ian Romanick <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/scissor.c | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/src/mesa/main/scissor.c b/src/mesa/main/scissor.c index 7ec927ecd8b..cc4ce69c361 100644 --- a/src/mesa/main/scissor.c +++ b/src/mesa/main/scissor.c @@ -30,6 +30,31 @@ /** + * Set scissor rectangle data directly in ScissorArray + * + * This is an internal function that performs no error checking on the + * supplied data. It also does \b not call \c dd_function_table::Scissor. + * + * \sa _mesa_set_scissor + */ +static void +set_scissor_no_notify(struct gl_context *ctx, unsigned idx, + GLint x, GLint y, GLsizei width, GLsizei height) +{ + if (x == ctx->Scissor.ScissorArray[idx].X && + y == ctx->Scissor.ScissorArray[idx].Y && + width == ctx->Scissor.ScissorArray[idx].Width && + height == ctx->Scissor.ScissorArray[idx].Height) + return; + + FLUSH_VERTICES(ctx, _NEW_SCISSOR); + ctx->Scissor.ScissorArray[idx].X = x; + ctx->Scissor.ScissorArray[idx].Y = y; + ctx->Scissor.ScissorArray[idx].Width = width; + ctx->Scissor.ScissorArray[idx].Height = height; +} + +/** * Called via glScissor */ void GLAPIENTRY @@ -66,17 +91,7 @@ void _mesa_set_scissor(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height) { - if (x == ctx->Scissor.ScissorArray[0].X && - y == ctx->Scissor.ScissorArray[0].Y && - width == ctx->Scissor.ScissorArray[0].Width && - height == ctx->Scissor.ScissorArray[0].Height) - return; - - FLUSH_VERTICES(ctx, _NEW_SCISSOR); - ctx->Scissor.ScissorArray[0].X = x; - ctx->Scissor.ScissorArray[0].Y = y; - ctx->Scissor.ScissorArray[0].Width = width; - ctx->Scissor.ScissorArray[0].Height = height; + set_scissor_no_notify(ctx, 0, x, y, width, height); if (ctx->Driver.Scissor) ctx->Driver.Scissor(ctx); @@ -92,8 +107,5 @@ _mesa_init_scissor(struct gl_context *ctx) { /* Scissor group */ ctx->Scissor.EnableFlags = GL_FALSE; - ctx->Scissor.ScissorArray[0].X = 0; - ctx->Scissor.ScissorArray[0].Y = 0; - ctx->Scissor.ScissorArray[0].Width = 0; - ctx->Scissor.ScissorArray[0].Height = 0; + set_scissor_no_notify(ctx, 0, 0, 0, 0, 0); } |