summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEmil Velikov <[email protected]>2017-06-29 00:09:15 +0100
committerEmil Velikov <[email protected]>2017-07-12 15:43:05 +0100
commitd13dcca2c2ba8fdebf81b5db79dbedbc1835c701 (patch)
tree6a177e8daa0af399f3f4cac88dbff812247df40f /src
parent448f70e36675920ebf1d4489facedd7b78b4b28b (diff)
egl: polish EXT_image_dma_buf_import attr parsing
Simplify the existing if/else + temporary variable into if (foo) return X. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/egl/main/eglimage.c51
1 files changed, 22 insertions, 29 deletions
diff --git a/src/egl/main/eglimage.c b/src/egl/main/eglimage.c
index 3c78a7f34d7..dfc7dec2406 100644
--- a/src/egl/main/eglimage.c
+++ b/src/egl/main/eglimage.c
@@ -106,8 +106,6 @@ static EGLint
_eglParseEXTImageDmaBufImportAttribs(_EGLImageAttribs *attrs, _EGLDisplay *dpy,
EGLint attr, EGLint val)
{
- EGLint err = EGL_SUCCESS;
-
switch (attr) {
case EGL_LINUX_DRM_FOURCC_EXT:
attrs->DMABufFourCC.Value = val;
@@ -151,45 +149,40 @@ _eglParseEXTImageDmaBufImportAttribs(_EGLImageAttribs *attrs, _EGLDisplay *dpy,
break;
case EGL_YUV_COLOR_SPACE_HINT_EXT:
if (val != EGL_ITU_REC601_EXT && val != EGL_ITU_REC709_EXT &&
- val != EGL_ITU_REC2020_EXT) {
- err = EGL_BAD_ATTRIBUTE;
- } else {
- attrs->DMABufYuvColorSpaceHint.Value = val;
- attrs->DMABufYuvColorSpaceHint.IsPresent = EGL_TRUE;
- }
+ val != EGL_ITU_REC2020_EXT)
+ return EGL_BAD_ATTRIBUTE;
+
+ attrs->DMABufYuvColorSpaceHint.Value = val;
+ attrs->DMABufYuvColorSpaceHint.IsPresent = EGL_TRUE;
break;
case EGL_SAMPLE_RANGE_HINT_EXT:
- if (val != EGL_YUV_FULL_RANGE_EXT && val != EGL_YUV_NARROW_RANGE_EXT) {
- err = EGL_BAD_ATTRIBUTE;
- } else {
- attrs->DMABufSampleRangeHint.Value = val;
- attrs->DMABufSampleRangeHint.IsPresent = EGL_TRUE;
- }
+ if (val != EGL_YUV_FULL_RANGE_EXT && val != EGL_YUV_NARROW_RANGE_EXT)
+ return EGL_BAD_ATTRIBUTE;
+
+ attrs->DMABufSampleRangeHint.Value = val;
+ attrs->DMABufSampleRangeHint.IsPresent = EGL_TRUE;
break;
case EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT:
if (val != EGL_YUV_CHROMA_SITING_0_EXT &&
- val != EGL_YUV_CHROMA_SITING_0_5_EXT) {
- err = EGL_BAD_ATTRIBUTE;
- } else {
- attrs->DMABufChromaHorizontalSiting.Value = val;
- attrs->DMABufChromaHorizontalSiting.IsPresent = EGL_TRUE;
- }
+ val != EGL_YUV_CHROMA_SITING_0_5_EXT)
+ return EGL_BAD_ATTRIBUTE;
+
+ attrs->DMABufChromaHorizontalSiting.Value = val;
+ attrs->DMABufChromaHorizontalSiting.IsPresent = EGL_TRUE;
break;
case EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT:
if (val != EGL_YUV_CHROMA_SITING_0_EXT &&
- val != EGL_YUV_CHROMA_SITING_0_5_EXT) {
- err = EGL_BAD_ATTRIBUTE;
- } else {
- attrs->DMABufChromaVerticalSiting.Value = val;
- attrs->DMABufChromaVerticalSiting.IsPresent = EGL_TRUE;
- }
+ val != EGL_YUV_CHROMA_SITING_0_5_EXT)
+ return EGL_BAD_ATTRIBUTE;
+
+ attrs->DMABufChromaVerticalSiting.Value = val;
+ attrs->DMABufChromaVerticalSiting.IsPresent = EGL_TRUE;
break;
default:
- err = EGL_BAD_PARAMETER;
- break;
+ return EGL_BAD_PARAMETER;
}
- return err;
+ return EGL_SUCCESS;
}
static EGLint