Mesa (master): glx_pbuffer: Refactor GetDrawableAttribute

Eric Anholt anholt at kemper.freedesktop.org
Sat Mar 8 01:12:29 UTC 2014


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

Author: Adel Gadllah <adel.gadllah at gmail.com>
Date:   Mon Feb 24 20:44:41 2014 +0100

glx_pbuffer: Refactor GetDrawableAttribute

Move the pdraw != NULL check out so that they don't
have to be duplicated.

Signed-off-by: Adel Gadllah <adel.gadllah at gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/glx/glx_pbuffer.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c
index 411d6e5..978730c 100644
--- a/src/glx/glx_pbuffer.c
+++ b/src/glx/glx_pbuffer.c
@@ -350,6 +350,9 @@ GetDrawableAttribute(Display * dpy, GLXDrawable drawable,
          _XEatData(dpy, length);
       }
       else {
+#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
+         __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
+#endif
          _XRead(dpy, (char *) data, length * sizeof(CARD32));
 
          /* Search the set of returned attributes for the attribute requested by
@@ -363,13 +366,11 @@ GetDrawableAttribute(Display * dpy, GLXDrawable drawable,
          }
 
 #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
-         {
-            __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
-
-            if (pdraw != NULL && !pdraw->textureTarget)
+         if (pdraw != NULL) {
+            if (!pdraw->textureTarget)
                pdraw->textureTarget =
                   determineTextureTarget((const int *) data, num_attributes);
-            if (pdraw != NULL && !pdraw->textureFormat)
+            if (!pdraw->textureFormat)
                pdraw->textureFormat =
                   determineTextureFormat((const int *) data, num_attributes);
          }




More information about the mesa-commit mailing list