summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2002-11-13 16:46:19 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2002-11-13 16:46:19 +0000
commit4d7a1289ed5e82004ef675ba2fbb084b968d96b7 (patch)
tree325efb758ba2c0faa2a677db67987100cad0625d /src
parent9d88c7d8f47bd4bed5f7c9ba60e5fdf8a5c98bb2 (diff)
optimized color buffer clear fallback (use mono-color span functions
Diffstat (limited to 'src')
-rw-r--r--src/mesa/swrast/s_buffers.c39
1 files changed, 11 insertions, 28 deletions
diff --git a/src/mesa/swrast/s_buffers.c b/src/mesa/swrast/s_buffers.c
index 81f8cd1029..cdb665fc18 100644
--- a/src/mesa/swrast/s_buffers.c
+++ b/src/mesa/swrast/s_buffers.c
@@ -1,8 +1,8 @@
-/* $Id: s_buffers.c,v 1.15 2002/10/24 23:57:24 brianp Exp $ */
+/* $Id: s_buffers.c,v 1.16 2002/11/13 16:46:19 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
@@ -68,7 +68,7 @@ clear_color_buffer_with_masking( GLcontext *ctx )
}
_mesa_mask_rgba_array( ctx, width, x, y + i, rgba );
(*swrast->Driver.WriteRGBASpan)( ctx, width, x, y + i,
- (CONST GLchan (*)[4]) rgba, NULL );
+ (CONST GLchan (*)[4]) rgba, NULL );
}
}
else {
@@ -104,7 +104,6 @@ clear_color_buffer(GLcontext *ctx)
if (ctx->Visual.rgbMode) {
/* RGBA mode */
GLchan clearColor[4];
- GLchan span[MAX_WIDTH][4];
GLint i;
CLAMPED_FLOAT_TO_CHAN(clearColor[RCOMP], ctx->Color.ClearColor[0]);
@@ -113,38 +112,22 @@ clear_color_buffer(GLcontext *ctx)
CLAMPED_FLOAT_TO_CHAN(clearColor[ACOMP], ctx->Color.ClearColor[3]);
ASSERT(*((GLuint *) &ctx->Color.ColorMask) == 0xffffffff);
+ ASSERT(swrast->Driver.WriteRGBASpan);
- for (i = 0; i < width; i++) {
- COPY_CHAN4(span[i], clearColor);
- }
for (i = 0; i < height; i++) {
- (*swrast->Driver.WriteRGBASpan)( ctx, width, x, y + i,
- (CONST GLchan (*)[4]) span, NULL );
+ (*swrast->Driver.WriteMonoRGBASpan)( ctx, width, x, y + i,
+ clearColor, NULL );
}
}
else {
/* Color index mode */
+ GLint i;
ASSERT((ctx->Color.IndexMask & ((1 << ctx->Visual.indexBits) - 1))
== (GLuint) ((1 << ctx->Visual.indexBits) - 1));
- if (ctx->Visual.indexBits == 8) {
- /* 8-bit clear */
- GLubyte span[MAX_WIDTH];
- GLint i;
- MEMSET(span, ctx->Color.ClearIndex, width);
- for (i = 0; i < height; i++) {
- (*swrast->Driver.WriteCI8Span)( ctx, width, x, y + i, span, NULL );
- }
- }
- else {
- /* non 8-bit clear */
- GLuint span[MAX_WIDTH];
- GLint i;
- for (i = 0; i < width; i++) {
- span[i] = ctx->Color.ClearIndex;
- }
- for (i = 0; i < height; i++) {
- (*swrast->Driver.WriteCI32Span)( ctx, width, x, y + i, span, NULL );
- }
+ ASSERT(swrast->Driver.WriteMonoCISpan);
+ for (i = 0; i < height; i++) {
+ (*swrast->Driver.WriteMonoCISpan)( ctx, width, x, y + i,
+ ctx->Color.ClearIndex, NULL);
}
}
}