EglChooseConfig should handle the case where "configs" is NULL.
Change-Id: I236afdfc73eb5dd5a3ab19e2b388772ea297bdb4
This commit is contained in:
@@ -170,10 +170,13 @@ int EglDisplay::getConfigs(EGLConfig* configs,int config_size) {
|
||||
int EglDisplay::chooseConfigs(const EglConfig& dummy,EGLConfig* configs,int config_size) {
|
||||
android::Mutex::Autolock mutex(m_lock);
|
||||
int added = 0;
|
||||
for(ConfigsList::iterator it = m_configs.begin(); it != m_configs.end() && added < config_size;it++) {
|
||||
for(ConfigsList::iterator it = m_configs.begin(); it != m_configs.end() && (added < config_size || !configs);it++) {
|
||||
|
||||
if( (*it)->choosen(dummy)){
|
||||
configs[added++] = static_cast<EGLConfig>(*it);
|
||||
if(configs) {
|
||||
configs[added] = static_cast<EGLConfig>(*it);
|
||||
}
|
||||
added++;
|
||||
}
|
||||
}
|
||||
//no need to sort since the configurations are saved already in sorted maner
|
||||
|
||||
@@ -413,8 +413,10 @@ EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay display, const EGLint *
|
||||
if(hasConfigId) {
|
||||
EglConfig* pConfig = dpy->getConfig(config_id);
|
||||
if(pConfig) {
|
||||
if(configs) {
|
||||
configs[0] = static_cast<EGLConfig>(pConfig);
|
||||
*num_config = 0;
|
||||
}
|
||||
*num_config = 1;
|
||||
return EGL_TRUE;
|
||||
} else {
|
||||
RETURN_ERROR(EGL_FALSE,EGL_BAD_ATTRIBUTE);
|
||||
|
||||
Reference in New Issue
Block a user