From ea20dfa7a8788870959f136bff0c3a20e4c2bb31 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 21 Feb 2003 00:17:58 +0000 Subject: [PATCH] fix zoom/clipping bug 689964 --- src/mesa/swrast/s_zoom.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mesa/swrast/s_zoom.c b/src/mesa/swrast/s_zoom.c index a9c5eb8..5727bc2 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.20 2003/02/17 15:41:05 brianp Exp $ */ +/* $Id: s_zoom.c,v 1.21 2003/02/21 00:17:58 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -220,12 +220,15 @@ zoom_span( GLcontext *ctx, const struct sw_span *span, if (format == GL_RGBA || format == GL_RGB) { /* Writing the span may modify the colors, so make a backup now if we're * going to call _mesa_write_zoomed_span() more than once. + * Also, clipping may change the span end value, so store it as well. */ + const GLint end = zoomed.end; /* save */ if (r1 - r0 > 1) { MEMCPY(rgbaSave, zoomed.array->rgba, zoomed.end * 4 * sizeof(GLchan)); } for (zoomed.y = r0; zoomed.y < r1; zoomed.y++) { _mesa_write_rgba_span(ctx, &zoomed); + zoomed.end = end; /* restore */ if (r1 - r0 > 1) { /* restore the colors */ MEMCPY(zoomed.array->rgba, rgbaSave, zoomed.end*4 * sizeof(GLchan)); @@ -233,11 +236,13 @@ zoom_span( GLcontext *ctx, const struct sw_span *span, } } else if (format == GL_COLOR_INDEX) { + const GLint end = zoomed.end; /* save */ if (r1 - r0 > 1) { MEMCPY(indexSave, zoomed.array->index, zoomed.end * sizeof(GLuint)); } for (zoomed.y = r0; zoomed.y < r1; zoomed.y++) { _mesa_write_index_span(ctx, &zoomed); + zoomed.end = end; /* restore */ if (r1 - r0 > 1) { /* restore the colors */ MEMCPY(zoomed.array->index, indexSave, zoomed.end * sizeof(GLuint)); -- 2.7.4