Commit 47c1d6b7 authored by Adam Jackson's avatar Adam Jackson 💣

glx: Macroize building the attribute list in DoGetDrawableAttributes

No functional change, just a little easier to read and harder to get
wrong.
Reviewed-by: Eric Anholt's avatarEric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson's avatarAdam Jackson <ajax@redhat.com>
parent c01094c5
......@@ -1945,33 +1945,26 @@ DoGetDrawableAttributes(__GLXclientState * cl, XID drawId)
if (pGlxDraw)
pDraw = pGlxDraw->pDraw;
attributes[2*num] = GLX_Y_INVERTED_EXT;
attributes[2*num+1] = GL_FALSE;
num++;
attributes[2*num] = GLX_WIDTH;
attributes[2*num+1] = pDraw->width;
num++;
attributes[2*num] = GLX_HEIGHT;
attributes[2*num+1] = pDraw->height;
num++;
#define ATTRIB(a, v) do { \
attributes[2*num] = (a); \
attributes[2*num+1] = (v); \
num++; \
} while (0)
ATTRIB(GLX_Y_INVERTED_EXT, GL_FALSE);
ATTRIB(GLX_WIDTH, pDraw->width);
ATTRIB(GLX_HEIGHT, pDraw->height);
if (pGlxDraw) {
attributes[2*num] = GLX_TEXTURE_TARGET_EXT;
attributes[2*num+1] = pGlxDraw->target == GL_TEXTURE_2D ?
GLX_TEXTURE_2D_EXT :
GLX_TEXTURE_RECTANGLE_EXT;
num++;
attributes[2*num] = GLX_EVENT_MASK;
attributes[2*num+1] = pGlxDraw->eventMask;
num++;
attributes[2*num] = GLX_FBCONFIG_ID;
attributes[2*num+1] = pGlxDraw->config->fbconfigID;
num++;
ATTRIB(GLX_TEXTURE_TARGET_EXT,
pGlxDraw->target == GL_TEXTURE_2D ?
GLX_TEXTURE_2D_EXT : GLX_TEXTURE_RECTANGLE_EXT);
ATTRIB(GLX_EVENT_MASK, pGlxDraw->eventMask);
ATTRIB(GLX_FBCONFIG_ID, pGlxDraw->config->fbconfigID);
if (pGlxDraw->type == GLX_DRAWABLE_PBUFFER) {
attributes[2*num] = GLX_PRESERVED_CONTENTS;
attributes[2*num+1] = GL_TRUE;
num++;
ATTRIB(GLX_PRESERVED_CONTENTS, GL_TRUE);
}
}
#undef ATTRIB
reply = (xGLXGetDrawableAttributesReply) {
.type = X_Reply,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment