[Mesa-dev] [PATCH v2 1/3] glx: Simplify __glXReadPixelReply

Julien Cristau jcristau at debian.org
Fri Jul 20 02:09:18 PDT 2012


From: Julien Cristau <julien.cristau at logilab.fr>

Doing
	size = reply.length * 4;
	[...]
	extra = 4 - (size & 3);

is useless, size & 3 will always be 0.

Signed-off-by: Julien Cristau <julien.cristau at logilab.fr>
---
v2: also change the copy in src/glx/apple

 src/glx/apple/glxreply.c             |    5 -----
 src/mapi/glapi/gen/glX_proto_send.py |    5 -----
 2 files changed, 0 insertions(+), 10 deletions(-)

diff --git a/src/glx/apple/glxreply.c b/src/glx/apple/glxreply.c
index f17ebe6..6234e3c 100644
--- a/src/glx/apple/glxreply.c
+++ b/src/glx/apple/glxreply.c
@@ -86,12 +86,7 @@ __glXReadPixelReply(Display * dpy, struct glx_context * gc, unsigned max_dim,
          __glXSetError(gc, GL_OUT_OF_MEMORY);
       }
       else {
-         const GLint extra = 4 - (size & 3);
-
          _XRead(dpy, buf, size);
-         if (extra < 4) {
-            _XEatData(dpy, extra);
-         }
 
          __glEmptyImage(gc, 3, width, height, depth, format, type, buf, dest);
          Xfree(buf);
diff --git a/src/mapi/glapi/gen/glX_proto_send.py b/src/mapi/glapi/gen/glX_proto_send.py
index bec0222..9068a61 100644
--- a/src/mapi/glapi/gen/glX_proto_send.py
+++ b/src/mapi/glapi/gen/glX_proto_send.py
@@ -246,12 +246,7 @@ __glXReadPixelReply( Display *dpy, struct glx_context * gc, unsigned max_dim,
             __glXSetError(gc, GL_OUT_OF_MEMORY);
         }
         else {
-            const GLint extra = 4 - (size & 3);
-
             _XRead(dpy, buf, size);
-            if ( extra < 4 ) {
-                _XEatData(dpy, extra);
-            }
 
             __glEmptyImage(gc, 3, width, height, depth, format, type,
                            buf, dest);
-- 
1.7.2.5



More information about the mesa-dev mailing list