aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/swrast/s_readpix.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-11-10 09:34:07 +0100
committermarha <marha@users.sourceforge.net>2011-11-10 09:34:07 +0100
commitba1993a2eefbd475b13f373a861a401f06584cf8 (patch)
treed54f01c5e9edae8f9b2477d9676bd976cdcb3033 /mesalib/src/mesa/swrast/s_readpix.c
parenta8e5f06fe01732fbd643bc435dd3b8eaa602defe (diff)
downloadvcxsrv-ba1993a2eefbd475b13f373a861a401f06584cf8.tar.gz
vcxsrv-ba1993a2eefbd475b13f373a861a401f06584cf8.tar.bz2
vcxsrv-ba1993a2eefbd475b13f373a861a401f06584cf8.zip
libX11 mesa git update 10 nov 2011
Diffstat (limited to 'mesalib/src/mesa/swrast/s_readpix.c')
-rw-r--r--mesalib/src/mesa/swrast/s_readpix.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/mesalib/src/mesa/swrast/s_readpix.c b/mesalib/src/mesa/swrast/s_readpix.c
index 50422dbd5..54f42db02 100644
--- a/mesalib/src/mesa/swrast/s_readpix.c
+++ b/mesalib/src/mesa/swrast/s_readpix.c
@@ -236,7 +236,10 @@ slow_read_rgba_pixels( struct gl_context *ctx,
GLbitfield transferOps )
{
struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer;
- GLfloat rgba[MAX_WIDTH][4];
+ union {
+ float f[MAX_WIDTH][4];
+ unsigned int i[MAX_WIDTH][4];
+ } rgba;
GLubyte *dst, *map;
int dstStride, stride, j;
@@ -248,11 +251,15 @@ slow_read_rgba_pixels( struct gl_context *ctx,
&map, &stride);
for (j = 0; j < height; j++) {
- _mesa_unpack_rgba_row(_mesa_get_srgb_format_linear(rb->Format),
- width, map, rgba);
- _mesa_pack_rgba_span_float(ctx, width, rgba, format, type, dst,
- packing, transferOps);
-
+ if (_mesa_is_integer_format(format)) {
+ _mesa_unpack_int_rgba_row(rb->Format, width, map, rgba.i);
+ _mesa_pack_rgba_span_int(ctx, width, rgba.i, format, type, dst);
+ } else {
+ _mesa_unpack_rgba_row(_mesa_get_srgb_format_linear(rb->Format),
+ width, map, rgba.f);
+ _mesa_pack_rgba_span_float(ctx, width, rgba.f, format, type, dst,
+ packing, transferOps);
+ }
dst += dstStride;
map += stride;
}