From: Brian Date: Wed, 4 Apr 2007 14:48:06 +0000 (-0600) Subject: Overlapping copies with zoomZ=-1 were broken. See bug 10521. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d4dc57bb13386f4503000dc34c6bf67a8387fc9f;p=mesa.git 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. --- diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c index 7ba7424aa99..b400c02ad18 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;