-/* $Id: accum.c,v 1.12 1999/11/24 18:48:30 brianp Exp $ */
+/* $Id: accum.c,v 1.17 2000/03/19 01:10:11 brianp Exp $ */
/*
* Mesa 3-D graphics library
#include "mem.h"
#include "masking.h"
#include "span.h"
+#include "state.h"
#include "types.h"
#endif
-void gl_alloc_accum_buffer( GLcontext *ctx )
+void
+_mesa_alloc_accum_buffer( GLcontext *ctx )
{
GLint n;
break;
case GL_ACCUM:
- (void) (*ctx->Driver.SetBuffer)( ctx, ctx->Pixel.DriverReadBuffer );
+ (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
+ ctx->Pixel.DriverReadBuffer );
/* May have to leave optimized accum buffer mode */
if (ctx->IntegerAccumScaler == 0.0 && value > 0.0 && value <= 1.0)
ypos++;
}
}
- (void) (*ctx->Driver.SetBuffer)( ctx, ctx->Color.DriverDrawBuffer );
+ /* restore read buffer = draw buffer (the default) */
+ (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
+ ctx->Color.DriverDrawBuffer );
break;
case GL_LOAD:
- (void) (*ctx->Driver.SetBuffer)( ctx, ctx->Pixel.DriverReadBuffer );
+ (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
+ ctx->Pixel.DriverReadBuffer );
/* This is a change to go into optimized accum buffer mode */
if (value > 0.0 && value <= 1.0) {
ypos++;
}
}
- (void) (*ctx->Driver.SetBuffer)( ctx, ctx->Color.DriverDrawBuffer );
+
+ /* restore read buffer = draw buffer (the default) */
+ (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
+ ctx->Color.DriverDrawBuffer );
break;
case GL_RETURN:
if (ctx->IntegerAccumMode && value != 1.0)
rescale_accum(ctx);
- if (ctx->IntegerAccumMode) {
+ if (ctx->IntegerAccumMode && ctx->IntegerAccumScaler > 0) {
/* build lookup table to avoid many floating point multiplies */
const GLfloat mult = ctx->IntegerAccumScaler;
static GLchan multTable[32768];
static GLfloat prevMult = 0.0;
GLuint j;
- const GLint max = 256 / mult;
+ const GLint max = (GLint) (256 / mult);
if (mult != prevMult) {
assert(max <= 32768);
for (j = 0; j < max; j++)
/*
* Clear the accumulation Buffer.
*/
-void gl_clear_accum_buffer( GLcontext *ctx )
+void
+_mesa_clear_accum_buffer( GLcontext *ctx )
{
GLuint buffersize;
GLfloat acc_scale;