summaryrefslogtreecommitdiffstats
path: root/opengl
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-10-13 22:54:15 -0400
committerAndroid (Google) Code Review <android-gerrit@google.com>2009-10-13 22:54:15 -0400
commit3743559db03645ef7d319c0344238c335a315b65 (patch)
treed2ac3f7fdce8559392e82fe4612065688734aa5a /opengl
parent0741c134645300fed9ad13760273c8d245a04e63 (diff)
parent28023911a4b572f0ca640e7a3e3f9a0dd6f535e9 (diff)
downloadframeworks_base-3743559db03645ef7d319c0344238c335a315b65.zip
frameworks_base-3743559db03645ef7d319c0344238c335a315b65.tar.gz
frameworks_base-3743559db03645ef7d319c0344238c335a315b65.tar.bz2
Merge change I28023911 into eclair-mr2
* changes: Add additional error checking of EGL function calls.
Diffstat (limited to 'opengl')
-rw-r--r--opengl/java/android/opengl/GLSurfaceView.java19
1 files changed, 15 insertions, 4 deletions
diff --git a/opengl/java/android/opengl/GLSurfaceView.java b/opengl/java/android/opengl/GLSurfaceView.java
index c279eae..f485d26 100644
--- a/opengl/java/android/opengl/GLSurfaceView.java
+++ b/opengl/java/android/opengl/GLSurfaceView.java
@@ -682,7 +682,10 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
}
public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
int[] num_config = new int[1];
- egl.eglChooseConfig(display, mConfigSpec, null, 0, num_config);
+ if (!egl.eglChooseConfig(display, mConfigSpec, null, 0,
+ num_config)) {
+ throw new IllegalArgumentException("eglChooseConfig failed");
+ }
int numConfigs = num_config[0];
@@ -692,8 +695,10 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
}
EGLConfig[] configs = new EGLConfig[numConfigs];
- egl.eglChooseConfig(display, mConfigSpec, configs, numConfigs,
- num_config);
+ if (!egl.eglChooseConfig(display, mConfigSpec, configs, numConfigs,
+ num_config)) {
+ throw new IllegalArgumentException("eglChooseConfig#2 failed");
+ }
EGLConfig config = chooseConfig(egl, display, configs);
if (config == null) {
throw new IllegalArgumentException("No config chosen");
@@ -818,11 +823,17 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
*/
mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
+ if (mEglDisplay == EGL10.EGL_NO_DISPLAY) {
+ throw new RuntimeException("eglGetDisplay failed");
+ }
+
/*
* We can now initialize EGL for that display
*/
int[] version = new int[2];
- mEgl.eglInitialize(mEglDisplay, version);
+ if(!mEgl.eglInitialize(mEglDisplay, version)) {
+ throw new RuntimeException("eglInitialize failed");
+ }
mEglConfig = mEGLConfigChooser.chooseConfig(mEgl, mEglDisplay);
/*