aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker/st_cb_readpixels.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-10-10 07:52:38 +0200
committermarha <marha@users.sourceforge.net>2011-10-10 07:52:38 +0200
commitafbd3947071a33f59dda122f1ac396442a02c128 (patch)
treee3dde5d2973697c24f73488a421327d09a9337c0 /mesalib/src/mesa/state_tracker/st_cb_readpixels.c
parentb520df571e0a319eae5231d09f36b98f28b8914a (diff)
downloadvcxsrv-afbd3947071a33f59dda122f1ac396442a02c128.tar.gz
vcxsrv-afbd3947071a33f59dda122f1ac396442a02c128.tar.bz2
vcxsrv-afbd3947071a33f59dda122f1ac396442a02c128.zip
fontconfig libX11 mesa pixman xkeyboard-config git updte 10 oct 2011
Diffstat (limited to 'mesalib/src/mesa/state_tracker/st_cb_readpixels.c')
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_readpixels.c40
1 files changed, 38 insertions, 2 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_cb_readpixels.c b/mesalib/src/mesa/state_tracker/st_cb_readpixels.c
index e2b29fe30..7fa1672fd 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_readpixels.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_readpixels.c
@@ -387,6 +387,8 @@ st_readpixels(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei h
GLsizei i, j;
GLint yStep, dfStride;
GLfloat *df;
+ GLuint *dui;
+ GLint *di;
struct st_renderbuffer *strb;
struct gl_pixelstore_attrib clippedPacking = *pack;
struct pipe_transfer *trans;
@@ -454,10 +456,13 @@ st_readpixels(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei h
}
else {
/* write tile(row) into temp row buffer */
- df = (GLfloat *) temp;
+ df = (GLfloat *)temp;
dfStride = 0;
}
+ dui = (GLuint *)df;
+ di = (GLint *)df;
+
if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
/* convert GL Y to Gallium Y */
y = strb->Base.Height - y - height;
@@ -611,7 +616,38 @@ st_readpixels(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei h
dst += dstStride;
}
}
- else {
+ else if (util_format_is_pure_sint(pformat)) {
+ for (i = 0; i < height; i++) {
+ if (type == GL_UNSIGNED_INT)
+ pipe_get_tile_ui_format(pipe, trans, 0, y, width, 1,
+ pformat, dui);
+ else
+ pipe_get_tile_i_format(pipe, trans, 0, y, width, 1,
+ pformat, di);
+ y += yStep;
+ if (!dfStride) {
+ _mesa_pack_rgba_span_int(ctx, width, (GLuint (*)[4])temp,
+ format, type, dst);
+ dst += dstStride;
+ }
+ }
+ } else if (util_format_is_pure_uint(pformat)) {
+ for (i = 0; i < height; i++) {
+ if (type == GL_UNSIGNED_INT)
+ pipe_get_tile_ui_format(pipe, trans, 0, y, width, 1,
+ pformat, dui);
+ else
+ pipe_get_tile_i_format(pipe, trans, 0, y, width, 1,
+ pformat, di);
+ y += yStep;
+ df += dfStride;
+ if (!dfStride) {
+ _mesa_pack_rgba_span_int(ctx, width, (GLuint (*)[4])temp,
+ format, type, dst);
+ dst += dstStride;
+ }
+ }
+ } else {
/* RGBA format */
/* Do a row at a time to flip image data vertically */
for (i = 0; i < height; i++) {