Mesa (master): st/mesa: simplify a bit of the previous patch

Brian Paul brianp at kemper.freedesktop.org
Fri Apr 15 07:35:23 PDT 2011


Module: Mesa
Branch: master
Commit: 2c57caa8939a2d077912eeec287927da77c97ef7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2c57caa8939a2d077912eeec287927da77c97ef7

Author: Brian Paul <brianp at vmware.com>
Date:   Fri Apr 15 08:32:12 2011 -0600

st/mesa: simplify a bit of the previous patch

Grrr, this was supposed to go in the previous commit.

---

 src/mesa/state_tracker/st_cb_readpixels.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c
index 1b57e9b..2a63799 100644
--- a/src/mesa/state_tracker/st_cb_readpixels.c
+++ b/src/mesa/state_tracker/st_cb_readpixels.c
@@ -211,9 +211,11 @@ st_fast_readpixels(struct gl_context *ctx, struct st_renderbuffer *strb,
 
    if (strb->format == PIPE_FORMAT_B8G8R8A8_UNORM) {
       alphaORoperand = 0;
-   } else if (strb->format == PIPE_FORMAT_B8G8R8X8_UNORM ) {
+   }
+   else if (strb->format == PIPE_FORMAT_B8G8R8X8_UNORM ) {
       alphaORoperand = 0xff;
-   } else {
+   }
+   else {
       return GL_FALSE;
    }
 
@@ -312,9 +314,10 @@ st_fast_readpixels(struct gl_context *ctx, struct st_renderbuffer *strb,
             const GLubyte *src = map + y * trans->stride;
             memcpy(dst, src, 4 * width);
             if (alphaORoperand) {
-                for (col = 0; col < width; col++) {
-                    dst[col*4+3] |= alphaORoperand;
-                }
+               assert(alphaORoperand == 0xff);
+               for (col = 0; col < width; col++) {
+                  dst[col*4+3] = 0xff;
+               }
             }
             dst += dstStride;
             y += dy;



More information about the mesa-commit mailing list