diff options
Diffstat (limited to 'src/egl/main/eglconfig.c')
-rw-r--r-- | src/egl/main/eglconfig.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/egl/main/eglconfig.c b/src/egl/main/eglconfig.c index 765e2e3dbeb..0fb7e260723 100644 --- a/src/egl/main/eglconfig.c +++ b/src/egl/main/eglconfig.c @@ -1,3 +1,4 @@ +#include <stdlib.h> #include <string.h> #include <assert.h> #include "eglconfig.h" @@ -51,6 +52,31 @@ _eglLookupConfig(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config) } +/** + * Add the given _EGLConifg to the given display. + */ +_EGLConfig * +_eglAddConfig(_EGLDisplay *display, const _EGLConfig *config) +{ + _EGLConfig *newConfigs; + EGLint n; + + n = display->NumConfigs; + + newConfigs = (_EGLConfig *) realloc(display->Configs, + (n + 1) * sizeof(_EGLConfig)); + if (newConfigs) { + display->Configs = newConfigs; + display->Configs[n] = *config; /* copy struct */ + display->NumConfigs++; + return display->Configs + n; + } + else { + return NULL; + } +} + + /** * Parse the attrib_list to fill in the fields of the given _egl_config |