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 /graphics | |
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 'graphics')
-rw-r--r-- | graphics/java/android/graphics/SurfaceTexture.java | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/graphics/java/android/graphics/SurfaceTexture.java b/graphics/java/android/graphics/SurfaceTexture.java index e101581..3fc20b5 100644 --- a/graphics/java/android/graphics/SurfaceTexture.java +++ b/graphics/java/android/graphics/SurfaceTexture.java @@ -155,19 +155,23 @@ public class SurfaceTexture { /** * Update the texture image to the most recent frame from the image stream. This may only be - * called while the OpenGL ES context that owns the texture is bound to the thread. It will - * implicitly bind its texture to the GL_TEXTURE_EXTERNAL_OES texture target. + * called while the OpenGL ES context that owns the texture is current on the calling thread. + * It will implicitly bind its texture to the GL_TEXTURE_EXTERNAL_OES texture target. */ public void updateTexImage() { - int err = nativeUpdateTexImage(); - if (err != 0) { - throw new RuntimeException("Error during updateTexImage (see logcat for details)"); - } + nativeUpdateTexImage(); } /** - * Detach the SurfaceTexture from the OpenGL ES context with which it is currently associated. - * This can be used to change from one OpenGL ES context to another. + * Detach the SurfaceTexture from the OpenGL ES context that owns the OpenGL ES texture object. + * This call must be made with the OpenGL ES context current on the calling thread. The OpenGL + * ES texture object will be deleted as a result of this call. After calling this method all + * calls to {@link #updateTexImage} will throw an {@link java.lang.IllegalStateException} until + * a successful call to {@link #attachToGLContext} is made. + * + * This can be used to access the SurfaceTexture image contents from multiple OpenGL ES + * contexts. Note, however, that the image contents are only accessible from one OpenGL ES + * context at a time. * * @hide */ @@ -179,6 +183,17 @@ public class SurfaceTexture { } /** + * Attach the SurfaceTexture to the OpenGL ES context that is current on the calling thread. A + * new OpenGL ES texture object is created and populated with the SurfaceTexture image frame + * that was current at the time of the last call to {@link #detachFromGLContext}. This new + * texture is bound to the GL_TEXTURE_EXTERNAL_OES texture target. + * + * This can be used to access the SurfaceTexture image contents from multiple OpenGL ES + * contexts. Note, however, that the image contents are only accessible from one OpenGL ES + * context at a time. + * + * @param texName The name of the OpenGL ES texture that will be created. This texture name + * must be unusued in the OpenGL ES context that is current on the calling thread. * * @hide */ @@ -292,7 +307,7 @@ public class SurfaceTexture { private native void nativeGetTransformMatrix(float[] mtx); private native long nativeGetTimestamp(); private native void nativeSetDefaultBufferSize(int width, int height); - private native int nativeUpdateTexImage(); + private native void nativeUpdateTexImage(); private native int nativeDetachFromGLContext(); private native int nativeAttachToGLContext(int texName); private native int nativeGetQueuedCount(); |