Skip to content

Commit 40757b2

Browse files
mspangCommit Bot
authored andcommitted
Use ConvertToGLBoolean instead of ternary operator in Context
Clean up Context by replacing foo ? GL_TRUE : GL_FALSE by ConvertToGLBoolean(foo); Change-Id: I6a6ee9c23bb30d8b4ef43371c04a94578758145e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1626309 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Michael Spang <spang@chromium.org>
1 parent de15ed3 commit 40757b2

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

src/libANGLE/Context.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,7 +1343,7 @@ void Context::getBooleanvImpl(GLenum pname, GLboolean *params)
13431343
*params = GL_TRUE;
13441344
break;
13451345
case GL_CONTEXT_ROBUST_ACCESS_EXT:
1346-
*params = mRobustAccess ? GL_TRUE : GL_FALSE;
1346+
*params = ConvertToGLBoolean(mRobustAccess);
13471347
break;
13481348

13491349
default:
@@ -5862,7 +5862,7 @@ GLboolean Context::isBuffer(GLuint buffer)
58625862
return GL_FALSE;
58635863
}
58645864

5865-
return (getBuffer(buffer) ? GL_TRUE : GL_FALSE);
5865+
return ConvertToGLBoolean(getBuffer(buffer));
58665866
}
58675867

58685868
GLboolean Context::isEnabled(GLenum cap)
@@ -5877,7 +5877,7 @@ GLboolean Context::isFramebuffer(GLuint framebuffer)
58775877
return GL_FALSE;
58785878
}
58795879

5880-
return (getFramebuffer(framebuffer) ? GL_TRUE : GL_FALSE);
5880+
return ConvertToGLBoolean(getFramebuffer(framebuffer));
58815881
}
58825882

58835883
GLboolean Context::isProgram(GLuint program)
@@ -5887,7 +5887,7 @@ GLboolean Context::isProgram(GLuint program)
58875887
return GL_FALSE;
58885888
}
58895889

5890-
return (getProgramNoResolveLink(program) ? GL_TRUE : GL_FALSE);
5890+
return ConvertToGLBoolean(getProgramNoResolveLink(program));
58915891
}
58925892

58935893
GLboolean Context::isRenderbuffer(GLuint renderbuffer)
@@ -5897,7 +5897,7 @@ GLboolean Context::isRenderbuffer(GLuint renderbuffer)
58975897
return GL_FALSE;
58985898
}
58995899

5900-
return (getRenderbuffer(renderbuffer) ? GL_TRUE : GL_FALSE);
5900+
return ConvertToGLBoolean(getRenderbuffer(renderbuffer));
59015901
}
59025902

59035903
GLboolean Context::isShader(GLuint shader)
@@ -5907,7 +5907,7 @@ GLboolean Context::isShader(GLuint shader)
59075907
return GL_FALSE;
59085908
}
59095909

5910-
return (getShader(shader) ? GL_TRUE : GL_FALSE);
5910+
return ConvertToGLBoolean(getShader(shader));
59115911
}
59125912

59135913
GLboolean Context::isTexture(GLuint texture)
@@ -5917,7 +5917,7 @@ GLboolean Context::isTexture(GLuint texture)
59175917
return GL_FALSE;
59185918
}
59195919

5920-
return (getTexture(texture) ? GL_TRUE : GL_FALSE);
5920+
return ConvertToGLBoolean(getTexture(texture));
59215921
}
59225922

59235923
void Context::linkProgram(GLuint program)
@@ -6249,7 +6249,7 @@ void Context::deleteQueries(GLsizei n, const GLuint *ids)
62496249

62506250
GLboolean Context::isQuery(GLuint id)
62516251
{
6252-
return (getQuery(id, false, QueryType::InvalidEnum) != nullptr) ? GL_TRUE : GL_FALSE;
6252+
return ConvertToGLBoolean(getQuery(id, false, QueryType::InvalidEnum) != nullptr);
62536253
}
62546254

62556255
void Context::uniformMatrix2x3fv(GLint location,
@@ -6347,7 +6347,7 @@ bool Context::isVertexArray(GLuint array)
63476347
}
63486348

63496349
VertexArray *vao = getVertexArray(array);
6350-
return (vao != nullptr ? GL_TRUE : GL_FALSE);
6350+
return ConvertToGLBoolean(vao != nullptr);
63516351
}
63526352

63536353
void Context::endTransformFeedback()
@@ -6424,7 +6424,7 @@ bool Context::isTransformFeedback(GLuint id)
64246424
}
64256425

64266426
const TransformFeedback *transformFeedback = getTransformFeedback(id);
6427-
return ((transformFeedback != nullptr) ? GL_TRUE : GL_FALSE);
6427+
return ConvertToGLBoolean(transformFeedback != nullptr);
64286428
}
64296429

64306430
void Context::pauseTransformFeedback()
@@ -6963,7 +6963,7 @@ GLboolean Context::isProgramPipeline(GLuint pipeline)
69636963
return GL_FALSE;
69646964
}
69656965

6966-
return (getProgramPipeline(pipeline) ? GL_TRUE : GL_FALSE);
6966+
return ConvertToGLBoolean(getProgramPipeline(pipeline));
69676967
}
69686968

69696969
void Context::finishFenceNV(GLuint fence)
@@ -7128,7 +7128,7 @@ GLboolean Context::isMemoryObject(GLuint memoryObject)
71287128
return GL_FALSE;
71297129
}
71307130

7131-
return (getMemoryObject(memoryObject) ? GL_TRUE : GL_FALSE);
7131+
return ConvertToGLBoolean(getMemoryObject(memoryObject));
71327132
}
71337133

71347134
void Context::createMemoryObjects(GLsizei n, GLuint *memoryObjects)

0 commit comments

Comments
 (0)