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) {
|
int EglDisplay::chooseConfigs(const EglConfig& dummy,EGLConfig* configs,int config_size) {
|
||||||
android::Mutex::Autolock mutex(m_lock);
|
android::Mutex::Autolock mutex(m_lock);
|
||||||
int added = 0;
|
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)){
|
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
|
//no need to sort since the configurations are saved already in sorted maner
|
||||||
|
|||||||
@@ -411,14 +411,16 @@ EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay display, const EGLint *
|
|||||||
i+=2;
|
i+=2;
|
||||||
}
|
}
|
||||||
if(hasConfigId) {
|
if(hasConfigId) {
|
||||||
EglConfig* pConfig = dpy->getConfig(config_id);
|
EglConfig* pConfig = dpy->getConfig(config_id);
|
||||||
if(pConfig) {
|
if(pConfig) {
|
||||||
configs[0] = static_cast<EGLConfig>(pConfig);
|
if(configs) {
|
||||||
*num_config = 0;
|
configs[0] = static_cast<EGLConfig>(pConfig);
|
||||||
return EGL_TRUE;
|
}
|
||||||
} else {
|
*num_config = 1;
|
||||||
|
return EGL_TRUE;
|
||||||
|
} else {
|
||||||
RETURN_ERROR(EGL_FALSE,EGL_BAD_ATTRIBUTE);
|
RETURN_ERROR(EGL_FALSE,EGL_BAD_ATTRIBUTE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EGLNativePixelFormatType tmpfrmt = PIXEL_FORMAT_INITIALIZER;
|
EGLNativePixelFormatType tmpfrmt = PIXEL_FORMAT_INITIALIZER;
|
||||||
|
|||||||
Reference in New Issue
Block a user