diff options
-rw-r--r-- | src/mesa/swrast/s_clear.c | 109 |
1 files changed, 6 insertions, 103 deletions
diff --git a/src/mesa/swrast/s_clear.c b/src/mesa/swrast/s_clear.c index 820297f3eee..7b0a63391fa 100644 --- a/src/mesa/swrast/s_clear.c +++ b/src/mesa/swrast/s_clear.c @@ -51,7 +51,6 @@ clear_rgba_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb, SWspan span; GLint i; - ASSERT(ctx->Visual.rgbMode); ASSERT(rb->PutRow); /* Initialize color span with clear color */ @@ -105,45 +104,6 @@ clear_rgba_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb, /** - * Clear color index buffer with masking. - */ -static void -clear_ci_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb) -{ - const GLint x = ctx->DrawBuffer->_Xmin; - const GLint y = ctx->DrawBuffer->_Ymin; - const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin; - const GLint width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin; - SWspan span; - GLint i; - - ASSERT(!ctx->Visual.rgbMode); - ASSERT(rb->PutRow); - ASSERT(rb->DataType == GL_UNSIGNED_INT); - - /* Initialize index span with clear index */ - INIT_SPAN(span, GL_BITMAP); - span.end = width; - span.arrayMask = SPAN_INDEX; - for (i = 0; i < width;i++) { - span.array->index[i] = ctx->Color.ClearIndex; - } - - /* Note that masking will change the color indexes, but only the - * bits for which the write mask is GL_FALSE. The bits - * which are write-enabled won't get modified. - */ - for (i = 0; i < height;i++) { - span.x = x; - span.y = y + i; - _swrast_mask_ci_span(ctx, rb, &span); - /* write masked row */ - rb->PutRow(ctx, rb, width, x, y + i, span.array->index, NULL); - } -} - - -/** * Clear an rgba color buffer without channel masking. */ static void @@ -158,8 +118,6 @@ clear_rgba_buffer(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint buf) GLvoid *clearVal; GLint i; - ASSERT(ctx->Visual.rgbMode); - ASSERT(ctx->Color.ColorMask[buf][0] && ctx->Color.ColorMask[buf][1] && ctx->Color.ColorMask[buf][2] && @@ -197,50 +155,6 @@ clear_rgba_buffer(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint buf) /** - * Clear color index buffer without masking. - */ -static void -clear_ci_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) -{ - const GLint x = ctx->DrawBuffer->_Xmin; - const GLint y = ctx->DrawBuffer->_Ymin; - const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin; - const GLint width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin; - GLubyte clear8; - GLushort clear16; - GLuint clear32; - GLvoid *clearVal; - GLint i; - - ASSERT(!ctx->Visual.rgbMode); - - ASSERT(rb->PutMonoRow); - - /* setup clear value */ - switch (rb->DataType) { - case GL_UNSIGNED_BYTE: - clear8 = (GLubyte) ctx->Color.ClearIndex; - clearVal = &clear8; - break; - case GL_UNSIGNED_SHORT: - clear16 = (GLushort) ctx->Color.ClearIndex; - clearVal = &clear16; - break; - case GL_UNSIGNED_INT: - clear32 = ctx->Color.ClearIndex; - clearVal = &clear32; - break; - default: - _mesa_problem(ctx, "Bad rb DataType in clear_color_buffer"); - return; - } - - for (i = 0; i < height; i++) - rb->PutMonoRow(ctx, rb, width, x, y + i, clearVal, NULL); -} - - -/** * Clear the front/back/left/right/aux color buffers. * This function is usually only called if the device driver can't * clear its own color buffers for some reason (such as with masking). @@ -252,25 +166,14 @@ clear_color_buffers(GLcontext *ctx) for (buf = 0; buf < ctx->DrawBuffer->_NumColorDrawBuffers; buf++) { struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[buf]; - if (ctx->Visual.rgbMode) { - if (ctx->Color.ColorMask[buf][0] == 0 || - ctx->Color.ColorMask[buf][1] == 0 || - ctx->Color.ColorMask[buf][2] == 0 || - ctx->Color.ColorMask[buf][3] == 0) { - clear_rgba_buffer_with_masking(ctx, rb, buf); - } - else { - clear_rgba_buffer(ctx, rb, buf); - } + if (ctx->Color.ColorMask[buf][0] == 0 || + ctx->Color.ColorMask[buf][1] == 0 || + ctx->Color.ColorMask[buf][2] == 0 || + ctx->Color.ColorMask[buf][3] == 0) { + clear_rgba_buffer_with_masking(ctx, rb, buf); } else { - const GLuint indexMask = (1 << _mesa_get_format_bits(rb->Format, GL_INDEX_BITS)) - 1; - if ((ctx->Color.IndexMask & indexMask) != indexMask) { - clear_ci_buffer_with_masking(ctx, rb); - } - else { - clear_ci_buffer(ctx, rb); - } + clear_rgba_buffer(ctx, rb, buf); } } } |