From 1596bf398cdb4f791467ac89787f1268661af985 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 16 Jan 2003 18:57:44 +0000 Subject: another fix for glDrawPixels + clipping --- src/mesa/swrast/s_drawpix.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'src/mesa/swrast/s_drawpix.c') diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index 9a75aa48b9..a69f3cc3c9 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; } } -- cgit v1.2.3