summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2000-09-08 21:28:04 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2000-09-08 21:28:04 +0000
commit48c6a6ecd2b94d73317f1579193d98101566217a (patch)
tree2de10e0a4070195594e73898d6051c3ad266d921
parente18e0e98fea2384892324c84bf463d65c1159f7b (diff)
changed gl_frame_buffer Xmax and Ymax to be exclusive boundary values
-rw-r--r--src/mesa/main/accum.c8
-rw-r--r--src/mesa/main/buffers.c15
-rw-r--r--src/mesa/main/context.c19
-rw-r--r--src/mesa/main/depth.c6
-rw-r--r--src/mesa/main/drawpix.c18
-rw-r--r--src/mesa/main/state.c14
-rw-r--r--src/mesa/main/stencil.c16
7 files changed, 57 insertions, 39 deletions
diff --git a/src/mesa/main/accum.c b/src/mesa/main/accum.c
index 7b2f1ca57e..3539418150 100644
--- a/src/mesa/main/accum.c
+++ b/src/mesa/main/accum.c
@@ -1,8 +1,8 @@
-/* $Id: accum.c,v 1.24 2000/09/07 15:45:26 brianp Exp $ */
+/* $Id: accum.c,v 1.25 2000/09/08 21:28:04 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.5
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
@@ -467,8 +467,8 @@ _mesa_clear_accum_buffer( GLcontext *ctx )
b = (GLaccum) (ctx->Accum.ClearColor[2] * acc_scale);
a = (GLaccum) (ctx->Accum.ClearColor[3] * acc_scale);
/* size of region to clear */
- width = 4 * (ctx->DrawBuffer->Xmax - ctx->DrawBuffer->Xmin + 1);
- height = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin + 1;
+ width = 4 * (ctx->DrawBuffer->Xmax - ctx->DrawBuffer->Xmin);
+ height = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin;
/* ptr to first element to clear */
row = ctx->DrawBuffer->Accum
+ 4 * (ctx->DrawBuffer->Ymin * ctx->DrawBuffer->Width
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index dd87009031..c53dd13704 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -1,7 +1,8 @@
+/* $Id: buffers.c,v 1.11 2000/09/08 21:28:04 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.5
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
@@ -90,8 +91,8 @@ clear_color_buffer_with_masking( GLcontext *ctx )
{
const GLint x = ctx->DrawBuffer->Xmin;
const GLint y = ctx->DrawBuffer->Ymin;
- const GLint height = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin + 1;
- const GLint width = ctx->DrawBuffer->Xmax - ctx->DrawBuffer->Xmin + 1;
+ const GLint height = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin;
+ const GLint width = ctx->DrawBuffer->Xmax - ctx->DrawBuffer->Xmin;
if (ctx->Visual->RGBAflag) {
/* RGBA mode */
@@ -140,8 +141,8 @@ clear_color_buffer(GLcontext *ctx)
{
const GLint x = ctx->DrawBuffer->Xmin;
const GLint y = ctx->DrawBuffer->Ymin;
- const GLint height = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin + 1;
- const GLint width = ctx->DrawBuffer->Xmax - ctx->DrawBuffer->Xmin + 1;
+ const GLint height = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin;
+ const GLint width = ctx->DrawBuffer->Xmax - ctx->DrawBuffer->Xmin;
const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask);
if (ctx->Visual->RGBAflag) {
@@ -255,8 +256,8 @@ _mesa_Clear( GLbitfield mask )
if (ctx->RenderMode==GL_RENDER) {
const GLint x = ctx->DrawBuffer->Xmin;
const GLint y = ctx->DrawBuffer->Ymin;
- const GLint height = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin + 1;
- const GLint width = ctx->DrawBuffer->Xmax - ctx->DrawBuffer->Xmin + 1;
+ const GLint height = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin;
+ const GLint width = ctx->DrawBuffer->Xmax - ctx->DrawBuffer->Xmin;
GLbitfield ddMask;
GLbitfield newMask;
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 5fbe5d0838..5ea29d924d 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1,4 +1,4 @@
-/* $Id: context.c,v 1.83 2000/09/07 15:45:27 brianp Exp $ */
+/* $Id: context.c,v 1.84 2000/09/08 21:28:04 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -2050,3 +2050,20 @@ _mesa_Flush( void )
(*ctx->Driver.Flush)( ctx );
}
}
+
+
+
+const char *_mesa_prim_name[GL_POLYGON+2] = {
+ "GL_POINTS",
+ "GL_LINES",
+ "GL_LINE_LOOP",
+ "GL_LINE_STRIP",
+ "GL_TRIANGLES",
+ "GL_TRIANGLE_STRIP",
+ "GL_TRIANGLE_FAN",
+ "GL_QUADS",
+ "GL_QUAD_STRIP",
+ "GL_POLYGON",
+ "culled primitive"
+};
+
diff --git a/src/mesa/main/depth.c b/src/mesa/main/depth.c
index 8a09206a6a..fc37c29c1c 100644
--- a/src/mesa/main/depth.c
+++ b/src/mesa/main/depth.c
@@ -1,4 +1,4 @@
-/* $Id: depth.c,v 1.17 2000/04/11 20:42:22 brianp Exp $ */
+/* $Id: depth.c,v 1.18 2000/09/08 21:28:04 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1629,7 +1629,7 @@ _mesa_clear_depth_buffer( GLcontext *ctx )
/* only clear scissor region */
if (ctx->Visual->DepthBits <= 16) {
const GLushort clearValue = (GLushort) (ctx->Depth.Clear * ctx->Visual->DepthMax);
- const GLint rows = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin + 1;
+ const GLint rows = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin;
const GLint width = ctx->DrawBuffer->Width;
GLushort *dRow = (GLushort *) ctx->DrawBuffer->DepthBuffer
+ ctx->DrawBuffer->Ymin * width + ctx->DrawBuffer->Xmin;
@@ -1643,7 +1643,7 @@ _mesa_clear_depth_buffer( GLcontext *ctx )
}
else {
const GLuint clearValue = (GLuint) (ctx->Depth.Clear * ctx->Visual->DepthMax);
- const GLint rows = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin + 1;
+ const GLint rows = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin;
const GLint width = ctx->DrawBuffer->Width;
GLuint *dRow = (GLuint *) ctx->DrawBuffer->DepthBuffer
+ ctx->DrawBuffer->Ymin * width + ctx->DrawBuffer->Xmin;
diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c
index 237e702151..7cf7b0030f 100644
--- a/src/mesa/main/drawpix.c
+++ b/src/mesa/main/drawpix.c
@@ -1,4 +1,4 @@
-/* $Id: drawpix.c,v 1.32 2000/09/06 17:44:52 brianp Exp $ */
+/* $Id: drawpix.c,v 1.33 2000/09/08 21:28:04 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -72,7 +72,7 @@ _mesa_clip_pixelrect(const GLcontext *ctx,
}
/* right clipping */
if (*destX + *width > buffer->Xmax)
- *width -= (*destX + *width - buffer->Xmax - 1);
+ *width -= (*destX + *width - buffer->Xmax);
if (*width <= 0)
return GL_FALSE;
@@ -85,7 +85,7 @@ _mesa_clip_pixelrect(const GLcontext *ctx,
}
/* top clipping */
if (*destY + *height > buffer->Ymax)
- *height -= (*destY + *height - buffer->Ymax - 1);
+ *height -= (*destY + *height - buffer->Ymax);
if (*height <= 0)
return GL_TRUE;
@@ -161,7 +161,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
destX = ctx->DrawBuffer->Xmin;
}
if (destX + drawWidth > ctx->DrawBuffer->Xmax)
- drawWidth -= (destX + drawWidth - ctx->DrawBuffer->Xmax - 1);
+ drawWidth -= (destX + drawWidth - ctx->DrawBuffer->Xmax);
if (drawWidth <= 0)
return GL_TRUE;
@@ -172,7 +172,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
destY = ctx->DrawBuffer->Ymin;
}
if (destY + drawHeight > ctx->DrawBuffer->Ymax)
- drawHeight -= (destY + drawHeight - ctx->DrawBuffer->Ymax - 1);
+ drawHeight -= (destY + drawHeight - ctx->DrawBuffer->Ymax);
if (drawHeight <= 0)
return GL_TRUE;
}
@@ -185,15 +185,15 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
destX = ctx->DrawBuffer->Xmin;
}
if (destX + drawWidth > ctx->DrawBuffer->Xmax)
- drawWidth -= (destX + drawWidth - ctx->DrawBuffer->Xmax - 1);
+ drawWidth -= (destX + drawWidth - ctx->DrawBuffer->Xmax);
if (drawWidth <= 0)
return GL_TRUE;
/* vertical clipping */
if (destY > ctx->DrawBuffer->Ymax) {
- skipRows += (destY - ctx->DrawBuffer->Ymax - 1);
- drawHeight -= (destY - ctx->DrawBuffer->Ymax - 1);
- destY = ctx->DrawBuffer->Ymax + 1;
+ skipRows += (destY - ctx->DrawBuffer->Ymax);
+ drawHeight -= (destY - ctx->DrawBuffer->Ymax);
+ destY = ctx->DrawBuffer->Ymax;
}
if (destY - drawHeight < ctx->DrawBuffer->Ymin)
drawHeight -= (ctx->DrawBuffer->Ymin - (destY - drawHeight));
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 9a40102f5d..e9f68398a4 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -1,4 +1,4 @@
-/* $Id: state.c,v 1.24 2000/09/07 15:45:27 brianp Exp $ */
+/* $Id: state.c,v 1.25 2000/09/08 21:28:04 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -892,8 +892,8 @@ void gl_update_state( GLcontext *ctx )
/* update scissor region */
ctx->DrawBuffer->Xmin = 0;
ctx->DrawBuffer->Ymin = 0;
- ctx->DrawBuffer->Xmax = ctx->DrawBuffer->Width-1;
- ctx->DrawBuffer->Ymax = ctx->DrawBuffer->Height-1;
+ ctx->DrawBuffer->Xmax = ctx->DrawBuffer->Width;
+ ctx->DrawBuffer->Ymax = ctx->DrawBuffer->Height;
if (ctx->Scissor.Enabled) {
if (ctx->Scissor.X > ctx->DrawBuffer->Xmin) {
ctx->DrawBuffer->Xmin = ctx->Scissor.X;
@@ -901,11 +901,11 @@ void gl_update_state( GLcontext *ctx )
if (ctx->Scissor.Y > ctx->DrawBuffer->Ymin) {
ctx->DrawBuffer->Ymin = ctx->Scissor.Y;
}
- if (ctx->Scissor.X + ctx->Scissor.Width - 1 < ctx->DrawBuffer->Xmax) {
- ctx->DrawBuffer->Xmax = ctx->Scissor.X + ctx->Scissor.Width - 1;
+ if (ctx->Scissor.X + ctx->Scissor.Width < ctx->DrawBuffer->Xmax) {
+ ctx->DrawBuffer->Xmax = ctx->Scissor.X + ctx->Scissor.Width;
}
- if (ctx->Scissor.Y + ctx->Scissor.Height - 1 < ctx->DrawBuffer->Ymax) {
- ctx->DrawBuffer->Ymax = ctx->Scissor.Y + ctx->Scissor.Height - 1;
+ if (ctx->Scissor.Y + ctx->Scissor.Height < ctx->DrawBuffer->Ymax) {
+ ctx->DrawBuffer->Ymax = ctx->Scissor.Y + ctx->Scissor.Height;
}
}
}
diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c
index c1d8bb29b3..f9cd4909df 100644
--- a/src/mesa/main/stencil.c
+++ b/src/mesa/main/stencil.c
@@ -1,8 +1,8 @@
-/* $Id: stencil.c,v 1.17 2000/08/30 18:23:08 brianp Exp $ */
+/* $Id: stencil.c,v 1.18 2000/09/08 21:28:04 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.5
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
@@ -1275,11 +1275,11 @@ clear_software_stencil_buffer( GLcontext *ctx )
if (ctx->Scissor.Enabled) {
/* clear scissor region only */
- const GLint width = ctx->DrawBuffer->Xmax - ctx->DrawBuffer->Xmin + 1;
+ const GLint width = ctx->DrawBuffer->Xmax - ctx->DrawBuffer->Xmin;
if (ctx->Stencil.WriteMask != STENCIL_MAX) {
/* must apply mask to the clear */
GLint y;
- for (y = ctx->DrawBuffer->Ymin; y <= ctx->DrawBuffer->Ymax; y++) {
+ for (y = ctx->DrawBuffer->Ymin; y < ctx->DrawBuffer->Ymax; y++) {
const GLstencil mask = ctx->Stencil.WriteMask;
const GLstencil invMask = ~mask;
const GLstencil clearVal = (ctx->Stencil.Clear & mask);
@@ -1293,7 +1293,7 @@ clear_software_stencil_buffer( GLcontext *ctx )
else {
/* no masking */
GLint y;
- for (y = ctx->DrawBuffer->Ymin; y <= ctx->DrawBuffer->Ymax; y++) {
+ for (y = ctx->DrawBuffer->Ymin; y < ctx->DrawBuffer->Ymax; y++) {
GLstencil *stencil = STENCIL_ADDRESS( ctx->DrawBuffer->Xmin, y );
#if STENCIL_BITS==8
MEMSET( stencil, ctx->Stencil.Clear, width * sizeof(GLstencil) );
@@ -1356,11 +1356,11 @@ clear_hardware_stencil_buffer( GLcontext *ctx )
if (ctx->Scissor.Enabled) {
/* clear scissor region only */
const GLint x = ctx->DrawBuffer->Xmin;
- const GLint width = ctx->DrawBuffer->Xmax - ctx->DrawBuffer->Xmin + 1;
+ const GLint width = ctx->DrawBuffer->Xmax - ctx->DrawBuffer->Xmin;
if (ctx->Stencil.WriteMask != STENCIL_MAX) {
/* must apply mask to the clear */
GLint y;
- for (y = ctx->DrawBuffer->Ymin; y <= ctx->DrawBuffer->Ymax; y++) {
+ for (y = ctx->DrawBuffer->Ymin; y < ctx->DrawBuffer->Ymax; y++) {
const GLstencil mask = ctx->Stencil.WriteMask;
const GLstencil invMask = ~mask;
const GLstencil clearVal = (ctx->Stencil.Clear & mask);
@@ -1380,7 +1380,7 @@ clear_hardware_stencil_buffer( GLcontext *ctx )
for (i = 0; i < width; i++) {
stencil[i] = ctx->Stencil.Clear;
}
- for (y = ctx->DrawBuffer->Ymin; y <= ctx->DrawBuffer->Ymax; y++) {
+ for (y = ctx->DrawBuffer->Ymin; y < ctx->DrawBuffer->Ymax; y++) {
(*ctx->Driver.WriteStencilSpan)(ctx, x, y, width, stencil, NULL);
}
}