summaryrefslogtreecommitdiffstats
path: root/src/egl/main/eglscreen.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2005-11-27 23:57:19 +0000
committerBrian Paul <[email protected]>2005-11-27 23:57:19 +0000
commitd548bf41d3a0fe443494f94f745d1fe49e5e432c (patch)
treecab77e3db7da666f4403b0811ec5d86556e3efbd /src/egl/main/eglscreen.c
parent49b2d2e90f524d8d404de4b618dcd6250a14667a (diff)
Redo _eglInitSurface() so it can be used with all surface types.
Redo _eglInitContext() to do error checking, attribute list parsing, etc.
Diffstat (limited to 'src/egl/main/eglscreen.c')
-rw-r--r--src/egl/main/eglscreen.c63
1 files changed, 13 insertions, 50 deletions
diff --git a/src/egl/main/eglscreen.c b/src/egl/main/eglscreen.c
index e213e9a8472..c4cc8bfe1ac 100644
--- a/src/egl/main/eglscreen.c
+++ b/src/egl/main/eglscreen.c
@@ -106,67 +106,30 @@ _eglGetScreensMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA *screens,
/**
- * Initialize the given _EGLSurface object. Do error checking.
- * Assign it an EGLSurface handle and insert into hash table.
- * \return EGLSurface handle or EGL_NO_SURFACE if error.
+ * Example function - drivers should do a proper implementation.
*/
EGLSurface
-_eglInitScreenSurface(_EGLSurface *surf, _EGLDriver *drv, EGLDisplay dpy,
- EGLConfig config, const EGLint *attrib_list)
+_eglCreateScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
+ const EGLint *attrib_list)
{
- EGLint width = 0, height = 0;
- EGLint i;
+#if 0 /* THIS IS JUST EXAMPLE CODE */
+ _EGLSurface *surf;
- for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
- switch (attrib_list[i]) {
- case EGL_WIDTH:
- width = attrib_list[++i];
- break;
- case EGL_HEIGHT:
- height = attrib_list[++i];
- break;
- default:
- _eglError(EGL_BAD_ATTRIBUTE, "eglCreateScreenSurfaceMESA");
- return EGL_NO_SURFACE;
- }
- }
+ surf = (_EGLSurface *) calloc(1, sizeof(_EGLSurface));
+ if (!surf)
+ return EGL_NO_SURFACE;
- if (width <= 0 || height <= 0) {
- _eglError(EGL_BAD_ATTRIBUTE,
- "eglCreateScreenSurfaceMESA(width or height)");
+ if (!_eglInitSurface(drv, dpy, surf, EGL_SCREEN_BIT_MESA,
+ config, attrib_list)) {
+ free(surf);
return EGL_NO_SURFACE;
}
- _eglInitSurface(surf);
- surf->Width = width;
- surf->Height = height;
- surf->Type = EGL_SCREEN_BIT_MESA;
- surf->Config = _eglLookupConfig(drv, dpy, config);
-
- /* insert into hash table */
_eglSaveSurface(surf);
- assert(surf->Handle);
return surf->Handle;
-}
-
-
-/**
- * Create a drawing surface which can be directly displayed on a screen.
- */
-EGLSurface
-_eglCreateScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
- const EGLint *attrib_list)
-{
- _EGLSurface *surf;
- EGLSurface surface;
-
- surf = (_EGLSurface *) malloc(sizeof(_EGLSurface));
- surface = _eglInitScreenSurface(surf, drv, dpy, config, attrib_list);
- if (surface == EGL_NO_SURFACE)
- free(surf);
-
- return surface;
+#endif
+ return EGL_NO_SURFACE;
}