diff options
author | Brian Paul <[email protected]> | 2003-01-16 18:57:44 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2003-01-16 18:57:44 +0000 |
commit | 1596bf398cdb4f791467ac89787f1268661af985 (patch) | |
tree | 7d961f6f20d0ae03ffc56542a41488eadc262e17 /src | |
parent | 08e1ef79ccaf98f64ee9f76c8a6e5a2405ce85ce (diff) |
another fix for glDrawPixels + clipping
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/swrast/s_drawpix.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index 9a75aa48b95..a69f3cc3c95 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.43 2003/01/15 23:46:34 brianp Exp $ */ +/* $Id: s_drawpix.c,v 1.44 2003/01/16 18:57:44 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -522,11 +522,11 @@ draw_index_pixels( GLcontext *ctx, GLint x, GLint y, */ skipPixels = 0; while (skipPixels < width) { - span.x = x + (zoom ? 0 : skipPixels); - span.y = y; - span.end = (width - skipPixels > MAX_WIDTH) - ? MAX_WIDTH : (width - skipPixels); - ASSERT(span.end <= MAX_WIDTH); + const GLint spanX = x + (zoom ? 0 : skipPixels); + GLint spanY = y; + const GLint spanEnd = (width - skipPixels > MAX_WIDTH) + ? MAX_WIDTH : (width - skipPixels); + ASSERT(spanEnd <= MAX_WIDTH); for (row = 0; row < height; row++, span.y++) { const GLvoid *source = _mesa_image_address(&ctx->Unpack, pixels, width, height, @@ -535,12 +535,18 @@ draw_index_pixels( GLcontext *ctx, GLint x, GLint y, _mesa_unpack_index_span(ctx, span.end, GL_UNSIGNED_INT, span.array->index, type, source, &ctx->Unpack, ctx->_ImageTransferState); + + /* These may get changed during writing/clipping */ + span.x = spanX; + span.y = spanY; + span.end = spanEnd; + if (zoom) _mesa_write_zoomed_index_span(ctx, &span, y, skipPixels); else _mesa_write_index_span(ctx, &span); } - skipPixels += span.end; + skipPixels += spanEnd; } } @@ -733,7 +739,7 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, _mesa_write_index_span(ctx, &span); } } - skipPixels += span.end; + skipPixels += spanEnd; } } } @@ -840,6 +846,8 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, * General solution */ { + const GLuint interpMask = span.interpMask; + const GLuint arrayMask = span.arrayMask; GLint row, skipPixels = 0; /* if the span is wider than MAX_WIDTH we have to do it in chunks */ @@ -860,6 +868,8 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, span.x = spanX; span.y = spanY; span.end = spanEnd; + span.arrayMask = arrayMask; + span.interpMask = interpMask; _mesa_unpack_chan_color_span(ctx, span.end, GL_RGBA, (GLchan *) span.array->rgba, @@ -874,6 +884,7 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, _swrast_pixel_texture(ctx, &span); } + /* draw the span */ if (quickDraw) { (*swrast->Driver.WriteRGBASpan)(ctx, span.end, span.x, span.y, (CONST GLchan (*)[4]) span.array->rgba, NULL); @@ -886,7 +897,8 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, _mesa_write_rgba_span(ctx, &span); } } - skipPixels += span.end; + + skipPixels += spanEnd; } } |