These are the inverse of the _eglLookup*() functions. Returns the public handle for a private surface/config/display/etc. Removes glapi.c's direct access of private fields.tags/mesa_20090313
@@ -53,10 +53,7 @@ eglGetDisplay(NativeDisplayType displayName) | |||
_EGLDisplay *dpy; | |||
_eglInitGlobals(); | |||
dpy = _eglNewDisplay(displayName); | |||
if (dpy) | |||
return dpy->Handle; | |||
else | |||
return EGL_NO_DISPLAY; | |||
return _eglGetDisplayHandle(dpy); | |||
} | |||
@@ -269,10 +266,7 @@ EGLDisplay EGLAPIENTRY | |||
eglGetCurrentDisplay(void) | |||
{ | |||
_EGLDisplay *dpy = _eglGetCurrentDisplay(); | |||
if (dpy) | |||
return dpy->Handle; | |||
else | |||
return EGL_NO_DISPLAY; | |||
return _eglGetDisplayHandle(dpy); | |||
} | |||
@@ -288,10 +282,7 @@ EGLSurface EGLAPIENTRY | |||
eglGetCurrentSurface(EGLint readdraw) | |||
{ | |||
_EGLSurface *s = _eglGetCurrentSurface(readdraw); | |||
if (s) | |||
return s->Handle; | |||
else | |||
return EGL_NO_SURFACE; | |||
return _eglGetSurfaceHandle(s); | |||
} | |||
@@ -101,8 +101,20 @@ _eglInitConfig(_EGLConfig *config, EGLint id) | |||
} | |||
/** | |||
* Return the public handle for an internal _EGLConfig. | |||
* This is the inverse of _eglLookupConfig(). | |||
*/ | |||
EGLConfig | |||
_eglGetConfigHandle(_EGLConfig *config) | |||
{ | |||
return config ? config->Handle : 0; | |||
} | |||
/** | |||
* Given an EGLConfig handle, return the corresponding _EGLConfig object. | |||
* This is the inverse of _eglGetConfigHandle(). | |||
*/ | |||
_EGLConfig * | |||
_eglLookupConfig(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config) |
@@ -27,6 +27,10 @@ extern void | |||
_eglInitConfig(_EGLConfig *config, EGLint id); | |||
extern EGLConfig | |||
_eglGetConfigHandle(_EGLConfig *config); | |||
extern _EGLConfig * | |||
_eglLookupConfig(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config); | |||
@@ -39,9 +39,24 @@ _eglNewDisplay(NativeDisplayType displayName) | |||
} | |||
/** | |||
* Return the public handle for an internal _EGLDisplay. | |||
* This is the inverse of _eglLookupDisplay(). | |||
*/ | |||
EGLDisplay | |||
_eglGetDisplayHandle(_EGLDisplay *display) | |||
{ | |||
if (display) | |||
return display->Handle; | |||
else | |||
return EGL_NO_DISPLAY; | |||
} | |||
/** | |||
* Return the _EGLDisplay object that corresponds to the given public/ | |||
* opaque display handle. | |||
* This is the inverse of _eglGetDisplayHandle(). | |||
*/ | |||
_EGLDisplay * | |||
_eglLookupDisplay(EGLDisplay dpy) |
@@ -24,6 +24,10 @@ extern _EGLDisplay * | |||
_eglNewDisplay(NativeDisplayType displayName); | |||
EGLDisplay | |||
_eglGetDisplayHandle(_EGLDisplay *display); | |||
extern _EGLDisplay * | |||
_eglLookupDisplay(EGLDisplay dpy); | |||
@@ -223,6 +223,26 @@ _eglRemoveSurface(_EGLSurface *surf) | |||
} | |||
/** | |||
* Return the public handle for an internal _EGLSurface. | |||
* This is the inverse of _eglLookupSurface(). | |||
*/ | |||
EGLSurface | |||
_eglGetSurfaceHandle(_EGLSurface *surface) | |||
{ | |||
if (surface) | |||
return surface->Handle; | |||
else | |||
return EGL_NO_SURFACE; | |||
} | |||
/** | |||
* Return the private _EGLSurface which corresponds to a public EGLSurface | |||
* handle. | |||
* This is the inverse of _eglGetSurfaceHandle(). | |||
*/ | |||
_EGLSurface * | |||
_eglLookupSurface(EGLSurface surf) | |||
{ |
@@ -51,6 +51,10 @@ extern void | |||
_eglRemoveSurface(_EGLSurface *surf); | |||
extern EGLSurface | |||
_eglGetSurfaceHandle(_EGLSurface *surface); | |||
extern _EGLSurface * | |||
_eglLookupSurface(EGLSurface surf); | |||