EGLBoolean EGLAPIENTRY ChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config) { EVENT( "(EGLDisplay dpy = 0x%0.8p, const EGLint *attrib_list = 0x%0.8p, " "EGLConfig *configs = 0x%0.8p, EGLint config_size = %d, EGLint *num_config = 0x%0.8p)", dpy, attrib_list, configs, config_size, num_config); Thread *thread = GetCurrentThread(); Display *display = static_cast<Display *>(dpy); AttributeMap attribMap = AttributeMap::CreateFromIntArray(attrib_list); Error error = ValidateChooseConfig(display, attribMap, config_size, num_config); if (error.isError()) { thread->setError(error); return EGL_FALSE; } ClipConfigs(display->getConfigs(attribMap), configs, config_size, num_config); thread->setError(NoError()); return EGL_TRUE; }
EGLBoolean EGLAPIENTRY ChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config) { EVENT("(EGLDisplay dpy = 0x%0.8p, const EGLint *attrib_list = 0x%0.8p, " "EGLConfig *configs = 0x%0.8p, EGLint config_size = %d, EGLint *num_config = 0x%0.8p)", dpy, attrib_list, configs, config_size, num_config); Display *display = static_cast<Display*>(dpy); Error error = ValidateDisplay(display); if (error.isError()) { SetGlobalError(error); return EGL_FALSE; } if (!num_config) { SetGlobalError(Error(EGL_BAD_PARAMETER)); return EGL_FALSE; } std::vector<const Config*> filteredConfigs = display->getConfigs(AttributeMap(attrib_list)); if (configs) { filteredConfigs.resize(std::min<size_t>(filteredConfigs.size(), config_size)); for (size_t i = 0; i < filteredConfigs.size(); i++) { configs[i] = const_cast<Config*>(filteredConfigs[i]); } } *num_config = static_cast<EGLint>(filteredConfigs.size()); SetGlobalError(Error(EGL_SUCCESS)); return EGL_TRUE; }
EGLBoolean EGLAPIENTRY GetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config) { EVENT( "(EGLDisplay dpy = 0x%0.8p, EGLConfig *configs = 0x%0.8p, " "EGLint config_size = %d, EGLint *num_config = 0x%0.8p)", dpy, configs, config_size, num_config); Thread *thread = GetCurrentThread(); Display *display = static_cast<Display *>(dpy); Error error = ValidateGetConfigs(display, config_size, num_config); if (error.isError()) { thread->setError(error); return EGL_FALSE; } ClipConfigs(display->getConfigs(AttributeMap()), configs, config_size, num_config); thread->setError(NoError()); return EGL_TRUE; }