gallium: Various coordinate fixups for texture transfers.
authorMichel Dänzer <daenzer@vmware.com>
Fri, 13 Feb 2009 16:34:29 +0000 (17:34 +0100)
committerMichel Dänzer <daenzer@vmware.com>
Fri, 13 Feb 2009 16:34:29 +0000 (17:34 +0100)
Fixes glReadPixels, gl(Copy)TexSubImage, glCopyPixels.

src/mesa/state_tracker/st_cb_drawpixels.c
src/mesa/state_tracker/st_cb_readpixels.c
src/mesa/state_tracker/st_cb_texture.c

index b56dd36eb3d92609d54848090fe11df3d8ec29af..9a84f04af15dcbf40a388729ecc88ff0d4747cbf 100644 (file)
@@ -780,7 +780,7 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
          }
          else {
             if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) {
-               spanY = ctx->DrawBuffer->Height - spanY - 1;
+               spanY = height - spanY - 1;
             }
 
             switch (pt->format) {
@@ -925,7 +925,7 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
       y = i;
 
       if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) {
-         y = ctx->DrawBuffer->Height - y - 1;
+         y = height - y - 1;
       }
 
       dst = drawMap + y * ptDraw->stride;
index e763827c3c4c0adae290d02eaf90fd9e150c0999..5a4a7f0a616cc8ffbcbc529393d4c175eea7889d 100644 (file)
@@ -213,7 +213,7 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb,
       GLint row, col, dy, dstStride;
 
       if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
-         y = strb->texture->height[0] - y - 1;
+         y = strb->texture->height[0] - y - height;
       }
 
       trans = screen->get_tex_transfer(screen, strb->texture, 0, 0, 0,
@@ -229,7 +229,7 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb,
       }
 
       if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
-         y = height - y - 1;
+         y = height - 1;
          dy = -1;
       }
       else {
@@ -365,7 +365,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
    }
 
    if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
-      y = strb->Base.Height - 1 - y;
+      y = strb->Base.Height - y - height;
    }
 
    /* Create a read transfer from the renderbuffer's texture */
@@ -374,7 +374,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
 
    /* determine bottom-to-top vs. top-to-bottom order */
    if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
-      y = trans->height - 1 - y;
+      y = height - 1;
       yStep = -1;
    }
    else {
index ec981e8e46940fea75493052bbdb2f9f8c8a4917..3b77184faae47d202dddbdd4ee3aef663623f2b1 100644 (file)
@@ -817,7 +817,7 @@ st_TexSubimage(GLcontext * ctx,
       if (!texImage->TexFormat->StoreImage(ctx, dims, texImage->_BaseFormat,
                                           texImage->TexFormat,
                                           texImage->Data,
-                                          xoffset, yoffset, 0,
+                                          0, 0, 0,
                                           dstRowStride,
                                           texImage->ImageOffsets,
                                           width, height, 1,
@@ -934,7 +934,7 @@ fallback_copy_texsubimage(GLcontext *ctx,
    assert(width <= MAX_WIDTH);
 
    if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
-      srcY = strb->Base.Height - 1 - srcY;
+      srcY = strb->Base.Height - srcY - height;
    }
 
    src_trans = pipe->screen->get_tex_transfer( pipe->screen,
@@ -954,7 +954,7 @@ fallback_copy_texsubimage(GLcontext *ctx,
 
       /* determine bottom-to-top vs. top-to-bottom order for src buffer */
       if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
-         srcY = height - 1 - srcY;
+         srcY = height - 1;
          yStep = -1;
       }
       else {