aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/readpix.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-02-29 13:34:55 +0100
committermarha <marha@users.sourceforge.net>2012-02-29 13:34:55 +0100
commit15a500d3edb03668b43cc6898fafcda024d0f006 (patch)
tree5bdb867e749ea1f56b9c480d195027e38a0bbab2 /mesalib/src/mesa/main/readpix.c
parentc4f44c07c6662d1ce08603945ccc4fa5afaa742a (diff)
downloadvcxsrv-15a500d3edb03668b43cc6898fafcda024d0f006.tar.gz
vcxsrv-15a500d3edb03668b43cc6898fafcda024d0f006.tar.bz2
vcxsrv-15a500d3edb03668b43cc6898fafcda024d0f006.zip
xserver fontconfig mesa pixman git update 29 Feb 2012
Diffstat (limited to 'mesalib/src/mesa/main/readpix.c')
-rw-r--r--mesalib/src/mesa/main/readpix.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/mesalib/src/mesa/main/readpix.c b/mesalib/src/mesa/main/readpix.c
index 0f429ab22..3384d8a38 100644
--- a/mesalib/src/mesa/main/readpix.c
+++ b/mesalib/src/mesa/main/readpix.c
@@ -225,6 +225,16 @@ fast_read_rgba_pixels_memcpy( struct gl_context *ctx,
ctx->Pack.SwapBytes))
return GL_FALSE;
+ /* If the format is unsigned normalized then we can ignore clamping
+ * because the values are already in the range [0,1] so it won't
+ * have any effect anyway.
+ */
+ if (_mesa_get_format_datatype(rb->Format) == GL_UNSIGNED_NORMALIZED)
+ transferOps &= ~IMAGE_CLAMP_BIT;
+
+ if (transferOps)
+ return GL_FALSE;
+
dstStride = _mesa_image_row_stride(packing, width, format, type);
dst = (GLubyte *) _mesa_image_address2d(packing, pixels, width, height,
format, type, 0, 0);
@@ -320,13 +330,11 @@ read_rgba_pixels( struct gl_context *ctx,
transferOps |= IMAGE_CLAMP_BIT;
}
- if (!transferOps) {
- /* Try the optimized paths first. */
- if (fast_read_rgba_pixels_memcpy(ctx, x, y, width, height,
- format, type, pixels, packing,
- transferOps)) {
- return;
- }
+ /* Try the optimized paths first. */
+ if (fast_read_rgba_pixels_memcpy(ctx, x, y, width, height,
+ format, type, pixels, packing,
+ transferOps)) {
+ return;
}
slow_read_rgba_pixels(ctx, x, y, width, height,