added missing \'s
[mesa.git] / src / mesa / swrast / s_alphabuf.c
index 5fbb6a36095085afa7446fa5b241b54444baf5b0..8c324a4588a2fc6538abfb899d008f6cb19c2c9b 100644 (file)
@@ -1,21 +1,21 @@
-/* $Id: s_alphabuf.c,v 1.5 2001/03/03 20:33:30 brianp Exp $ */
+/* $Id: s_alphabuf.c,v 1.7 2001/05/11 18:58:32 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
  * Version:  3.5
- * 
+ *
  * Copyright (C) 1999-2001  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"),
  * to deal in the Software without restriction, including without limitation
  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  * and/or sell copies of the Software, and to permit persons to whom the
  * Software is furnished to do so, subject to the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice shall be included
  * in all copies or substantial portions of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
@@ -53,7 +53,7 @@
  * Input: ctx - the context
  *
  */
-static void 
+static void
 alloc_alpha_buffers( GLcontext *ctx, GLframebuffer *buf )
 {
    GLint bytes = buf->Width * buf->Height * sizeof(GLchan);
@@ -164,6 +164,7 @@ _mesa_clear_alpha_buffers( GLcontext *ctx )
             GLint j;
             GLint rowLen = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin + 1;
             GLint rows = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin + 1;
+            GLint width = ctx->DrawBuffer->Width;
             GLchan *aptr = buffer
                           + ctx->DrawBuffer->_Ymin * ctx->DrawBuffer->Width
                           + ctx->DrawBuffer->_Xmin;
@@ -175,13 +176,19 @@ _mesa_clear_alpha_buffers( GLcontext *ctx )
 #else
 #error unexpected CHAN_BITS value
 #endif
-               aptr += rowLen;
+               aptr += width;
             }
          }
          else {
             /* clear whole buffer */
-            GLuint bytes = ctx->DrawBuffer->Width * ctx->DrawBuffer->Height;
-            MEMSET( buffer, aclear, bytes );
+            GLuint pixels = ctx->DrawBuffer->Width * ctx->DrawBuffer->Height;
+#if CHAN_BITS == 8
+            MEMSET(buffer, aclear, pixels);
+#elif CHAN_BITS == 16
+            MEMSET16(buffer, aclear, pixels);
+#else
+#error unexpected CHAN_BITS value
+#endif
          }
       }
    }
@@ -309,6 +316,3 @@ _mesa_read_alpha_pixels( GLcontext *ctx,
       }
    }
 }
-
-
-