fix GL_BACK color material bug
[mesa.git] / src / mesa / main / accum.c
index 17e37f08e35682bc7202835662a52e48679d802f..37967f21338fe7a6a535613db86b161e7e2c72b5 100644 (file)
@@ -1,10 +1,10 @@
-/* $Id: accum.c,v 1.18 2000/03/31 01:04:52 brianp Exp $ */
+/* $Id: accum.c,v 1.21 2000/06/19 00:42:24 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
  * Version:  3.3
  * 
- * Copyright (C) 1999  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2000  Brian Paul   All Rights Reserved.
  * 
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -188,7 +188,7 @@ _mesa_Accum( GLenum op, GLfloat value )
 
    switch (op) {
       case GL_ADD:
-         {
+         if (value != 0.0F) {
            const GLaccum intVal = (GLaccum) (value * acc_scale);
            GLuint j;
             /* Leave optimized accum buffer mode */
@@ -206,7 +206,7 @@ _mesa_Accum( GLenum op, GLfloat value )
         break;
 
       case GL_MULT:
-        {
+         if (value != 1.0F) {
            GLuint j;
             /* Leave optimized accum buffer mode */
             if (ctx->IntegerAccumMode)
@@ -223,6 +223,9 @@ _mesa_Accum( GLenum op, GLfloat value )
         break;
 
       case GL_ACCUM:
+         if (value == 0.0F)
+            return;
+
          (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
                                        ctx->Pixel.DriverReadBuffer );
 
@@ -375,7 +378,7 @@ _mesa_Accum( GLenum op, GLfloat value )
                   rgba[i][ACOMP] = multTable[acc[i4+3]];
                }
                if (ctx->Color.SWmasking) {
-                  gl_mask_rgba_span( ctx, width, xpos, ypos, rgba );
+                  _mesa_mask_rgba_span( ctx, width, xpos, ypos, rgba );
                }
                (*ctx->Driver.WriteRGBASpan)( ctx, width, xpos, ypos, 
                                              (const GLubyte (*)[4])rgba, NULL );
@@ -402,7 +405,7 @@ _mesa_Accum( GLenum op, GLfloat value )
                   rgba[i][ACOMP] = CLAMP( a, 0, iChanMax );
                }
                if (ctx->Color.SWmasking) {
-                  gl_mask_rgba_span( ctx, width, xpos, ypos, rgba );
+                  _mesa_mask_rgba_span( ctx, width, xpos, ypos, rgba );
                }
                (*ctx->Driver.WriteRGBASpan)( ctx, width, xpos, ypos, 
                                              (const GLubyte (*)[4])rgba, NULL );
@@ -487,7 +490,7 @@ _mesa_clear_accum_buffer( GLcontext *ctx )
             ctx->Accum.ClearColor[2]==0.0 &&
             ctx->Accum.ClearColor[3]==0.0) {
            /* Black */
-           MEMSET( ctx->DrawBuffer->Accum, 0, buffersize * 4 * sizeof(GLaccum) );
+           BZERO( ctx->DrawBuffer->Accum, buffersize * 4 * sizeof(GLaccum) );
         }
         else {
            /* Not black */