diff options
-rw-r--r-- | src/mesa/swrast/s_context.c | 6 | ||||
-rw-r--r-- | src/mesa/swrast/s_copypix.c | 10 | ||||
-rw-r--r-- | src/mesa/swrast/s_depth.c | 18 | ||||
-rw-r--r-- | src/mesa/swrast/s_lines.c | 8 | ||||
-rw-r--r-- | src/mesa/swrast/s_readpix.c | 10 | ||||
-rw-r--r-- | src/mesa/swrast/s_span.c | 37 | ||||
-rw-r--r-- | src/mesa/swrast/s_stencil.c | 21 | ||||
-rw-r--r-- | src/mesa/swrast/s_texture.c | 4 | ||||
-rw-r--r-- | src/mesa/swrast/s_zoom.c | 23 |
9 files changed, 74 insertions, 63 deletions
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index e10f8a3bb3d..fa91f15a8ff 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -1,4 +1,4 @@ -/* $Id: s_context.c,v 1.29 2002/02/02 21:40:33 brianp Exp $ */ +/* $Id: s_context.c,v 1.30 2002/04/19 00:38:27 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -75,9 +75,9 @@ _swrast_update_rasterflags( GLcontext *ctx ) RasterMask |= ALPHABUF_BIT; if ( ctx->Viewport.X < 0 - || ctx->Viewport.X + ctx->Viewport.Width > ctx->DrawBuffer->Width + || ctx->Viewport.X + ctx->Viewport.Width > (GLint) ctx->DrawBuffer->Width || ctx->Viewport.Y < 0 - || ctx->Viewport.Y + ctx->Viewport.Height > ctx->DrawBuffer->Height) { + || ctx->Viewport.Y + ctx->Viewport.Height > (GLint) ctx->DrawBuffer->Height) { RasterMask |= CLIP_BIT; } diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c index 74d1164ae38..d7844718278 100644 --- a/src/mesa/swrast/s_copypix.c +++ b/src/mesa/swrast/s_copypix.c @@ -1,4 +1,4 @@ -/* $Id: s_copypix.c,v 1.35 2002/04/12 15:39:59 brianp Exp $ */ +/* $Id: s_copypix.c,v 1.36 2002/04/19 00:38:27 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -121,7 +121,7 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, if (SWRAST_CONTEXT(ctx)->_RasterMask == 0 && !zoom && destx >= 0 - && destx + width <= ctx->DrawBuffer->Width) { + && destx + width <= (GLint) ctx->DrawBuffer->Width) { quick_draw = GL_TRUE; } else { @@ -266,7 +266,7 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, /* write row to framebuffer */ dy = desty + row; - if (quick_draw && dy >= 0 && dy < ctx->DrawBuffer->Height) { + if (quick_draw && dy >= 0 && dy < (GLint) ctx->DrawBuffer->Height) { (*swrast->Driver.WriteRGBASpan)( ctx, width, destx, dy, (const GLchan (*)[4])span.color.rgba, NULL ); } @@ -341,7 +341,7 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, if (SWRAST_CONTEXT(ctx)->_RasterMask == 0 && !zoom && destx >= 0 - && destx + width <= ctx->DrawBuffer->Width) { + && destx + width <= (GLint) ctx->DrawBuffer->Width) { quick_draw = GL_TRUE; } else { @@ -507,7 +507,7 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, _swrast_pixel_texture(ctx, &span); } - if (quick_draw && dy >= 0 && dy < ctx->DrawBuffer->Height) { + if (quick_draw && dy >= 0 && dy < (GLint) ctx->DrawBuffer->Height) { (*swrast->Driver.WriteRGBASpan)( ctx, width, destx, dy, (const GLchan (*)[4])span.color.rgba, NULL ); } diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c index 6b1646b7a04..0c0a5b6fe18 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.21 2002/04/18 14:57:00 brianp Exp $ */ +/* $Id: s_depth.c,v 1.22 2002/04/19 00:38:27 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1378,8 +1378,8 @@ _mesa_read_depth_span( GLcontext *ctx, { SWcontext *swrast = SWRAST_CONTEXT(ctx); - if (y < 0 || y >= ctx->DrawBuffer->Height || - x + (GLint) n <= 0 || x >= ctx->DrawBuffer->Width) { + if (y < 0 || y >= (GLint) ctx->DrawBuffer->Height || + x + (GLint) n <= 0 || x >= (GLint) ctx->DrawBuffer->Width) { /* span is completely outside framebuffer */ GLint i; for (i = 0; i < n; i++) @@ -1396,8 +1396,8 @@ _mesa_read_depth_span( GLcontext *ctx, n -= dx; depth += dx; } - if (x + n > ctx->DrawBuffer->Width) { - GLint dx = x + n - ctx->DrawBuffer->Width; + if (x + n > (GLint) ctx->DrawBuffer->Width) { + GLint dx = x + n - (GLint) ctx->DrawBuffer->Width; GLint i; for (i = 0; i < dx; i++) depth[n - i - 1] = 0; @@ -1452,8 +1452,8 @@ _mesa_read_depth_span_float( GLcontext *ctx, SWcontext *swrast = SWRAST_CONTEXT(ctx); const GLfloat scale = 1.0F / ctx->DepthMaxF; - if (y < 0 || y >= ctx->DrawBuffer->Height || - x + (GLint) n <= 0 || x >= ctx->DrawBuffer->Width) { + if (y < 0 || y >= (GLint) ctx->DrawBuffer->Height || + x + (GLint) n <= 0 || x >= (GLint) ctx->DrawBuffer->Width) { /* span is completely outside framebuffer */ GLint i; for (i = 0; i < n; i++) @@ -1469,8 +1469,8 @@ _mesa_read_depth_span_float( GLcontext *ctx, n -= dx; x = 0; } - if (x + n > ctx->DrawBuffer->Width) { - GLint dx = x + n - ctx->DrawBuffer->Width; + if (x + n > (GLint) ctx->DrawBuffer->Width) { + GLint dx = x + n - (GLint) ctx->DrawBuffer->Width; GLint i; for (i = 0; i < dx; i++) depth[n - i - 1] = 0.0F; diff --git a/src/mesa/swrast/s_lines.c b/src/mesa/swrast/s_lines.c index aabcc5f213a..5c6743f92f8 100644 --- a/src/mesa/swrast/s_lines.c +++ b/src/mesa/swrast/s_lines.c @@ -1,4 +1,4 @@ -/* $Id: s_lines.c,v 1.27 2002/04/12 15:39:59 brianp Exp $ */ +/* $Id: s_lines.c,v 1.28 2002/04/19 00:38:27 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -77,7 +77,8 @@ draw_wide_line( GLcontext *ctx, struct sw_span *span, GLboolean xMajor ) start = width / 2 - 1; if (xMajor) { - GLuint i, w; + GLuint i; + GLint w; for (w = 0; w < width; w++) { if (w == 0) { for (i = 0; i < span->end; i++) @@ -96,7 +97,8 @@ draw_wide_line( GLcontext *ctx, struct sw_span *span, GLboolean xMajor ) } } else { - GLuint i, w; + GLuint i; + GLint w; for (w = 0; w < width; w++) { if (w == 0) { for (i = 0; i < span->end; i++) diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c index c4476c85ad2..a52cd8e7c0b 100644 --- a/src/mesa/swrast/s_readpix.c +++ b/src/mesa/swrast/s_readpix.c @@ -1,4 +1,4 @@ -/* $Id: s_readpix.c,v 1.13 2002/01/12 16:12:52 brianp Exp $ */ +/* $Id: s_readpix.c,v 1.14 2002/04/19 00:38:27 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -251,8 +251,8 @@ read_fast_rgba_pixels( GLcontext *ctx, readWidth += srcX; srcX = 0; } - if (srcX + readWidth > ctx->ReadBuffer->Width) - readWidth -= (srcX + readWidth - ctx->ReadBuffer->Width); + if (srcX + readWidth > (GLint) ctx->ReadBuffer->Width) + readWidth -= (srcX + readWidth - (GLint) ctx->ReadBuffer->Width); if (readWidth <= 0) return GL_TRUE; @@ -262,8 +262,8 @@ read_fast_rgba_pixels( GLcontext *ctx, readHeight += srcY; srcY = 0; } - if (srcY + readHeight > ctx->ReadBuffer->Height) - readHeight -= (srcY + readHeight - ctx->ReadBuffer->Height); + if (srcY + readHeight > (GLint) ctx->ReadBuffer->Height) + readHeight -= (srcY + readHeight - (GLint) ctx->ReadBuffer->Height); if (readHeight <= 0) return GL_TRUE; diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index 9241444dd99..c67005a47bb 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -1,4 +1,4 @@ -/* $Id: s_span.c,v 1.38 2002/04/12 15:39:59 brianp Exp $ */ +/* $Id: s_span.c,v 1.39 2002/04/19 00:38:27 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -753,7 +753,7 @@ _mesa_write_index_span( GLcontext *ctx, struct sw_span *span) #ifdef DEBUG if (span->arrayMask & SPAN_XY) { - int i; + GLuint i; for (i = 0; i < span->end; i++) { if (span->mask[i]) { assert(span->xArray[i] >= ctx->DrawBuffer->_Xmin); @@ -925,7 +925,7 @@ _mesa_write_rgba_span( GLcontext *ctx, struct sw_span *span) #ifdef DEBUG if (span->arrayMask & SPAN_XY) { - int i; + GLuint i; for (i = 0; i < span->end; i++) { if (span->mask[i]) { assert(span->xArray[i] >= ctx->DrawBuffer->_Xmin); @@ -1018,6 +1018,7 @@ _mesa_write_rgba_span( GLcontext *ctx, struct sw_span *span) monoColor = GL_FALSE; } else if (ctx->Color.BlendEnabled) { + printf("blending\n"); _mesa_blend_span(ctx, span, span->color.rgba); monoColor = GL_FALSE; } @@ -1139,7 +1140,7 @@ _mesa_write_texture_span( GLcontext *ctx, struct sw_span *span) #ifdef DEBUG if (span->arrayMask & SPAN_XY) { - int i; + GLuint i; for (i = 0; i < span->end; i++) { if (span->mask[i]) { assert(span->xArray[i] >= ctx->DrawBuffer->_Xmin); @@ -1305,8 +1306,10 @@ _mesa_read_rgba_span( GLcontext *ctx, GLframebuffer *buffer, GLuint n, GLint x, GLint y, GLchan rgba[][4] ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); - if (y < 0 || y >= buffer->Height - || x + (GLint) n < 0 || x >= buffer->Width) { + const GLint bufWidth = (GLint) buffer->Width; + const GLint bufHeight = (GLint) buffer->Width; + + if (y < 0 || y >= bufHeight || x + (GLint) n < 0 || x >= bufWidth) { /* completely above, below, or right */ /* XXX maybe leave undefined? */ BZERO(rgba, 4 * n * sizeof(GLchan)); @@ -1321,14 +1324,14 @@ _mesa_read_rgba_span( GLcontext *ctx, GLframebuffer *buffer, /* completely left of window */ return; } - if (length > buffer->Width) { - length = buffer->Width; + if (length > bufWidth) { + length = bufWidth; } } - else if ((GLint) (x + n) > buffer->Width) { + else if ((GLint) (x + n) > bufWidth) { /* right edge clipping */ skip = 0; - length = buffer->Width - x; + length = bufWidth - x; if (length < 0) { /* completely to right of window */ return; @@ -1357,8 +1360,10 @@ _mesa_read_index_span( GLcontext *ctx, GLframebuffer *buffer, GLuint n, GLint x, GLint y, GLuint indx[] ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); - if (y < 0 || y >= buffer->Height - || x + (GLint) n < 0 || x >= buffer->Width) { + const GLint bufWidth = (GLint) buffer->Width; + const GLint bufHeight = (GLint) buffer->Width; + + if (y < 0 || y >= bufHeight || x + (GLint) n < 0 || x >= bufWidth) { /* completely above, below, or right */ BZERO(indx, n * sizeof(GLuint)); } @@ -1372,14 +1377,14 @@ _mesa_read_index_span( GLcontext *ctx, GLframebuffer *buffer, /* completely left of window */ return; } - if (length > buffer->Width) { - length = buffer->Width; + if (length > bufWidth) { + length = bufWidth; } } - else if ((GLint) (x + n) > buffer->Width) { + else if ((GLint) (x + n) > bufWidth) { /* right edge clipping */ skip = 0; - length = buffer->Width - x; + length = bufWidth - x; if (length < 0) { /* completely to right of window */ return; diff --git a/src/mesa/swrast/s_stencil.c b/src/mesa/swrast/s_stencil.c index 04e09971770..5f5575de0d9 100644 --- a/src/mesa/swrast/s_stencil.c +++ b/src/mesa/swrast/s_stencil.c @@ -1,4 +1,4 @@ -/* $Id: s_stencil.c,v 1.22 2002/03/19 16:47:05 brianp Exp $ */ +/* $Id: s_stencil.c,v 1.23 2002/04/19 00:38:27 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1017,8 +1017,10 @@ _mesa_read_stencil_span( GLcontext *ctx, GLint n, GLint x, GLint y, GLstencil stencil[] ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); - if (y < 0 || y >= ctx->DrawBuffer->Height || - x + n <= 0 || x >= ctx->DrawBuffer->Width) { + const GLint bufWidth = (GLint) ctx->DrawBuffer->Width; + const GLint bufHeight = (GLint) ctx->DrawBuffer->Width; + + if (y < 0 || y >= bufHeight || x + n <= 0 || x >= bufWidth) { /* span is completely outside framebuffer */ return; /* undefined values OK */ } @@ -1029,8 +1031,8 @@ _mesa_read_stencil_span( GLcontext *ctx, n -= dx; stencil += dx; } - if (x + n > ctx->DrawBuffer->Width) { - GLint dx = x + n - ctx->DrawBuffer->Width; + if (x + n > bufWidth) { + GLint dx = x + n - bufWidth; n -= dx; } if (n <= 0) { @@ -1069,9 +1071,10 @@ _mesa_write_stencil_span( GLcontext *ctx, GLint n, GLint x, GLint y, { SWcontext *swrast = SWRAST_CONTEXT(ctx); const GLstencil *ssrc = stencil; + const GLint bufWidth = (GLint) ctx->DrawBuffer->Width; + const GLint bufHeight = (GLint) ctx->DrawBuffer->Width; - if (y < 0 || y >= ctx->DrawBuffer->Height || - x + n <= 0 || x >= ctx->DrawBuffer->Width) { + if (y < 0 || y >= bufHeight || x + n <= 0 || x >= bufWidth) { /* span is completely outside framebuffer */ return; /* undefined values OK */ } @@ -1082,8 +1085,8 @@ _mesa_write_stencil_span( GLcontext *ctx, GLint n, GLint x, GLint y, n -= dx; ssrc += dx; } - if (x + n > ctx->DrawBuffer->Width) { - GLint dx = x + n - ctx->DrawBuffer->Width; + if (x + n > bufWidth) { + GLint dx = x + n - bufWidth; n -= dx; } if (n <= 0) { diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c index f5f4bb5d632..44738acdad5 100644 --- a/src/mesa/swrast/s_texture.c +++ b/src/mesa/swrast/s_texture.c @@ -1,4 +1,4 @@ -/* $Id: s_texture.c,v 1.60 2002/04/12 21:17:28 brianp Exp $ */ +/* $Id: s_texture.c,v 1.61 2002/04/19 00:38:27 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -2250,7 +2250,7 @@ sample_depth_texture( GLcontext *ctx, GLuint unit, result = 0; break; case GL_NEVER: - result = CHAN_MAXF; + result = CHAN_MAX; break; case GL_NONE: /* ordinary bilinear filtering */ diff --git a/src/mesa/swrast/s_zoom.c b/src/mesa/swrast/s_zoom.c index d71ffd7aa1c..f56fa5a6a4b 100644 --- a/src/mesa/swrast/s_zoom.c +++ b/src/mesa/swrast/s_zoom.c @@ -1,4 +1,4 @@ -/* $Id: s_zoom.c,v 1.14 2002/04/12 15:39:59 brianp Exp $ */ +/* $Id: s_zoom.c,v 1.15 2002/04/19 00:38:27 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -45,7 +45,7 @@ zoom_span( GLcontext *ctx, const struct sw_span *span, GLint r0, r1, row; GLint c0, c1, skipCol; GLint i, j; - const GLint maxWidth = MIN2( ctx->DrawBuffer->Width, MAX_WIDTH ); + const GLuint maxWidth = MIN2( ctx->DrawBuffer->Width, MAX_WIDTH ); GLchan rgbaSave[MAX_WIDTH][4]; GLuint indexSave[MAX_WIDTH]; struct sw_span zoomed; @@ -128,18 +128,18 @@ zoom_span( GLcontext *ctx, const struct sw_span *span, */ if (r1 < 0) /* below window */ return; - if (r0 >= ctx->DrawBuffer->Height) /* above window */ + if (r0 >= (GLint) ctx->DrawBuffer->Height) /* above window */ return; if (c1 < 0) /* left of window */ return; - if (c0 >= ctx->DrawBuffer->Width) /* right of window */ + if (c0 >= (GLint) ctx->DrawBuffer->Width) /* right of window */ return; /* zoom the span horizontally */ if (format == GL_RGBA) { if (ctx->Pixel.ZoomX == -1.0F) { /* common case */ - for (j = zoomed.start; j < zoomed.end; j++) { + for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { i = span->end - (j + skipCol) - 1; COPY_CHAN4(zoomed.color.rgba[j], rgba[i]); } @@ -147,7 +147,7 @@ zoom_span( GLcontext *ctx, const struct sw_span *span, else { /* general solution */ const GLfloat xscale = 1.0F / ctx->Pixel.ZoomX; - for (j = zoomed.start; j < zoomed.end; j++) { + for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { i = (GLint) ((j + skipCol) * xscale); if (i < 0) i = span->end + i - 1; @@ -158,7 +158,7 @@ zoom_span( GLcontext *ctx, const struct sw_span *span, else if (format == GL_RGB) { if (ctx->Pixel.ZoomX == -1.0F) { /* common case */ - for (j = zoomed.start; j < zoomed.end; j++) { + for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { i = span->end - (j + skipCol) - 1; zoomed.color.rgba[j][0] = rgb[i][0]; zoomed.color.rgba[j][1] = rgb[i][1]; @@ -169,7 +169,7 @@ zoom_span( GLcontext *ctx, const struct sw_span *span, else { /* general solution */ const GLfloat xscale = 1.0F / ctx->Pixel.ZoomX; - for (j = zoomed.start; j < zoomed.end; j++) { + for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { i = (GLint) ((j + skipCol) * xscale); if (i < 0) i = span->end + i - 1; @@ -183,7 +183,7 @@ zoom_span( GLcontext *ctx, const struct sw_span *span, else if (format == GL_COLOR_INDEX) { if (ctx->Pixel.ZoomX == -1.0F) { /* common case */ - for (j = zoomed.start; j < zoomed.end; j++) { + for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { i = span->end - (j + skipCol) - 1; zoomed.color.index[j] = indexes[i]; } @@ -191,7 +191,7 @@ zoom_span( GLcontext *ctx, const struct sw_span *span, else { /* general solution */ const GLfloat xscale = 1.0F / ctx->Pixel.ZoomX; - for (j = zoomed.start; j < zoomed.end; j++) { + for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { i = (GLint) ((j + skipCol) * xscale); if (i < 0) i = span->end + i - 1; @@ -297,7 +297,8 @@ _mesa_write_zoomed_stencil_span( GLcontext *ctx, /* below window */ return; } - if (r0>=ctx->DrawBuffer->Height && r1>=ctx->DrawBuffer->Height) { + if (r0 >= (GLint) ctx->DrawBuffer->Height && + r1 >= (GLint) ctx->DrawBuffer->Height) { /* above window */ return; } |