diff options
author | Brian Paul <[email protected]> | 2001-03-08 15:23:46 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2001-03-08 15:23:46 +0000 |
commit | 01915e90e6912f06d43d443a09157f7bbc96ddc5 (patch) | |
tree | fc86ff76a45027c01d45902bed894d12f161088c /src/mesa/swrast | |
parent | eac57f009ea347cfce0d70452c1bdeb0e6c9eeae (diff) |
More g++ warning fixes. Fixes for CHAN_BITS==16, it seems to work.
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r-- | src/mesa/swrast/s_accum.c | 6 | ||||
-rw-r--r-- | src/mesa/swrast/s_blend.c | 24 | ||||
-rw-r--r-- | src/mesa/swrast/s_drawpix.c | 4 | ||||
-rw-r--r-- | src/mesa/swrast/s_texture.c | 12 | ||||
-rw-r--r-- | src/mesa/swrast/s_triangle.c | 4 |
5 files changed, 29 insertions, 21 deletions
diff --git a/src/mesa/swrast/s_accum.c b/src/mesa/swrast/s_accum.c index 0b8c611f6cb..0c1fdbe929f 100644 --- a/src/mesa/swrast/s_accum.c +++ b/src/mesa/swrast/s_accum.c @@ -1,4 +1,4 @@ -/* $Id: s_accum.c,v 1.6 2001/03/07 05:06:12 brianp Exp $ */ +/* $Id: s_accum.c,v 1.7 2001/03/08 15:23:46 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -476,7 +476,7 @@ _swrast_Accum( GLcontext *ctx, GLenum op, GLfloat value, if (ctx->DrawBuffer->UseSoftwareAlphaBuffers && ctx->Color.ColorMask[ACOMP]) { _mesa_write_alpha_span(ctx, width, xpos, ypos, - (CONST GLubyte (*)[4]) rgba, NULL); + (CONST GLchan (*)[4]) rgba, NULL); } ypos++; } @@ -508,7 +508,7 @@ _swrast_Accum( GLcontext *ctx, GLenum op, GLfloat value, if (ctx->DrawBuffer->UseSoftwareAlphaBuffers && ctx->Color.ColorMask[ACOMP]) { _mesa_write_alpha_span(ctx, width, xpos, ypos, - (CONST GLubyte (*)[4]) rgba, NULL); + (CONST GLchan (*)[4]) rgba, NULL); } ypos++; } diff --git a/src/mesa/swrast/s_blend.c b/src/mesa/swrast/s_blend.c index bf23a870aba..d22616e36b5 100644 --- a/src/mesa/swrast/s_blend.c +++ b/src/mesa/swrast/s_blend.c @@ -1,4 +1,4 @@ -/* $Id: s_blend.c,v 1.4 2001/03/03 21:11:33 brianp Exp $ */ +/* $Id: s_blend.c,v 1.5 2001/03/08 15:23:46 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -98,12 +98,20 @@ blend_transparency( GLcontext *ctx, GLuint n, const GLubyte mask[], const GLint b = DIV255(rgba[i][BCOMP] * t + dest[i][BCOMP] * s); const GLint a = DIV255(rgba[i][ACOMP] * t + dest[i][ACOMP] * s); #undef DIV255 -#else - const GLint s = CHAN_MAX - t; - const GLint r = (rgba[i][RCOMP] * t + dest[i][RCOMP] * s) / CHAN_MAX; - const GLint g = (rgba[i][GCOMP] * t + dest[i][GCOMP] * s) / CHAN_MAX; - const GLint b = (rgba[i][BCOMP] * t + dest[i][BCOMP] * s) / CHAN_MAX; - const GLint a = (rgba[i][ACOMP] * t + dest[i][ACOMP] * s) / CHAN_MAX; +#elif CHAN_BITS == 16 + const GLfloat tt = (GLfloat) t / CHAN_MAXF; + const GLfloat s = 1.0 - tt; + const GLint r = (GLint) (rgba[i][RCOMP] * tt + dest[i][RCOMP] * s); + const GLint g = (GLint) (rgba[i][GCOMP] * tt + dest[i][GCOMP] * s); + const GLint b = (GLint) (rgba[i][BCOMP] * tt + dest[i][BCOMP] * s); + const GLint a = (GLint) (rgba[i][ACOMP] * tt + dest[i][ACOMP] * s); +#else /* CHAN_BITS == 32 */ + const GLfloat tt = (GLfloat) t / CHAN_MAXF; + const GLfloat s = 1.0 - tt; + const GLfloat r = rgba[i][RCOMP] * tt + dest[i][RCOMP] * s; + const GLfloat g = rgba[i][GCOMP] * tt + dest[i][GCOMP] * s; + const GLfloat b = rgba[i][BCOMP] * tt + dest[i][BCOMP] * s; + const GLfloat a = rgba[i][ACOMP] * tt + dest[i][ACOMP] * s; #endif #endif ASSERT(r <= CHAN_MAX); @@ -625,7 +633,7 @@ _mesa_blend_span( GLcontext *ctx, GLuint n, GLint x, GLint y, _mesa_read_rgba_span( ctx, ctx->DrawBuffer, n, x, y, dest ); SWRAST_CONTEXT(ctx)->BlendFunc( ctx, n, mask, rgba, - (const GLchan (*)[4])dest ); + (const GLchan (*)[4]) dest ); } diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index 0943d310474..1e03fa903e1 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -1,4 +1,4 @@ -/* $Id: s_drawpix.c,v 1.12 2001/03/07 05:06:12 brianp Exp $ */ +/* $Id: s_drawpix.c,v 1.13 2001/03/08 15:23:46 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -268,7 +268,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, GLint row; for (row=0; row<drawHeight; row++) { _mesa_write_zoomed_rgb_span(ctx, drawWidth, destX, destY, - zSpan, 0, (GLchan (*)[3]) src, zoomY0); + zSpan, 0, (CONST GLchan (*)[3]) src, zoomY0); src += rowLength * 3; destY++; } diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c index 7b1b4e94e3f..3a0da6e2531 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.14 2001/03/03 20:33:30 brianp Exp $ */ +/* $Id: s_texture.c,v 1.15 2001/03/08 15:23:46 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -76,7 +76,7 @@ if (wrapMode == GL_CLAMP_TO_EDGE) { \ if (I0 < 0) \ I0 = 0; \ - if (I1 >= SIZE) \ + if (I1 >= (GLint) SIZE) \ I1 = SIZE - 1; \ } \ } \ @@ -2441,10 +2441,10 @@ sample_depth_texture(const GLcontext *ctx, j1 += texImage->Border; } else { - if (i0 < 0 || i0 >= width) useBorderTexel |= I0BIT; - if (i1 < 0 || i1 >= width) useBorderTexel |= I1BIT; - if (j0 < 0 || j0 >= height) useBorderTexel |= J0BIT; - if (j1 < 0 || j1 >= height) useBorderTexel |= J1BIT; + if (i0 < 0 || i0 >= (GLint) width) useBorderTexel |= I0BIT; + if (i1 < 0 || i1 >= (GLint) width) useBorderTexel |= I1BIT; + if (j0 < 0 || j0 >= (GLint) height) useBorderTexel |= J0BIT; + if (j1 < 0 || j1 >= (GLint) height) useBorderTexel |= J1BIT; } /* get four depth samples from the texture */ diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index 2baa2b5d29a..58609b0f40c 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -1,4 +1,4 @@ -/* $Id: s_triangle.c,v 1.15 2001/03/03 20:33:30 brianp Exp $ */ +/* $Id: s_triangle.c,v 1.16 2001/03/08 15:23:46 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -413,7 +413,7 @@ static void affine_textured_triangle( GLcontext *ctx, return; \ } \ tbytesline = obj->Image[b]->Width * comp; \ - tsize = theight * tbytesline; + tsize = obj->Image[b]->Height * tbytesline; /* Instead of defining a function for each mode, a test is done |