summaryrefslogtreecommitdiff
path: root/opengl/java/android
diff options
context:
space:
mode:
authorJack Palevich <jackpal@google.com>2009-10-13 20:10:10 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2009-10-13 20:10:10 -0700
commit86a19b3d2c873113d6da49257cf720f90d1c2498 (patch)
tree038d510bf663dddc1f1243fabc6c778c6a7e036e /opengl/java/android
parent8f26c13e5957d24ca384f119a774968a409747fa (diff)
parent70d12dda7c1e36850e1ed95d719bc1d6dadb6fef (diff)
am 70d12dda: am 3743559d: Merge change I28023911 into eclair-mr2
Merge commit '70d12dda7c1e36850e1ed95d719bc1d6dadb6fef' * commit '70d12dda7c1e36850e1ed95d719bc1d6dadb6fef': Add additional error checking of EGL function calls.
Diffstat (limited to 'opengl/java/android')
-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 c279eae43861..f485d264bb96 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);
/*