aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2001-02-08 15:57:01 +0000
committerBrian Paul <[email protected]>2001-02-08 15:57:01 +0000
commit1f12a07380e8cd4165d94c33661f1ada31f22222 (patch)
tree63ec91cb76f4f87daba778a59a68312de988a34c
parent1ceda0f84fdfe07951071fdf4fa643d07f09a4d7 (diff)
fixed bugs in _mesa_clear_depth_buffer(), bug #131366
-rw-r--r--src/mesa/swrast/s_depth.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c
index 92a5a12de1a..c5e1b45d101 100644
--- a/src/mesa/swrast/s_depth.c
+++ b/src/mesa/swrast/s_depth.c
@@ -1,4 +1,4 @@
-/* $Id: s_depth.c,v 1.4 2001/01/23 23:39:37 brianp Exp $ */
+/* $Id: s_depth.c,v 1.5 2001/02/08 15:57:01 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1539,29 +1539,31 @@ _mesa_clear_depth_buffer( GLcontext *ctx )
if (ctx->Visual.depthBits <= 16) {
const GLushort clearValue = (GLushort) (ctx->Depth.Clear * ctx->DepthMax);
const GLint rows = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
- const GLint width = ctx->DrawBuffer->Width;
+ const GLint cols = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
+ const GLint rowStride = ctx->DrawBuffer->Width;
GLushort *dRow = (GLushort *) ctx->DrawBuffer->DepthBuffer
- + ctx->DrawBuffer->_Ymin * width + ctx->DrawBuffer->_Xmin;
+ + ctx->DrawBuffer->_Ymin * rowStride + ctx->DrawBuffer->_Xmin;
GLint i, j;
for (i = 0; i < rows; i++) {
- for (j = 0; j < width; j++) {
+ for (j = 0; j < cols; j++) {
dRow[j] = clearValue;
}
- dRow += width;
+ dRow += rowStride;
}
}
else {
const GLuint clearValue = (GLuint) (ctx->Depth.Clear * ctx->DepthMax);
const GLint rows = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
- const GLint width = ctx->DrawBuffer->Width;
+ const GLint cols = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
+ const GLint rowStride = ctx->DrawBuffer->Width;
GLuint *dRow = (GLuint *) ctx->DrawBuffer->DepthBuffer
- + ctx->DrawBuffer->_Ymin * width + ctx->DrawBuffer->_Xmin;
+ + ctx->DrawBuffer->_Ymin * rowStride + ctx->DrawBuffer->_Xmin;
GLint i, j;
for (i = 0; i < rows; i++) {
- for (j = 0; j < width; j++) {
+ for (j = 0; j < cols; j++) {
dRow[j] = clearValue;
}
- dRow += width;
+ dRow += rowStride;
}
}
}