Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -21025,6 +21025,7 @@ package android.view { public static abstract interface TextureView.SurfaceTextureListener { method public abstract void onSurfaceTextureAvailable(android.graphics.SurfaceTexture); method public abstract void onSurfaceTextureSizeChanged(android.graphics.SurfaceTexture, int, int); } public class TouchDelegate { core/java/android/view/GLES20Canvas.java +1 −2 Original line number Diff line number Diff line Loading @@ -163,8 +163,7 @@ class GLES20Canvas extends HardwareCanvas { static native int nCreateTextureLayer(int[] layerInfo); static native int nCreateLayer(int width, int height, boolean isOpaque, int[] layerInfo); static native void nResizeLayer(int layerId, int width, int height, int[] layerInfo); static native void nUpdateTextureLayer(int layerId, int width, int height, float[] textureTransform); static native void nUpdateTextureLayer(int layerId, int width, int height, int surface); static native void nDestroyLayer(int layerId); static native void nDestroyLayerDeferred(int layerId); Loading core/java/android/view/GLES20TextureLayer.java +2 −2 Original line number Diff line number Diff line Loading @@ -70,7 +70,7 @@ class GLES20TextureLayer extends GLES20Layer { return mSurface; } void update(int width, int height, float[] textureTransform) { GLES20Canvas.nUpdateTextureLayer(mLayer, width, height, textureTransform); void update(int width, int height, int surface) { GLES20Canvas.nUpdateTextureLayer(mLayer, width, height, surface); } } core/java/android/view/HardwareRenderer.java +4 −5 Original line number Diff line number Diff line Loading @@ -202,11 +202,10 @@ public abstract class HardwareRenderer { * @param layer The hardware layer to update * @param width The layer's width * @param height The layer's height * @param textureTransform A 4x4 column-first transform matrix to apply to * texture coordinates * @param surface The surface to update */ abstract void updateTextureLayer(HardwareLayer layer, int width, int height, float[] textureTransform); SurfaceTexture surface); /** * Initializes the hardware renderer for the specified surface and setup the Loading Loading @@ -800,8 +799,8 @@ public abstract class HardwareRenderer { @Override void updateTextureLayer(HardwareLayer layer, int width, int height, float[] textureTransform) { ((GLES20TextureLayer) layer).update(width, height, textureTransform); SurfaceTexture surface) { ((GLES20TextureLayer) layer).update(width, height, surface.mSurfaceTexture); } static HardwareRenderer create(boolean translucent) { Loading core/java/android/view/TextureView.java +47 −9 Original line number Diff line number Diff line Loading @@ -73,6 +73,10 @@ import android.util.Log; * // Something bad happened * } * } * * public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) { * // Ignored, Camera does all the work for us * } * } * </pre> * Loading @@ -91,14 +95,13 @@ public class TextureView extends View { private SurfaceTexture mSurface; private SurfaceTextureListener mListener; private final float[] mTextureTransform = new float[16]; private final Runnable mUpdateLayerAction = new Runnable() { @Override public void run() { updateLayer(); } }; private SurfaceTexture.OnFrameAvailableListener mUpdateListener; /** * Creates a new TextureView. Loading Loading @@ -209,6 +212,14 @@ public class TextureView extends View { protected final void onDraw(Canvas canvas) { } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); if (mSurface != null) { nSetDefaultBufferSize(mSurface.mSurfaceTexture, getWidth(), getHeight()); } } @Override HardwareLayer getHardwareLayer() { if (mAttachInfo == null || mAttachInfo.mHardwareRenderer == null) { Loading @@ -218,15 +229,17 @@ public class TextureView extends View { if (mLayer == null) { mLayer = mAttachInfo.mHardwareRenderer.createHardwareLayer(); mSurface = mAttachInfo.mHardwareRenderer.createSuraceTexture(mLayer); nSetDefaultBufferSize(mSurface.mSurfaceTexture, getWidth(), getHeight()); mSurface.setOnFrameAvailableListener(new SurfaceTexture.OnFrameAvailableListener() { mUpdateListener = new SurfaceTexture.OnFrameAvailableListener() { @Override public void onFrameAvailable(SurfaceTexture surfaceTexture) { // Per SurfaceTexture's documentation, the callback may be invoked // from an arbitrary thread post(mUpdateLayerAction); } }); }; mSurface.setOnFrameAvailableListener(mUpdateListener); if (mListener != null) { mListener.onSurfaceTextureAvailable(mSurface); Loading @@ -236,16 +249,29 @@ public class TextureView extends View { return mLayer; } @Override protected void onVisibilityChanged(View changedView, int visibility) { super.onVisibilityChanged(changedView, visibility); if (mSurface != null) { // When the view becomes invisible, stop updating it, it's a waste of CPU // To cancel updates, the easiest thing to do is simply to remove the // updates listener if (visibility == VISIBLE) { mSurface.setOnFrameAvailableListener(mUpdateListener); updateLayer(); } else { mSurface.setOnFrameAvailableListener(null); } } } private void updateLayer() { if (mAttachInfo == null || mAttachInfo.mHardwareRenderer == null) { return; } mSurface.updateTexImage(); mSurface.getTransformMatrix(mTextureTransform); mAttachInfo.mHardwareRenderer.updateTextureLayer(mLayer, getWidth(), getHeight(), mTextureTransform); mAttachInfo.mHardwareRenderer.updateTextureLayer(mLayer, getWidth(), getHeight(), mSurface); invalidate(); } Loading Loading @@ -292,5 +318,17 @@ public class TextureView extends View { * {@link android.view.TextureView#getSurfaceTexture()} */ public void onSurfaceTextureAvailable(SurfaceTexture surface); /** * Invoked when the {@link SurfaceTexture}'s buffers size changed. * * @param surface The surface returned by * {@link android.view.TextureView#getSurfaceTexture()} * @param width The new width of the surface * @param height The new height of the surface */ public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height); } private static native void nSetDefaultBufferSize(int surfaceTexture, int width, int height); } Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -21025,6 +21025,7 @@ package android.view { public static abstract interface TextureView.SurfaceTextureListener { method public abstract void onSurfaceTextureAvailable(android.graphics.SurfaceTexture); method public abstract void onSurfaceTextureSizeChanged(android.graphics.SurfaceTexture, int, int); } public class TouchDelegate {
core/java/android/view/GLES20Canvas.java +1 −2 Original line number Diff line number Diff line Loading @@ -163,8 +163,7 @@ class GLES20Canvas extends HardwareCanvas { static native int nCreateTextureLayer(int[] layerInfo); static native int nCreateLayer(int width, int height, boolean isOpaque, int[] layerInfo); static native void nResizeLayer(int layerId, int width, int height, int[] layerInfo); static native void nUpdateTextureLayer(int layerId, int width, int height, float[] textureTransform); static native void nUpdateTextureLayer(int layerId, int width, int height, int surface); static native void nDestroyLayer(int layerId); static native void nDestroyLayerDeferred(int layerId); Loading
core/java/android/view/GLES20TextureLayer.java +2 −2 Original line number Diff line number Diff line Loading @@ -70,7 +70,7 @@ class GLES20TextureLayer extends GLES20Layer { return mSurface; } void update(int width, int height, float[] textureTransform) { GLES20Canvas.nUpdateTextureLayer(mLayer, width, height, textureTransform); void update(int width, int height, int surface) { GLES20Canvas.nUpdateTextureLayer(mLayer, width, height, surface); } }
core/java/android/view/HardwareRenderer.java +4 −5 Original line number Diff line number Diff line Loading @@ -202,11 +202,10 @@ public abstract class HardwareRenderer { * @param layer The hardware layer to update * @param width The layer's width * @param height The layer's height * @param textureTransform A 4x4 column-first transform matrix to apply to * texture coordinates * @param surface The surface to update */ abstract void updateTextureLayer(HardwareLayer layer, int width, int height, float[] textureTransform); SurfaceTexture surface); /** * Initializes the hardware renderer for the specified surface and setup the Loading Loading @@ -800,8 +799,8 @@ public abstract class HardwareRenderer { @Override void updateTextureLayer(HardwareLayer layer, int width, int height, float[] textureTransform) { ((GLES20TextureLayer) layer).update(width, height, textureTransform); SurfaceTexture surface) { ((GLES20TextureLayer) layer).update(width, height, surface.mSurfaceTexture); } static HardwareRenderer create(boolean translucent) { Loading
core/java/android/view/TextureView.java +47 −9 Original line number Diff line number Diff line Loading @@ -73,6 +73,10 @@ import android.util.Log; * // Something bad happened * } * } * * public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) { * // Ignored, Camera does all the work for us * } * } * </pre> * Loading @@ -91,14 +95,13 @@ public class TextureView extends View { private SurfaceTexture mSurface; private SurfaceTextureListener mListener; private final float[] mTextureTransform = new float[16]; private final Runnable mUpdateLayerAction = new Runnable() { @Override public void run() { updateLayer(); } }; private SurfaceTexture.OnFrameAvailableListener mUpdateListener; /** * Creates a new TextureView. Loading Loading @@ -209,6 +212,14 @@ public class TextureView extends View { protected final void onDraw(Canvas canvas) { } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); if (mSurface != null) { nSetDefaultBufferSize(mSurface.mSurfaceTexture, getWidth(), getHeight()); } } @Override HardwareLayer getHardwareLayer() { if (mAttachInfo == null || mAttachInfo.mHardwareRenderer == null) { Loading @@ -218,15 +229,17 @@ public class TextureView extends View { if (mLayer == null) { mLayer = mAttachInfo.mHardwareRenderer.createHardwareLayer(); mSurface = mAttachInfo.mHardwareRenderer.createSuraceTexture(mLayer); nSetDefaultBufferSize(mSurface.mSurfaceTexture, getWidth(), getHeight()); mSurface.setOnFrameAvailableListener(new SurfaceTexture.OnFrameAvailableListener() { mUpdateListener = new SurfaceTexture.OnFrameAvailableListener() { @Override public void onFrameAvailable(SurfaceTexture surfaceTexture) { // Per SurfaceTexture's documentation, the callback may be invoked // from an arbitrary thread post(mUpdateLayerAction); } }); }; mSurface.setOnFrameAvailableListener(mUpdateListener); if (mListener != null) { mListener.onSurfaceTextureAvailable(mSurface); Loading @@ -236,16 +249,29 @@ public class TextureView extends View { return mLayer; } @Override protected void onVisibilityChanged(View changedView, int visibility) { super.onVisibilityChanged(changedView, visibility); if (mSurface != null) { // When the view becomes invisible, stop updating it, it's a waste of CPU // To cancel updates, the easiest thing to do is simply to remove the // updates listener if (visibility == VISIBLE) { mSurface.setOnFrameAvailableListener(mUpdateListener); updateLayer(); } else { mSurface.setOnFrameAvailableListener(null); } } } private void updateLayer() { if (mAttachInfo == null || mAttachInfo.mHardwareRenderer == null) { return; } mSurface.updateTexImage(); mSurface.getTransformMatrix(mTextureTransform); mAttachInfo.mHardwareRenderer.updateTextureLayer(mLayer, getWidth(), getHeight(), mTextureTransform); mAttachInfo.mHardwareRenderer.updateTextureLayer(mLayer, getWidth(), getHeight(), mSurface); invalidate(); } Loading Loading @@ -292,5 +318,17 @@ public class TextureView extends View { * {@link android.view.TextureView#getSurfaceTexture()} */ public void onSurfaceTextureAvailable(SurfaceTexture surface); /** * Invoked when the {@link SurfaceTexture}'s buffers size changed. * * @param surface The surface returned by * {@link android.view.TextureView#getSurfaceTexture()} * @param width The new width of the surface * @param height The new height of the surface */ public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height); } private static native void nSetDefaultBufferSize(int surfaceTexture, int width, int height); }