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

Alex Deucher alexdeucher at gmail.com
Fri Jul 20 06:25:02 PDT 2012


On Fri, Jul 20, 2012 at 5:09 AM, Julien Cristau <jcristau at debian.org> wrote:
> 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>

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> ---
> 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
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list