summaryrefslogtreecommitdiffstats
path: root/opengl/libagl
diff options
context:
space:
mode:
authorJack Palevich <>2009-03-25 15:12:17 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-25 15:12:17 -0700
commit1badb712b94f5d4a14ca8c3bdb55c215a4915000 (patch)
tree46cfe5f76368b7cb5355f8439bf4268fefd16ba0 /opengl/libagl
parent15ba27802eb23e01f4fada11f3fa1f35925eab49 (diff)
downloadframeworks_base-1badb712b94f5d4a14ca8c3bdb55c215a4915000.zip
frameworks_base-1badb712b94f5d4a14ca8c3bdb55c215a4915000.tar.gz
frameworks_base-1badb712b94f5d4a14ca8c3bdb55c215a4915000.tar.bz2
Automated import from //branches/master/...@142578,142578
Diffstat (limited to 'opengl/libagl')
-rw-r--r--opengl/libagl/egl.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/opengl/libagl/egl.cpp b/opengl/libagl/egl.cpp
index 5b90bf0..3b4c041 100644
--- a/opengl/libagl/egl.cpp
+++ b/opengl/libagl/egl.cpp
@@ -1055,8 +1055,12 @@ EGLBoolean eglChooseConfig( EGLDisplay dpy, const EGLint *attrib_list,
{
if (egl_display_t::is_valid(dpy) == EGL_FALSE)
return setError(EGL_BAD_DISPLAY, EGL_FALSE);
+
+ if (ggl_unlikely(num_config==0)) {
+ return setError(EGL_BAD_PARAMETER, EGL_FALSE);
+ }
- if (ggl_unlikely(configs==0 || attrib_list==0)) {
+ if (ggl_unlikely(attrib_list==0)) {
*num_config = 0;
return EGL_TRUE;
}
@@ -1102,11 +1106,19 @@ EGLBoolean eglChooseConfig( EGLDisplay dpy, const EGLint *attrib_list,
// return the configurations found
int n=0;
if (possibleMatch) {
- for (int i=0 ; config_size && i<numConfigs ; i++) {
- if (possibleMatch & (1<<i)) {
- *configs++ = (EGLConfig)i;
- config_size--;
- n++;
+ if (configs) {
+ for (int i=0 ; config_size && i<numConfigs ; i++) {
+ if (possibleMatch & (1<<i)) {
+ *configs++ = (EGLConfig)i;
+ config_size--;
+ n++;
+ }
+ }
+ } else {
+ for (int i=0 ; i<numConfigs ; i++) {
+ if (possibleMatch & (1<<i)) {
+ n++;
+ }
}
}
}