summaryrefslogtreecommitdiffstats
path: root/src/egl/main/eglsurface.c
diff options
context:
space:
mode:
authorEmil Velikov <[email protected]>2017-06-20 15:40:28 +0100
committerEmil Velikov <[email protected]>2017-06-26 12:41:00 +0100
commitc58af5cbb295760687b23428f8ac240459e5cf56 (patch)
tree0bf1c53aedde3010b4254c12531c6249e85d13ca /src/egl/main/eglsurface.c
parentd42b09580a5270e8906dad4b923f320d1de18167 (diff)
egl: fold _eglError() + return EGL_FALSE
The function _eglError() already explicitly returns EGL_FALSE, explicitly to simplify the callers. Make use of it. While EGL_FALSE is numerically identical to false, NULL, EGL_NO_FOO, storage is not the same so we cannot use it for "everything". Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
Diffstat (limited to 'src/egl/main/eglsurface.c')
-rw-r--r--src/egl/main/eglsurface.c74
1 files changed, 24 insertions, 50 deletions
diff --git a/src/egl/main/eglsurface.c b/src/egl/main/eglsurface.c
index 8094912ba12..f6e41f10d78 100644
--- a/src/egl/main/eglsurface.c
+++ b/src/egl/main/eglsurface.c
@@ -286,11 +286,9 @@ _eglInitSurface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint type,
return EGL_FALSE;
}
- if ((conf->SurfaceType & type) == 0) {
+ if ((conf->SurfaceType & type) == 0)
/* The config can't be used to create a surface of this type */
- _eglError(EGL_BAD_MATCH, func);
- return EGL_FALSE;
- }
+ return _eglError(EGL_BAD_MATCH, func);
_eglInitResource(&surf->Resource, sizeof(*surf), dpy);
surf->Type = type;
@@ -397,36 +395,32 @@ _eglQuerySurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface,
*value = surface->VGColorspace;
break;
case EGL_GL_COLORSPACE_KHR:
- if (!dpy->Extensions.KHR_gl_colorspace) {
- _eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface");
- return EGL_FALSE;
- }
+ if (!dpy->Extensions.KHR_gl_colorspace)
+ return _eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface");
+
*value = surface->GLColorspace;
break;
case EGL_POST_SUB_BUFFER_SUPPORTED_NV:
*value = surface->PostSubBufferSupportedNV;
break;
case EGL_BUFFER_AGE_EXT:
- if (!dpy->Extensions.EXT_buffer_age) {
- _eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface");
- return EGL_FALSE;
- }
+ if (!dpy->Extensions.EXT_buffer_age)
+ return _eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface");
+
_EGLContext *ctx = _eglGetCurrentContext();
EGLint result = drv->API.QueryBufferAge(drv, dpy, surface);
/* error happened */
if (result < 0)
return EGL_FALSE;
if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT ||
- ctx->DrawSurface != surface) {
- _eglError(EGL_BAD_SURFACE, "eglQuerySurface");
- return EGL_FALSE;
- }
+ ctx->DrawSurface != surface)
+ return _eglError(EGL_BAD_SURFACE, "eglQuerySurface");
+
*value = result;
surface->BufferAgeRead = EGL_TRUE;
break;
default:
- _eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface");
- return EGL_FALSE;
+ return _eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface");
}
return EGL_TRUE;
@@ -513,25 +507,17 @@ _eglBindTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface,
if (dpy->Extensions.NOK_texture_from_pixmap)
texture_type |= EGL_PIXMAP_BIT;
- if (!(surface->Type & texture_type)) {
- _eglError(EGL_BAD_SURFACE, "eglBindTexImage");
- return EGL_FALSE;
- }
+ if (!(surface->Type & texture_type))
+ return _eglError(EGL_BAD_SURFACE, "eglBindTexImage");
- if (surface->TextureFormat == EGL_NO_TEXTURE) {
- _eglError(EGL_BAD_MATCH, "eglBindTexImage");
- return EGL_FALSE;
- }
+ if (surface->TextureFormat == EGL_NO_TEXTURE)
+ return _eglError(EGL_BAD_MATCH, "eglBindTexImage");
- if (surface->TextureTarget == EGL_NO_TEXTURE) {
- _eglError(EGL_BAD_MATCH, "eglBindTexImage");
- return EGL_FALSE;
- }
+ if (surface->TextureTarget == EGL_NO_TEXTURE)
+ return _eglError(EGL_BAD_MATCH, "eglBindTexImage");
- if (buffer != EGL_BACK_BUFFER) {
- _eglError(EGL_BAD_PARAMETER, "eglBindTexImage");
- return EGL_FALSE;
- }
+ if (buffer != EGL_BACK_BUFFER)
+ return _eglError(EGL_BAD_PARAMETER, "eglBindTexImage");
surface->BoundToTexture = EGL_TRUE;
@@ -549,10 +535,7 @@ _eglReleaseTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
EGLint texture_type = EGL_PBUFFER_BIT;
if (surf == EGL_NO_SURFACE)
- {
- _eglError(EGL_BAD_SURFACE, "eglReleaseTexImage");
- return EGL_FALSE;
- }
+ return _eglError(EGL_BAD_SURFACE, "eglReleaseTexImage");
if (!surf->BoundToTexture)
{
@@ -561,25 +544,16 @@ _eglReleaseTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
}
if (surf->TextureFormat == EGL_NO_TEXTURE)
- {
- _eglError(EGL_BAD_MATCH, "eglReleaseTexImage");
- return EGL_FALSE;
- }
+ return _eglError(EGL_BAD_MATCH, "eglReleaseTexImage");
if (buffer != EGL_BACK_BUFFER)
- {
- _eglError(EGL_BAD_PARAMETER, "eglReleaseTexImage");
- return EGL_FALSE;
- }
+ return _eglError(EGL_BAD_PARAMETER, "eglReleaseTexImage");
if (dpy->Extensions.NOK_texture_from_pixmap)
texture_type |= EGL_PIXMAP_BIT;
if (!(surf->Type & texture_type))
- {
- _eglError(EGL_BAD_SURFACE, "eglReleaseTexImage");
- return EGL_FALSE;
- }
+ return _eglError(EGL_BAD_SURFACE, "eglReleaseTexImage");
surf->BoundToTexture = EGL_FALSE;