diff options
author | marha <marha@users.sourceforge.net> | 2011-12-12 12:23:04 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-12-12 12:23:04 +0100 |
commit | 5efb0a5e19b75137b7294b27f4e7878aeb8f0927 (patch) | |
tree | a8138a3cf2f3ed5beacd1ce9e44dda79b51f9ffd /mesalib/src/mesa/main/readpix.c | |
parent | 5b178ff5a5f0b6e481cf9fd9749eb7ef9581c987 (diff) | |
download | vcxsrv-5efb0a5e19b75137b7294b27f4e7878aeb8f0927.tar.gz vcxsrv-5efb0a5e19b75137b7294b27f4e7878aeb8f0927.tar.bz2 vcxsrv-5efb0a5e19b75137b7294b27f4e7878aeb8f0927.zip |
libxtrans libX11 libxcb xserver mesa git update 12 dec 2011
Diffstat (limited to 'mesalib/src/mesa/main/readpix.c')
-rw-r--r-- | mesalib/src/mesa/main/readpix.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/mesalib/src/mesa/main/readpix.c b/mesalib/src/mesa/main/readpix.c index a7b7ed7f2..38b9c64ed 100644 --- a/mesalib/src/mesa/main/readpix.c +++ b/mesalib/src/mesa/main/readpix.c @@ -252,10 +252,7 @@ slow_read_rgba_pixels( struct gl_context *ctx, { struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer; const gl_format rbFormat = _mesa_get_srgb_format_linear(rb->Format); - union { - float f[MAX_WIDTH][4]; - unsigned int i[MAX_WIDTH][4]; - } rgba; + void *rgba; GLubyte *dst, *map; int dstStride, stride, j; @@ -270,19 +267,27 @@ slow_read_rgba_pixels( struct gl_context *ctx, return; } + rgba = malloc(width * MAX_PIXEL_BYTES); + if (!rgba) + goto done; + for (j = 0; j < height; j++) { if (_mesa_is_integer_format(format)) { - _mesa_unpack_int_rgba_row(rbFormat, width, map, rgba.i); - _mesa_pack_rgba_span_int(ctx, width, rgba.i, format, type, dst); + _mesa_unpack_int_rgba_row(rbFormat, width, map, (GLuint (*)[4]) rgba); + _mesa_pack_rgba_span_int(ctx, width, (GLuint (*)[4]) rgba, format, + type, dst); } else { - _mesa_unpack_rgba_row(rbFormat, width, map, rgba.f); - _mesa_pack_rgba_span_float(ctx, width, rgba.f, format, type, dst, - packing, transferOps); + _mesa_unpack_rgba_row(rbFormat, width, map, (GLfloat (*)[4]) rgba); + _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba, format, + type, dst, packing, transferOps); } dst += dstStride; map += stride; } + free(rgba); + +done: ctx->Driver.UnmapRenderbuffer(ctx, rb); } |