-/* $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
* Input: ctx - the context
*
*/
-static void
+static void
alloc_alpha_buffers( GLcontext *ctx, GLframebuffer *buf )
{
GLint bytes = buf->Width * buf->Height * sizeof(GLchan);
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;
#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
}
}
}
}
}
}
-
-
-