another fix for glDrawPixels + clipping

This commit is contained in:
Brian Paul 2003-01-16 18:57:44 +00:00
parent 08e1ef79cc
commit 1596bf398c

View file

@ -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;
}
}