From 9543b0a1eaf936dd75f2167c4cfcbdf1a0cda568 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 10 Mar 2010 10:49:18 -0700 Subject: st/mesa: add some comments in glReadPixels code --- src/mesa/state_tracker/st_cb_readpixels.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/mesa/state_tracker/st_cb_readpixels.c') diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index 952d9ce915..8cc9cfac76 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -241,6 +241,7 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb, GLint row, col, dy, dstStride; if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) { + /* convert GL Y to Gallium Y */ y = strb->texture->height0 - y - height; } @@ -258,11 +259,16 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb, return GL_FALSE; } + /* We always write to the user/dest buffer from low addr to high addr + * but the read order depends on renderbuffer orientation + */ if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) { + /* read source rows from bottom to top */ y = height - 1; dy = -1; } else { + /* read source rows from top to bottom */ y = 0; dy = 1; } @@ -396,6 +402,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, } if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) { + /* convert GL Y to Gallium Y */ y = strb->Base.Height - y - height; } -- cgit v1.2.3