diff options
author | Jamie Gennis <jgennis@google.com> | 2012-04-13 14:48:22 -0700 |
---|---|---|
committer | Jamie Gennis <jgennis@google.com> | 2012-04-13 16:04:15 -0700 |
commit | 2b4bfa5efec7df408b4db127961cfc9aca9e57cf (patch) | |
tree | efc73bb0fcc14e83a5ad7e77542f516929996646 /core | |
parent | 58ab2bcca92e7e985fdc1886dfeea924f991441d (diff) | |
download | frameworks_base-2b4bfa5efec7df408b4db127961cfc9aca9e57cf.zip frameworks_base-2b4bfa5efec7df408b4db127961cfc9aca9e57cf.tar.gz frameworks_base-2b4bfa5efec7df408b4db127961cfc9aca9e57cf.tar.bz2 |
SurfaceTexture: update API docs
This change updates the SurfaceTexture API docs and modifies the behavior of
the updateTexImage to produce an IllegalStateException when not attached to a
GLES context.
Change-Id: I5a0875927785108960985c567d571d5f7033256a
Diffstat (limited to 'core')
-rw-r--r-- | core/jni/android/graphics/SurfaceTexture.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/core/jni/android/graphics/SurfaceTexture.cpp b/core/jni/android/graphics/SurfaceTexture.cpp index 244b166..77ad11e 100644 --- a/core/jni/android/graphics/SurfaceTexture.cpp +++ b/core/jni/android/graphics/SurfaceTexture.cpp @@ -35,6 +35,7 @@ namespace android { static const char* const OutOfResourcesException = "android/graphics/SurfaceTexture$OutOfResourcesException"; +static const char* const IllegalStateException = "java/lang/IllegalStateException"; const char* const kSurfaceTextureClassPathName = "android/graphics/SurfaceTexture"; struct fields_t { @@ -212,10 +213,16 @@ static void SurfaceTexture_setDefaultBufferSize( surfaceTexture->setDefaultBufferSize(width, height); } -static jint SurfaceTexture_updateTexImage(JNIEnv* env, jobject thiz) +static void SurfaceTexture_updateTexImage(JNIEnv* env, jobject thiz) { sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz)); - return surfaceTexture->updateTexImage(); + status_t err = surfaceTexture->updateTexImage(); + if (err == INVALID_OPERATION) { + jniThrowException(env, IllegalStateException, "Unable to update texture contents (see " + "logcat for details)"); + } else { + jniThrowRuntimeException(env, "Error during updateTexImage (see logcat for details)"); + } } static jint SurfaceTexture_detachFromGLContext(JNIEnv* env, jobject thiz) @@ -258,7 +265,7 @@ static JNINativeMethod gSurfaceTextureMethods[] = { {"nativeInit", "(ILjava/lang/Object;Z)V", (void*)SurfaceTexture_init }, {"nativeFinalize", "()V", (void*)SurfaceTexture_finalize }, {"nativeSetDefaultBufferSize", "(II)V", (void*)SurfaceTexture_setDefaultBufferSize }, - {"nativeUpdateTexImage", "()I", (void*)SurfaceTexture_updateTexImage }, + {"nativeUpdateTexImage", "()V", (void*)SurfaceTexture_updateTexImage }, {"nativeDetachFromGLContext", "()I", (void*)SurfaceTexture_detachFromGLContext }, {"nativeAttachToGLContext", "(I)I", (void*)SurfaceTexture_attachToGLContext }, {"nativeGetTransformMatrix", "([F)V", (void*)SurfaceTexture_getTransformMatrix }, |