changed gl_frame_buffer Xmax and Ymax to be exclusive boundary values

This commit is contained in:
Brian Paul
2000-09-08 21:28:04 +00:00
parent e18e0e98fe
commit 48c6a6ecd2
7 changed files with 57 additions and 39 deletions

View File

@@ -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 * Mesa 3-D graphics library
* Version: 3.3 * Version: 3.5
* *
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * 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); b = (GLaccum) (ctx->Accum.ClearColor[2] * acc_scale);
a = (GLaccum) (ctx->Accum.ClearColor[3] * acc_scale); a = (GLaccum) (ctx->Accum.ClearColor[3] * acc_scale);
/* size of region to clear */ /* size of region to clear */
width = 4 * (ctx->DrawBuffer->Xmax - ctx->DrawBuffer->Xmin + 1); width = 4 * (ctx->DrawBuffer->Xmax - ctx->DrawBuffer->Xmin);
height = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin + 1; height = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin;
/* ptr to first element to clear */ /* ptr to first element to clear */
row = ctx->DrawBuffer->Accum row = ctx->DrawBuffer->Accum
+ 4 * (ctx->DrawBuffer->Ymin * ctx->DrawBuffer->Width + 4 * (ctx->DrawBuffer->Ymin * ctx->DrawBuffer->Width

View File

@@ -1,7 +1,8 @@
/* $Id: buffers.c,v 1.11 2000/09/08 21:28:04 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.3 * Version: 3.5
* *
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * 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 x = ctx->DrawBuffer->Xmin;
const GLint y = ctx->DrawBuffer->Ymin; const GLint y = ctx->DrawBuffer->Ymin;
const GLint height = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin + 1; const GLint height = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin;
const GLint width = ctx->DrawBuffer->Xmax - ctx->DrawBuffer->Xmin + 1; const GLint width = ctx->DrawBuffer->Xmax - ctx->DrawBuffer->Xmin;
if (ctx->Visual->RGBAflag) { if (ctx->Visual->RGBAflag) {
/* RGBA mode */ /* RGBA mode */
@@ -140,8 +141,8 @@ clear_color_buffer(GLcontext *ctx)
{ {
const GLint x = ctx->DrawBuffer->Xmin; const GLint x = ctx->DrawBuffer->Xmin;
const GLint y = ctx->DrawBuffer->Ymin; const GLint y = ctx->DrawBuffer->Ymin;
const GLint height = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin + 1; const GLint height = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin;
const GLint width = ctx->DrawBuffer->Xmax - ctx->DrawBuffer->Xmin + 1; const GLint width = ctx->DrawBuffer->Xmax - ctx->DrawBuffer->Xmin;
const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask); const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask);
if (ctx->Visual->RGBAflag) { if (ctx->Visual->RGBAflag) {
@@ -255,8 +256,8 @@ _mesa_Clear( GLbitfield mask )
if (ctx->RenderMode==GL_RENDER) { if (ctx->RenderMode==GL_RENDER) {
const GLint x = ctx->DrawBuffer->Xmin; const GLint x = ctx->DrawBuffer->Xmin;
const GLint y = ctx->DrawBuffer->Ymin; const GLint y = ctx->DrawBuffer->Ymin;
const GLint height = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin + 1; const GLint height = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin;
const GLint width = ctx->DrawBuffer->Xmax - ctx->DrawBuffer->Xmin + 1; const GLint width = ctx->DrawBuffer->Xmax - ctx->DrawBuffer->Xmin;
GLbitfield ddMask; GLbitfield ddMask;
GLbitfield newMask; GLbitfield newMask;

View File

@@ -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 * Mesa 3-D graphics library
@@ -2050,3 +2050,20 @@ _mesa_Flush( void )
(*ctx->Driver.Flush)( ctx ); (*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"
};

View File

@@ -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 * Mesa 3-D graphics library
@@ -1629,7 +1629,7 @@ _mesa_clear_depth_buffer( GLcontext *ctx )
/* only clear scissor region */ /* only clear scissor region */
if (ctx->Visual->DepthBits <= 16) { if (ctx->Visual->DepthBits <= 16) {
const GLushort clearValue = (GLushort) (ctx->Depth.Clear * ctx->Visual->DepthMax); 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; const GLint width = ctx->DrawBuffer->Width;
GLushort *dRow = (GLushort *) ctx->DrawBuffer->DepthBuffer GLushort *dRow = (GLushort *) ctx->DrawBuffer->DepthBuffer
+ ctx->DrawBuffer->Ymin * width + ctx->DrawBuffer->Xmin; + ctx->DrawBuffer->Ymin * width + ctx->DrawBuffer->Xmin;
@@ -1643,7 +1643,7 @@ _mesa_clear_depth_buffer( GLcontext *ctx )
} }
else { else {
const GLuint clearValue = (GLuint) (ctx->Depth.Clear * ctx->Visual->DepthMax); 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; const GLint width = ctx->DrawBuffer->Width;
GLuint *dRow = (GLuint *) ctx->DrawBuffer->DepthBuffer GLuint *dRow = (GLuint *) ctx->DrawBuffer->DepthBuffer
+ ctx->DrawBuffer->Ymin * width + ctx->DrawBuffer->Xmin; + ctx->DrawBuffer->Ymin * width + ctx->DrawBuffer->Xmin;

View File

@@ -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 * Mesa 3-D graphics library
@@ -72,7 +72,7 @@ _mesa_clip_pixelrect(const GLcontext *ctx,
} }
/* right clipping */ /* right clipping */
if (*destX + *width > buffer->Xmax) if (*destX + *width > buffer->Xmax)
*width -= (*destX + *width - buffer->Xmax - 1); *width -= (*destX + *width - buffer->Xmax);
if (*width <= 0) if (*width <= 0)
return GL_FALSE; return GL_FALSE;
@@ -85,7 +85,7 @@ _mesa_clip_pixelrect(const GLcontext *ctx,
} }
/* top clipping */ /* top clipping */
if (*destY + *height > buffer->Ymax) if (*destY + *height > buffer->Ymax)
*height -= (*destY + *height - buffer->Ymax - 1); *height -= (*destY + *height - buffer->Ymax);
if (*height <= 0) if (*height <= 0)
return GL_TRUE; return GL_TRUE;
@@ -161,7 +161,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
destX = ctx->DrawBuffer->Xmin; destX = ctx->DrawBuffer->Xmin;
} }
if (destX + drawWidth > ctx->DrawBuffer->Xmax) if (destX + drawWidth > ctx->DrawBuffer->Xmax)
drawWidth -= (destX + drawWidth - ctx->DrawBuffer->Xmax - 1); drawWidth -= (destX + drawWidth - ctx->DrawBuffer->Xmax);
if (drawWidth <= 0) if (drawWidth <= 0)
return GL_TRUE; return GL_TRUE;
@@ -172,7 +172,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
destY = ctx->DrawBuffer->Ymin; destY = ctx->DrawBuffer->Ymin;
} }
if (destY + drawHeight > ctx->DrawBuffer->Ymax) if (destY + drawHeight > ctx->DrawBuffer->Ymax)
drawHeight -= (destY + drawHeight - ctx->DrawBuffer->Ymax - 1); drawHeight -= (destY + drawHeight - ctx->DrawBuffer->Ymax);
if (drawHeight <= 0) if (drawHeight <= 0)
return GL_TRUE; return GL_TRUE;
} }
@@ -185,15 +185,15 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
destX = ctx->DrawBuffer->Xmin; destX = ctx->DrawBuffer->Xmin;
} }
if (destX + drawWidth > ctx->DrawBuffer->Xmax) if (destX + drawWidth > ctx->DrawBuffer->Xmax)
drawWidth -= (destX + drawWidth - ctx->DrawBuffer->Xmax - 1); drawWidth -= (destX + drawWidth - ctx->DrawBuffer->Xmax);
if (drawWidth <= 0) if (drawWidth <= 0)
return GL_TRUE; return GL_TRUE;
/* vertical clipping */ /* vertical clipping */
if (destY > ctx->DrawBuffer->Ymax) { if (destY > ctx->DrawBuffer->Ymax) {
skipRows += (destY - ctx->DrawBuffer->Ymax - 1); skipRows += (destY - ctx->DrawBuffer->Ymax);
drawHeight -= (destY - ctx->DrawBuffer->Ymax - 1); drawHeight -= (destY - ctx->DrawBuffer->Ymax);
destY = ctx->DrawBuffer->Ymax + 1; destY = ctx->DrawBuffer->Ymax;
} }
if (destY - drawHeight < ctx->DrawBuffer->Ymin) if (destY - drawHeight < ctx->DrawBuffer->Ymin)
drawHeight -= (ctx->DrawBuffer->Ymin - (destY - drawHeight)); drawHeight -= (ctx->DrawBuffer->Ymin - (destY - drawHeight));

View File

@@ -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 * Mesa 3-D graphics library
@@ -892,8 +892,8 @@ void gl_update_state( GLcontext *ctx )
/* update scissor region */ /* update scissor region */
ctx->DrawBuffer->Xmin = 0; ctx->DrawBuffer->Xmin = 0;
ctx->DrawBuffer->Ymin = 0; ctx->DrawBuffer->Ymin = 0;
ctx->DrawBuffer->Xmax = ctx->DrawBuffer->Width-1; ctx->DrawBuffer->Xmax = ctx->DrawBuffer->Width;
ctx->DrawBuffer->Ymax = ctx->DrawBuffer->Height-1; ctx->DrawBuffer->Ymax = ctx->DrawBuffer->Height;
if (ctx->Scissor.Enabled) { if (ctx->Scissor.Enabled) {
if (ctx->Scissor.X > ctx->DrawBuffer->Xmin) { if (ctx->Scissor.X > ctx->DrawBuffer->Xmin) {
ctx->DrawBuffer->Xmin = ctx->Scissor.X; ctx->DrawBuffer->Xmin = ctx->Scissor.X;
@@ -901,11 +901,11 @@ void gl_update_state( GLcontext *ctx )
if (ctx->Scissor.Y > ctx->DrawBuffer->Ymin) { if (ctx->Scissor.Y > ctx->DrawBuffer->Ymin) {
ctx->DrawBuffer->Ymin = ctx->Scissor.Y; ctx->DrawBuffer->Ymin = ctx->Scissor.Y;
} }
if (ctx->Scissor.X + ctx->Scissor.Width - 1 < ctx->DrawBuffer->Xmax) { if (ctx->Scissor.X + ctx->Scissor.Width < ctx->DrawBuffer->Xmax) {
ctx->DrawBuffer->Xmax = ctx->Scissor.X + ctx->Scissor.Width - 1; ctx->DrawBuffer->Xmax = ctx->Scissor.X + ctx->Scissor.Width;
} }
if (ctx->Scissor.Y + ctx->Scissor.Height - 1 < ctx->DrawBuffer->Ymax) { if (ctx->Scissor.Y + ctx->Scissor.Height < ctx->DrawBuffer->Ymax) {
ctx->DrawBuffer->Ymax = ctx->Scissor.Y + ctx->Scissor.Height - 1; ctx->DrawBuffer->Ymax = ctx->Scissor.Y + ctx->Scissor.Height;
} }
} }
} }

View File

@@ -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 * Mesa 3-D graphics library
* Version: 3.3 * Version: 3.5
* *
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
* *
@@ -1275,11 +1275,11 @@ clear_software_stencil_buffer( GLcontext *ctx )
if (ctx->Scissor.Enabled) { if (ctx->Scissor.Enabled) {
/* clear scissor region only */ /* 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) { if (ctx->Stencil.WriteMask != STENCIL_MAX) {
/* must apply mask to the clear */ /* must apply mask to the clear */
GLint y; 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 mask = ctx->Stencil.WriteMask;
const GLstencil invMask = ~mask; const GLstencil invMask = ~mask;
const GLstencil clearVal = (ctx->Stencil.Clear & mask); const GLstencil clearVal = (ctx->Stencil.Clear & mask);
@@ -1293,7 +1293,7 @@ clear_software_stencil_buffer( GLcontext *ctx )
else { else {
/* no masking */ /* no masking */
GLint y; 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 ); GLstencil *stencil = STENCIL_ADDRESS( ctx->DrawBuffer->Xmin, y );
#if STENCIL_BITS==8 #if STENCIL_BITS==8
MEMSET( stencil, ctx->Stencil.Clear, width * sizeof(GLstencil) ); MEMSET( stencil, ctx->Stencil.Clear, width * sizeof(GLstencil) );
@@ -1356,11 +1356,11 @@ clear_hardware_stencil_buffer( GLcontext *ctx )
if (ctx->Scissor.Enabled) { if (ctx->Scissor.Enabled) {
/* clear scissor region only */ /* clear scissor region only */
const GLint x = ctx->DrawBuffer->Xmin; 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) { if (ctx->Stencil.WriteMask != STENCIL_MAX) {
/* must apply mask to the clear */ /* must apply mask to the clear */
GLint y; 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 mask = ctx->Stencil.WriteMask;
const GLstencil invMask = ~mask; const GLstencil invMask = ~mask;
const GLstencil clearVal = (ctx->Stencil.Clear & mask); const GLstencil clearVal = (ctx->Stencil.Clear & mask);
@@ -1380,7 +1380,7 @@ clear_hardware_stencil_buffer( GLcontext *ctx )
for (i = 0; i < width; i++) { for (i = 0; i < width; i++) {
stencil[i] = ctx->Stencil.Clear; 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); (*ctx->Driver.WriteStencilSpan)(ctx, x, y, width, stencil, NULL);
} }
} }