diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2006-10-22 17:18:50 +0000 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2006-10-22 17:18:50 +0000 |
commit | 0b26e826bda0da7aeec9a79ee07fe21d54bb1263 (patch) | |
tree | cad7fe6571832fc55e6916f024aa1d1365ea410f /src/mesa/swrast/s_readpix.c | |
parent | 919cd2c3ba39bf4d8d2ffcea0daec7bab8645d34 (diff) |
Color clamping fixes.
Diffstat (limited to 'src/mesa/swrast/s_readpix.c')
-rw-r--r-- | src/mesa/swrast/s_readpix.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c index 0189b0e797d..cbfb7712d82 100644 --- a/src/mesa/swrast/s_readpix.c +++ b/src/mesa/swrast/s_readpix.c @@ -202,7 +202,8 @@ fast_read_rgba_pixels( GLcontext *ctx, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels, - const struct gl_pixelstore_attrib *packing ) + const struct gl_pixelstore_attrib *packing, + GLbitfield transferOps) { struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer; @@ -213,7 +214,7 @@ fast_read_rgba_pixels( GLcontext *ctx, ASSERT(y + height <= rb->Height); /* check for things we can't handle here */ - if (ctx->_ImageTransferState || + if (transferOps || packing->SwapBytes || packing->LsbFirst) { return GL_FALSE; @@ -309,15 +310,20 @@ read_rgba_pixels( GLcontext *ctx, const struct gl_pixelstore_attrib *packing ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); - const GLbitfield transferOps = ctx->_ImageTransferState; + GLbitfield transferOps = ctx->_ImageTransferState; struct gl_framebuffer *fb = ctx->ReadBuffer; struct gl_renderbuffer *rb = fb->_ColorReadBuffer; ASSERT(rb); + if (type == GL_FLOAT && ((ctx->Color.ClampReadColor == GL_TRUE) || + (ctx->Color.ClampReadColor == GL_FIXED_ONLY_ARB && + rb->DataType != GL_FLOAT))) + transferOps |= IMAGE_CLAMP_BIT; + /* Try optimized path first */ if (fast_read_rgba_pixels(ctx, x, y, width, height, - format, type, pixels, packing)) { + format, type, pixels, packing, transferOps)) { return; /* done! */ } @@ -419,7 +425,7 @@ read_rgba_pixels( GLcontext *ctx, /* pack the row of RGBA pixels into user's buffer */ _mesa_pack_rgba_span_float(ctx, width, rgba, format, type, dst, - packing, ctx->_ImageTransferState); + packing, transferOps); dst += dstStride; } |