summaryrefslogtreecommitdiff
path: root/src/mesa/main/buffers.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2001-01-24 00:04:58 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2001-01-24 00:04:58 +0000
commit74b493a5e61237de081a438e774e5d8139d4c6b7 (patch)
treea8bc94a65bacc67b9b1473f91a2bd84cd2b25937 /src/mesa/main/buffers.c
parent125fddc31dc9959901d9f1ece693b09f04426d48 (diff)
Lots of GLchan datatype changes.
Added GLvector4us datatype in math/m_vector.[ch] Added _math_trans_4us() in math/m_translate.[ch] Choose GLvector4ub, GLvector4us, GLvector4f at compile time based on CHAN_BITS. Made Driver.ClearColor() and Driver.ClearIndex() optional driver functions. Changed args to Driver.ClearColor(), updated drivers. Reordered files in Makefile.X11
Diffstat (limited to 'src/mesa/main/buffers.c')
-rw-r--r--src/mesa/main/buffers.c37
1 files changed, 15 insertions, 22 deletions
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index 410524e335..0699e74b90 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -1,4 +1,4 @@
-/* $Id: buffers.c,v 1.23 2001/01/23 23:39:36 brianp Exp $ */
+/* $Id: buffers.c,v 1.24 2001/01/24 00:04:58 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -31,6 +31,7 @@
#include "glheader.h"
#include "accum.h"
#include "buffers.h"
+#include "colormac.h"
#include "context.h"
#include "depth.h"
#include "enums.h"
@@ -51,14 +52,13 @@ _mesa_ClearIndex( GLfloat c )
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
- if (ctx->Color.ClearIndex == (GLuint)c)
+ if (ctx->Color.ClearIndex == (GLuint) c)
return;
-
FLUSH_VERTICES(ctx, _NEW_COLOR);
ctx->Color.ClearIndex = (GLuint) c;
- if (!ctx->Visual.rgbMode) {
+ if (!ctx->Visual.rgbMode && ctx->Driver.ClearIndex) {
/* it's OK to call glClearIndex in RGBA mode but it should be a NOP */
(*ctx->Driver.ClearIndex)( ctx, ctx->Color.ClearIndex );
}
@@ -67,38 +67,31 @@ _mesa_ClearIndex( GLfloat c )
void
-_mesa_ClearColor( GLclampf red, GLclampf green,
- GLclampf blue, GLclampf alpha )
+_mesa_ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
{
- GLfloat tmp[4];
+ GLchan tmp[4];
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
- tmp[0] = CLAMP( red, 0.0, 1.0 );
- tmp[1] = CLAMP( green, 0.0, 1.0 );
- tmp[2] = CLAMP( blue, 0.0, 1.0 );
- tmp[3] = CLAMP( alpha, 0.0, 1.0 );
+ UNCLAMPED_FLOAT_TO_CHAN(tmp[0], red);
+ UNCLAMPED_FLOAT_TO_CHAN(tmp[1], green);
+ UNCLAMPED_FLOAT_TO_CHAN(tmp[2], blue);
+ UNCLAMPED_FLOAT_TO_CHAN(tmp[3], alpha);
if (TEST_EQ_4V(tmp, ctx->Color.ClearColor))
return;
FLUSH_VERTICES(ctx, _NEW_COLOR);
- COPY_4FV( ctx->Color.ClearColor, tmp );
-
- if (ctx->Visual.rgbMode) {
- GLchan r = (GLint) (ctx->Color.ClearColor[0] * CHAN_MAXF);
- GLchan g = (GLint) (ctx->Color.ClearColor[1] * CHAN_MAXF);
- GLchan b = (GLint) (ctx->Color.ClearColor[2] * CHAN_MAXF);
- GLchan a = (GLint) (ctx->Color.ClearColor[3] * CHAN_MAXF);
- (*ctx->Driver.ClearColor)( ctx, r, g, b, a );
+ COPY_CHAN4(ctx->Color.ClearColor, tmp);
+
+ if (ctx->Visual.rgbMode && ctx->Driver.ClearColor) {
+ /* it's OK to call glClearColor in CI mode but it should be a NOP */
+ (*ctx->Driver.ClearColor)(ctx, ctx->Color.ClearColor);
}
}
-
-
-
void
_mesa_Clear( GLbitfield mask )
{