mesa: Branch 'master'

Brian Paul brianp at kemper.freedesktop.org
Wed Apr 4 14:48:17 UTC 2007


 src/mesa/swrast/s_copypix.c |   94 ++++++++++++++++++++++----------------------
 1 files changed, 47 insertions(+), 47 deletions(-)

New commits:
diff-tree d4dc57bb13386f4503000dc34c6bf67a8387fc9f (from a28e64869022962ee7c0fa7ea7a211cd6b58c4bb)
Author: Brian <brian at yutani.localnet.net>
Date:   Wed Apr 4 08:48:06 2007 -0600

    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 7ba7424..b400c02 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 s
                        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 s
       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 sr
 
    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 sr
       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
 
    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
       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, GLi
       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, GLi
       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;
 



More information about the mesa-commit mailing list