diff options
author | Kyle Brenneman <[email protected]> | 2016-09-12 17:04:38 -0400 |
---|---|---|
committer | Adam Jackson <[email protected]> | 2016-09-14 11:45:58 -0400 |
commit | 7d7ae5e1c3451174a3c8dec2d50763a40069fe5b (patch) | |
tree | e8919a9ef13f55e4ce29c85530814f5853760fdc /src | |
parent | 017946b7247ea7c36219b44dfc118ccad4da7d1d (diff) |
egl: Use _eglCreateWindowSurfaceCommon consistently
This moves the native window fixup to a helper function so we don't
repeat ourselves.
Reviewed-by: Adam Jackson <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/egl/main/eglapi.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index df355a50424..dd2b4cc1ddd 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -762,14 +762,9 @@ eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, attrib_list); } - -static EGLSurface EGLAPIENTRY -eglCreatePlatformWindowSurfaceEXT(EGLDisplay dpy, EGLConfig config, - void *native_window, - const EGLint *attrib_list) +static void * +fixupNativeWindow(_EGLDisplay *disp, void *native_window) { - _EGLDisplay *disp = _eglLockDisplay(dpy); - #ifdef HAVE_X11_PLATFORM if (disp->Platform == _EGL_PLATFORM_X11 && native_window != NULL) { /* The `native_window` parameter for the X11 platform differs between @@ -779,9 +774,20 @@ eglCreatePlatformWindowSurfaceEXT(EGLDisplay dpy, EGLConfig config, * `Window*`. Convert `Window*` to `Window` because that's what * dri2_x11_create_window_surface() expects. */ - native_window = (void*) (* (Window*) native_window); + return (void *)(* (Window*) native_window); } #endif + return native_window; +} + +static EGLSurface EGLAPIENTRY +eglCreatePlatformWindowSurfaceEXT(EGLDisplay dpy, EGLConfig config, + void *native_window, + const EGLint *attrib_list) +{ + _EGLDisplay *disp = _eglLockDisplay(dpy); + + native_window = fixupNativeWindow(disp, native_window); return _eglCreateWindowSurfaceCommon(disp, config, native_window, attrib_list); @@ -793,14 +799,16 @@ eglCreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list) { + _EGLDisplay *disp = _eglLockDisplay(dpy); EGLSurface surface; EGLint *int_attribs = _eglConvertAttribsToInt(attrib_list); if (attrib_list && !int_attribs) RETURN_EGL_ERROR(NULL, EGL_BAD_ALLOC, EGL_NO_SURFACE); - surface = eglCreatePlatformWindowSurfaceEXT(dpy, config, native_window, - int_attribs); + native_window = fixupNativeWindow(disp, native_window); + surface = _eglCreateWindowSurfaceCommon(disp, config, native_window, + int_attribs); free(int_attribs); return surface; } |