summaryrefslogtreecommitdiff
path: root/src/mesa/swrast
diff options
context:
space:
mode:
authorBrian <brian@yutani.localnet.net>2007-04-04 08:48:06 -0600
committerBrian <brian@yutani.localnet.net>2007-04-04 08:48:06 -0600
commitd4dc57bb13386f4503000dc34c6bf67a8387fc9f (patch)
tree5548606c9b27fd01bb8a92e0d0827896aa1f193a /src/mesa/swrast
parenta28e64869022962ee7c0fa7ea7a211cd6b58c4bb (diff)
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.
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r--src/mesa/swrast/s_copypix.c94
1 files changed, 47 insertions, 47 deletions
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 (srcy<desty) {
+ if (!overlapping && srcy < desty) {
/* top-down max-to-min */
sy = srcy + height - 1;
dy = desty + height - 1;
@@ -344,14 +352,6 @@ copy_ci_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 (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 (srcy<desty) {
+ if (!overlapping && srcy < desty) {
/* top-down max-to-min */
sy = srcy + height - 1;
dy = desty + height - 1;
@@ -483,14 +491,6 @@ copy_depth_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;
- }
-
_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;