From d4dc57bb13386f4503000dc34c6bf67a8387fc9f Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 4 Apr 2007 08:48:06 -0600 Subject: Overlapping copies with zoomZ=-1 were broken. See bug 10521. Need to check for overlapping src/dest regions before computing bottom-to-top vs. top-to-bottom order. --- src/mesa/swrast/s_copypix.c | 94 ++++++++++++++++++++++----------------------- 1 file changed, 47 insertions(+), 47 deletions(-) (limited to 'src') diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c index 7ba7424aa9..b400c02ad1 100644 --- a/src/mesa/swrast/s_copypix.c +++ b/src/mesa/swrast/s_copypix.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.2 + * Version: 6.5.3 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -218,8 +218,16 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, IMAGE_POST_CONVOLUTION_SCALE_BIAS); } + if (ctx->DrawBuffer == ctx->ReadBuffer) { + overlapping = regions_overlap(srcx, srcy, destx, desty, width, height, + ctx->Pixel.ZoomX, ctx->Pixel.ZoomY); + } + else { + overlapping = GL_FALSE; + } + /* Determine if copy should be done bottom-to-top or top-to-bottom */ - if (srcy < desty) { + if (!overlapping && srcy < desty) { /* top-down max-to-min */ sy = srcy + height - 1; dy = desty + height - 1; @@ -232,14 +240,6 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, stepy = 1; } - if (ctx->DrawBuffer == ctx->ReadBuffer) { - overlapping = regions_overlap(srcx, srcy, destx, desty, width, height, - ctx->Pixel.ZoomX, ctx->Pixel.ZoomY); - } - else { - overlapping = GL_FALSE; - } - INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA); if (ctx->Depth.Test) _swrast_span_default_z(ctx, &span); @@ -330,8 +330,16 @@ copy_ci_pixels( GLcontext *ctx, GLint srcx, GLint srcy, INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_INDEX); + if (ctx->DrawBuffer == ctx->ReadBuffer) { + overlapping = regions_overlap(srcx, srcy, destx, desty, width, height, + ctx->Pixel.ZoomX, ctx->Pixel.ZoomY); + } + else { + overlapping = GL_FALSE; + } + /* Determine if copy should be bottom-to-top or top-to-bottom */ - if (srcyDrawBuffer == ctx->ReadBuffer) { - overlapping = regions_overlap(srcx, srcy, destx, desty, width, height, - ctx->Pixel.ZoomX, ctx->Pixel.ZoomY); - } - else { - overlapping = GL_FALSE; - } - if (ctx->Depth.Test) _swrast_span_default_z(ctx, &span); if (swrast->_FogEnabled) @@ -469,8 +469,16 @@ copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy, INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_Z); + if (ctx->DrawBuffer == ctx->ReadBuffer) { + overlapping = regions_overlap(srcx, srcy, destx, desty, width, height, + ctx->Pixel.ZoomX, ctx->Pixel.ZoomY); + } + else { + overlapping = GL_FALSE; + } + /* Determine if copy should be bottom-to-top or top-to-bottom */ - if (srcyDrawBuffer == ctx->ReadBuffer) { - overlapping = regions_overlap(srcx, srcy, destx, desty, width, height, - ctx->Pixel.ZoomX, ctx->Pixel.ZoomY); - } - else { - overlapping = GL_FALSE; - } - _swrast_span_default_color(ctx, &span); if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) _swrast_span_default_secondary_color(ctx, &span); @@ -573,8 +573,16 @@ copy_stencil_pixels( GLcontext *ctx, GLint srcx, GLint srcy, return; } + if (ctx->DrawBuffer == ctx->ReadBuffer) { + overlapping = regions_overlap(srcx, srcy, destx, desty, width, height, + ctx->Pixel.ZoomX, ctx->Pixel.ZoomY); + } + else { + overlapping = GL_FALSE; + } + /* Determine if copy should be bottom-to-top or top-to-bottom */ - if (srcy < desty) { + if (!overlapping && srcy < desty) { /* top-down max-to-min */ sy = srcy + height - 1; dy = desty + height - 1; @@ -587,14 +595,6 @@ copy_stencil_pixels( GLcontext *ctx, GLint srcx, GLint srcy, stepy = 1; } - if (ctx->DrawBuffer == ctx->ReadBuffer) { - overlapping = regions_overlap(srcx, srcy, destx, desty, width, height, - ctx->Pixel.ZoomX, ctx->Pixel.ZoomY); - } - else { - overlapping = GL_FALSE; - } - if (overlapping) { GLint ssy = sy; tmpImage = (GLstencil *) _mesa_malloc(width * height * sizeof(GLstencil)); @@ -674,8 +674,16 @@ copy_depth_stencil_pixels(GLcontext *ctx, ASSERT(depthReadRb); ASSERT(stencilReadRb); + if (ctx->DrawBuffer == ctx->ReadBuffer) { + overlapping = regions_overlap(srcX, srcY, destX, destY, width, height, + ctx->Pixel.ZoomX, ctx->Pixel.ZoomY); + } + else { + overlapping = GL_FALSE; + } + /* Determine if copy should be bottom-to-top or top-to-bottom */ - if (srcY < destY) { + if (!overlapping && srcY < destY) { /* top-down max-to-min */ sy = srcY + height - 1; dy = destY + height - 1; @@ -688,14 +696,6 @@ copy_depth_stencil_pixels(GLcontext *ctx, stepy = 1; } - if (ctx->DrawBuffer == ctx->ReadBuffer) { - overlapping = regions_overlap(srcX, srcY, destX, destY, width, height, - ctx->Pixel.ZoomX, ctx->Pixel.ZoomY); - } - else { - overlapping = GL_FALSE; - } - if (overlapping) { GLint ssy = sy; -- cgit v1.2.3