aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker/st_cb_readpixels.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-04-15 15:08:38 +0000
committermarha <marha@users.sourceforge.net>2011-04-15 15:08:38 +0000
commit205a4bdae76f287126db9f45a4f0ba631e3efca1 (patch)
tree6327d3e449dfe53ad6ee6125290581aae6f5ed35 /mesalib/src/mesa/state_tracker/st_cb_readpixels.c
parent898081f31f99dc35a1602a607a07d1aaff49ac40 (diff)
parent71372d36e1a3f0230b88808f70d35446fda12260 (diff)
downloadvcxsrv-205a4bdae76f287126db9f45a4f0ba631e3efca1.tar.gz
vcxsrv-205a4bdae76f287126db9f45a4f0ba631e3efca1.tar.bz2
vcxsrv-205a4bdae76f287126db9f45a4f0ba631e3efca1.zip
svn merge ^/branches/released .
Diffstat (limited to 'mesalib/src/mesa/state_tracker/st_cb_readpixels.c')
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_readpixels.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_cb_readpixels.c b/mesalib/src/mesa/state_tracker/st_cb_readpixels.c
index 425019dca..08f53054d 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_readpixels.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_readpixels.c
@@ -201,7 +201,8 @@ st_fast_readpixels(struct gl_context *ctx, struct st_renderbuffer *strb,
enum combination {
A8R8G8B8_UNORM_TO_RGBA_UBYTE,
A8R8G8B8_UNORM_TO_RGB_UBYTE,
- A8R8G8B8_UNORM_TO_BGRA_UINT
+ A8R8G8B8_UNORM_TO_BGRA_UINT,
+ A8R8G8B8_UNORM_TO_RGBA_UINT
} combo;
if (ctx->_ImageTransferState)
@@ -219,6 +220,10 @@ st_fast_readpixels(struct gl_context *ctx, struct st_renderbuffer *strb,
format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8_REV) {
combo = A8R8G8B8_UNORM_TO_BGRA_UINT;
}
+ else if (strb->format == PIPE_FORMAT_B8G8R8A8_UNORM &&
+ format == GL_RGBA && type == GL_UNSIGNED_INT_8_8_8_8) {
+ combo = A8R8G8B8_UNORM_TO_RGBA_UINT;
+ }
else {
return GL_FALSE;
}
@@ -305,6 +310,20 @@ st_fast_readpixels(struct gl_context *ctx, struct st_renderbuffer *strb,
y += dy;
}
break;
+ case A8R8G8B8_UNORM_TO_RGBA_UINT:
+ for (row = 0; row < height; row++) {
+ const GLubyte *src = map + y * trans->stride;
+ for (col = 0; col < width; col++) {
+ GLuint pixel = ((GLuint *) src)[col];
+ dst[col*4+0] = (pixel >> 24) & 0xff;
+ dst[col*4+1] = (pixel >> 0) & 0xff;
+ dst[col*4+2] = (pixel >> 8) & 0xff;
+ dst[col*4+3] = (pixel >> 16) & 0xff;
+ }
+ dst += dstStride;
+ y += dy;
+ }
+ break;
default:
; /* nothing */
}