From 7c8836e9ef49d938aa55a1c385b95c6371c301f1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michel=20D=C3=A4nzer?= Date: Fri, 13 Feb 2009 17:34:29 +0100 Subject: [PATCH] gallium: Various coordinate fixups for texture transfers. Fixes glReadPixels, gl(Copy)TexSubImage, glCopyPixels. --- src/mesa/state_tracker/st_cb_drawpixels.c | 4 ++-- src/mesa/state_tracker/st_cb_readpixels.c | 8 ++++---- src/mesa/state_tracker/st_cb_texture.c | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index b56dd36eb3d..9a84f04af15 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -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; diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index e763827c3c4..5a4a7f0a616 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -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 { diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index ec981e8e469..3b77184faae 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -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 { -- 2.30.2