aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-03-10 10:49:18 -0700
committerBrian Paul <[email protected]>2010-03-10 10:49:18 -0700
commit9543b0a1eaf936dd75f2167c4cfcbdf1a0cda568 (patch)
tree6bad16a90a714292875dc5451c7cb5b9edd24f1b
parenta2fe774e0985358a125c5c2e7b89a6b0bc0914d1 (diff)
st/mesa: add some comments in glReadPixels code
-rw-r--r--src/mesa/state_tracker/st_cb_readpixels.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c
index 952d9ce9156..8cc9cfac76f 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;
}