gallium: Various coordinate fixups for texture transfers.

Fixes glReadPixels, gl(Copy)TexSubImage, glCopyPixels.
This commit is contained in:
Michel Dänzer
2009-02-13 17:34:29 +01:00
parent 5af34758e3
commit 7c8836e9ef
3 changed files with 9 additions and 9 deletions

View File

@@ -780,7 +780,7 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
} }
else { else {
if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) { if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) {
spanY = ctx->DrawBuffer->Height - spanY - 1; spanY = height - spanY - 1;
} }
switch (pt->format) { switch (pt->format) {
@@ -925,7 +925,7 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
y = i; y = i;
if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) { if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) {
y = ctx->DrawBuffer->Height - y - 1; y = height - y - 1;
} }
dst = drawMap + y * ptDraw->stride; dst = drawMap + y * ptDraw->stride;

View File

@@ -213,7 +213,7 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb,
GLint row, col, dy, dstStride; GLint row, col, dy, dstStride;
if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) { 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, 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) { if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
y = height - y - 1; y = height - 1;
dy = -1; dy = -1;
} }
else { 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) { 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 */ /* 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 */ /* determine bottom-to-top vs. top-to-bottom order */
if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) { if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
y = trans->height - 1 - y; y = height - 1;
yStep = -1; yStep = -1;
} }
else { else {

View File

@@ -817,7 +817,7 @@ st_TexSubimage(GLcontext * ctx,
if (!texImage->TexFormat->StoreImage(ctx, dims, texImage->_BaseFormat, if (!texImage->TexFormat->StoreImage(ctx, dims, texImage->_BaseFormat,
texImage->TexFormat, texImage->TexFormat,
texImage->Data, texImage->Data,
xoffset, yoffset, 0, 0, 0, 0,
dstRowStride, dstRowStride,
texImage->ImageOffsets, texImage->ImageOffsets,
width, height, 1, width, height, 1,
@@ -934,7 +934,7 @@ fallback_copy_texsubimage(GLcontext *ctx,
assert(width <= MAX_WIDTH); assert(width <= MAX_WIDTH);
if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) { 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, 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 */ /* determine bottom-to-top vs. top-to-bottom order for src buffer */
if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) { if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
srcY = height - 1 - srcY; srcY = height - 1;
yStep = -1; yStep = -1;
} }
else { else {