diff options
| author | Grace Kloba <klobag@google.com> | 2011-06-22 23:05:40 -0700 |
|---|---|---|
| committer | Grace Kloba <klobag@google.com> | 2011-06-22 23:05:40 -0700 |
| commit | cf559377b750271472aa0a717bf3b7d34abc0b39 (patch) | |
| tree | d7559dc48209ea1fe84c134ec5b83803dd5a1377 /core/java/android/view/TextureView.java | |
| parent | ea5f51909be34bdaec9d17320aaf25ffa56e76e9 (diff) | |
Add onSurfaceTextureUpdated to the TextureView listener.
The app needs a way to throttle the producer side. Expose this to enable it.
Change-Id: I04b6a3fc444117a9fc2449fb87c3c834247c8ef1
Diffstat (limited to 'core/java/android/view/TextureView.java')
| -rw-r--r-- | core/java/android/view/TextureView.java | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/core/java/android/view/TextureView.java b/core/java/android/view/TextureView.java index 4790289d3746..de398ebaa4b4 100644 --- a/core/java/android/view/TextureView.java +++ b/core/java/android/view/TextureView.java @@ -67,15 +67,19 @@ import android.util.Log; * // Something bad happened * } * } - * + * * public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) { * // Ignored, Camera does all the work for us * } - * + * * public void onSurfaceTextureDestroyed(SurfaceTexture surface) { * mCamera.stopPreview(); * mCamera.release(); * } + * + * public void onSurfaceTextureUpdated(SurfaceTexture surface) { + * // Ignored + * } * } * </pre> * @@ -315,6 +319,10 @@ public class TextureView extends View { mAttachInfo.mHardwareRenderer.updateTextureLayer(mLayer, getWidth(), getHeight(), mOpaque); + if (mListener != null) { + mListener.onSurfaceTextureUpdated(mSurface); + } + invalidate(); } @@ -474,6 +482,14 @@ public class TextureView extends View { * @param surface The surface about to be destroyed */ public void onSurfaceTextureDestroyed(SurfaceTexture surface); + + /** + * Invoked when the specified {@link SurfaceTexture} is updated through + * {@link SurfaceTexture#updateTexImage()}. + * + * @param surface The surface just updated + */ + public void onSurfaceTextureUpdated(SurfaceTexture surface); } private static native void nSetDefaultBufferSize(SurfaceTexture surfaceTexture, |
