swrast: fix incorrectly positioned putImage() in swrast driver
authorBrian Paul <brianp@vmware.com>
Wed, 24 Aug 2016 14:52:29 +0000 (08:52 -0600)
committerBrian Paul <brianp@vmware.com>
Thu, 25 Aug 2016 13:19:35 +0000 (07:19 -0600)
Some front buffer rendering was in the wrong position.  This included
scissored clears, glDrawPixels and glCopyPixels.  The problem was the
y coordinate passed to putImage() didn't match the y coordinate passed
to getImage().

We fix this by setting xrb->map_y to the inverted coordinate in
swrast_map_renderbuffer() which is used later by the putImage() call.
Also pass xrb->map_y to getImage() to be symmetric.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97426
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/dri/swrast/swrast.c

index 6d3b00bd4652141efb93f96ab1bbe748b2ab4ee7..0402232deb16994ce0d8c41f969278b3ecf1b486 100644 (file)
@@ -484,14 +484,14 @@ swrast_map_renderbuffer(struct gl_context *ctx,
 
       xrb->map_mode = mode;
       xrb->map_x = x;
-      xrb->map_y = y;
+      xrb->map_y = rb->Height - y - h;
       xrb->map_w = w;
       xrb->map_h = h;
 
       stride = w * cpp;
       xrb->Base.Buffer = malloc(h * stride);
 
-      sPriv->swrast_loader->getImage(dPriv, x, rb->Height - y - h, w, h,
+      sPriv->swrast_loader->getImage(dPriv, x, xrb->map_y, w, h,
                                     (char *) xrb->Base.Buffer,
                                     dPriv->loaderPrivate);