diff options
-rw-r--r-- | core/java/android/view/GLES20Canvas.java | 3 | ||||
-rw-r--r-- | core/java/android/view/GLES20TextureLayer.java | 4 | ||||
-rw-r--r-- | core/java/android/view/HardwareRenderer.java | 13 | ||||
-rw-r--r-- | core/java/android/view/TextureView.java | 10 | ||||
-rw-r--r-- | core/jni/android_view_GLES20Canvas.cpp | 14 | ||||
-rw-r--r-- | core/jni/com_google_android_gles_jni_EGLImpl.cpp | 5 | ||||
-rw-r--r-- | graphics/java/android/graphics/SurfaceTexture.java | 5 | ||||
-rw-r--r-- | opengl/java/com/google/android/gles_jni/EGLImpl.java | 4 |
8 files changed, 29 insertions, 29 deletions
diff --git a/core/java/android/view/GLES20Canvas.java b/core/java/android/view/GLES20Canvas.java index 383bfb3..5216c49 100644 --- a/core/java/android/view/GLES20Canvas.java +++ b/core/java/android/view/GLES20Canvas.java @@ -29,6 +29,7 @@ import android.graphics.Rect; import android.graphics.RectF; import android.graphics.Region; import android.graphics.Shader; +import android.graphics.SurfaceTexture; import android.graphics.TemporaryBuffer; import android.text.GraphicsOperations; import android.text.SpannableString; @@ -163,7 +164,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, int surface); + static native void nUpdateTextureLayer(int layerId, int width, int height, SurfaceTexture surface); static native void nDestroyLayer(int layerId); static native void nDestroyLayerDeferred(int layerId); static native boolean nCopyLayer(int layerId, int bitmap); diff --git a/core/java/android/view/GLES20TextureLayer.java b/core/java/android/view/GLES20TextureLayer.java index fcf421b..063eee7 100644 --- a/core/java/android/view/GLES20TextureLayer.java +++ b/core/java/android/view/GLES20TextureLayer.java @@ -70,7 +70,7 @@ class GLES20TextureLayer extends GLES20Layer { return mSurface; } - void update(int width, int height, int surface) { - GLES20Canvas.nUpdateTextureLayer(mLayer, width, height, surface); + void update(int width, int height) { + GLES20Canvas.nUpdateTextureLayer(mLayer, width, height, mSurface); } } diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java index 5944bd4..5ceb12a 100644 --- a/core/java/android/view/HardwareRenderer.java +++ b/core/java/android/view/HardwareRenderer.java @@ -194,7 +194,7 @@ public abstract class HardwareRenderer { * * @return A {@link SurfaceTexture} */ - abstract SurfaceTexture createSuraceTexture(HardwareLayer layer); + abstract SurfaceTexture createSurfaceTexture(HardwareLayer layer); /** * Updates the specified layer. @@ -202,10 +202,8 @@ public abstract class HardwareRenderer { * @param layer The hardware layer to update * @param width The layer's width * @param height The layer's height - * @param surface The surface to update */ - abstract void updateTextureLayer(HardwareLayer layer, int width, int height, - SurfaceTexture surface); + abstract void updateTextureLayer(HardwareLayer layer, int width, int height); /** * Copies the content of the specified layer into the specified bitmap. @@ -815,14 +813,13 @@ public abstract class HardwareRenderer { } @Override - SurfaceTexture createSuraceTexture(HardwareLayer layer) { + SurfaceTexture createSurfaceTexture(HardwareLayer layer) { return ((GLES20TextureLayer) layer).getSurfaceTexture(); } @Override - void updateTextureLayer(HardwareLayer layer, int width, int height, - SurfaceTexture surface) { - ((GLES20TextureLayer) layer).update(width, height, surface.mSurfaceTexture); + void updateTextureLayer(HardwareLayer layer, int width, int height) { + ((GLES20TextureLayer) layer).update(width, height); } @Override diff --git a/core/java/android/view/TextureView.java b/core/java/android/view/TextureView.java index 4daa892..164c657 100644 --- a/core/java/android/view/TextureView.java +++ b/core/java/android/view/TextureView.java @@ -232,7 +232,7 @@ public class TextureView extends View { 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()); + nSetDefaultBufferSize(mSurface, getWidth(), getHeight()); if (mListener != null) { mListener.onSurfaceTextureSizeChanged(mSurface, getWidth(), getHeight()); } @@ -247,8 +247,8 @@ public class TextureView extends View { if (mLayer == null) { mLayer = mAttachInfo.mHardwareRenderer.createHardwareLayer(); - mSurface = mAttachInfo.mHardwareRenderer.createSuraceTexture(mLayer); - nSetDefaultBufferSize(mSurface.mSurfaceTexture, getWidth(), getHeight()); + mSurface = mAttachInfo.mHardwareRenderer.createSurfaceTexture(mLayer); + nSetDefaultBufferSize(mSurface, getWidth(), getHeight()); mUpdateListener = new SurfaceTexture.OnFrameAvailableListener() { @Override @@ -290,7 +290,7 @@ public class TextureView extends View { return; } - mAttachInfo.mHardwareRenderer.updateTextureLayer(mLayer, getWidth(), getHeight(), mSurface); + mAttachInfo.mHardwareRenderer.updateTextureLayer(mLayer, getWidth(), getHeight()); invalidate(); } @@ -447,5 +447,5 @@ public class TextureView extends View { public void onSurfaceTextureDestroyed(SurfaceTexture surface); } - private static native void nSetDefaultBufferSize(int surfaceTexture, int width, int height); + private static native void nSetDefaultBufferSize(SurfaceTexture surfaceTexture, int width, int height); } diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp index 7e82efb..84ad012 100644 --- a/core/jni/android_view_GLES20Canvas.cpp +++ b/core/jni/android_view_GLES20Canvas.cpp @@ -22,6 +22,7 @@ #include "GraphicsJNI.h" #include <nativehelper/JNIHelp.h> #include <android_runtime/AndroidRuntime.h> +#include <android_runtime/android_graphics_SurfaceTexture.h> #include <utils/ResourceTypes.h> #include <gui/SurfaceTexture.h> @@ -644,11 +645,13 @@ static void android_view_GLES20Canvas_resizeLayer(JNIEnv* env, jobject clazz, } static void android_view_GLES20Canvas_updateTextureLayer(JNIEnv* env, jobject clazz, - Layer* layer, jint width, jint height, SurfaceTexture* surface) { + Layer* layer, jint width, jint height, jobject surface) { float transform[16]; - surface->updateTexImage(); - surface->getTransformMatrix(transform); - GLenum renderTarget = surface->getCurrentTextureTarget(); + sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, surface)); + + surfaceTexture->updateTexImage(); + surfaceTexture->getTransformMatrix(transform); + GLenum renderTarget = surfaceTexture->getCurrentTextureTarget(); LayerRenderer::updateTextureLayer(layer, width, height, renderTarget, transform); } @@ -793,7 +796,8 @@ static JNINativeMethod gMethods[] = { { "nCreateLayer", "(IIZ[I)I", (void*) android_view_GLES20Canvas_createLayer }, { "nResizeLayer", "(III[I)V" , (void*) android_view_GLES20Canvas_resizeLayer }, { "nCreateTextureLayer", "([I)I", (void*) android_view_GLES20Canvas_createTextureLayer }, - { "nUpdateTextureLayer", "(IIII)V", (void*) android_view_GLES20Canvas_updateTextureLayer }, + { "nUpdateTextureLayer", "(IIILjava/lang/String;)V", + (void*) android_view_GLES20Canvas_updateTextureLayer }, { "nDestroyLayer", "(I)V", (void*) android_view_GLES20Canvas_destroyLayer }, { "nDestroyLayerDeferred", "(I)V", (void*) android_view_GLES20Canvas_destroyLayerDeferred }, { "nDrawLayer", "(IIFFI)V", (void*) android_view_GLES20Canvas_drawLayer }, diff --git a/core/jni/com_google_android_gles_jni_EGLImpl.cpp b/core/jni/com_google_android_gles_jni_EGLImpl.cpp index f777527..7a0668e 100644 --- a/core/jni/com_google_android_gles_jni_EGLImpl.cpp +++ b/core/jni/com_google_android_gles_jni_EGLImpl.cpp @@ -18,6 +18,7 @@ #include "JNIHelp.h" #include <android_runtime/AndroidRuntime.h> #include <android_runtime/android_view_Surface.h> +#include <android_runtime/android_graphics_SurfaceTexture.h> #include <utils/misc.h> #include <EGL/egl.h> @@ -323,7 +324,7 @@ not_valid_surface: } static jint jni_eglCreateWindowSurfaceTexture(JNIEnv *_env, jobject _this, jobject display, - jobject config, jint native_window, jintArray attrib_list) { + jobject config, jobject native_window, jintArray attrib_list) { if (display == NULL || config == NULL || !validAttribList(_env, attrib_list)) { jniThrowException(_env, "java/lang/IllegalArgumentException", NULL); @@ -339,7 +340,7 @@ not_valid_surface: return 0; } - sp<SurfaceTexture> surfaceTexture = reinterpret_cast<SurfaceTexture*>(native_window); + sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(_env, native_window)); window = new SurfaceTextureClient(surfaceTexture); if (window == NULL) diff --git a/graphics/java/android/graphics/SurfaceTexture.java b/graphics/java/android/graphics/SurfaceTexture.java index 0ffd201..6c7341f 100644 --- a/graphics/java/android/graphics/SurfaceTexture.java +++ b/graphics/java/android/graphics/SurfaceTexture.java @@ -66,11 +66,8 @@ public class SurfaceTexture { /** * This field is used by native code, do not access or modify. - * - * @hide */ - @SuppressWarnings({"UnusedDeclaration"}) - public int mSurfaceTexture; + private int mSurfaceTexture; /** * Callback interface for being notified that a new stream frame is available. diff --git a/opengl/java/com/google/android/gles_jni/EGLImpl.java b/opengl/java/com/google/android/gles_jni/EGLImpl.java index f162d40..51d6ca8 100644 --- a/opengl/java/com/google/android/gles_jni/EGLImpl.java +++ b/opengl/java/com/google/android/gles_jni/EGLImpl.java @@ -85,7 +85,7 @@ public class EGLImpl implements EGL10 { eglSurfaceId = _eglCreateWindowSurface(display, config, sur, attrib_list); } else if (native_window instanceof SurfaceTexture) { eglSurfaceId = _eglCreateWindowSurfaceTexture(display, config, - ((SurfaceTexture) native_window).mSurfaceTexture, attrib_list); + (SurfaceTexture) native_window, attrib_list); } else { throw new java.lang.UnsupportedOperationException( "eglCreateWindowSurface() can only be called with an instance of " + @@ -143,7 +143,7 @@ public class EGLImpl implements EGL10 { private native int _eglCreatePbufferSurface(EGLDisplay display, EGLConfig config, int[] attrib_list); private native void _eglCreatePixmapSurface(EGLSurface sur, EGLDisplay display, EGLConfig config, Object native_pixmap, int[] attrib_list); private native int _eglCreateWindowSurface(EGLDisplay display, EGLConfig config, Object native_window, int[] attrib_list); - private native int _eglCreateWindowSurfaceTexture(EGLDisplay display, EGLConfig config, int native_window, int[] attrib_list); + private native int _eglCreateWindowSurfaceTexture(EGLDisplay display, EGLConfig config, Object native_window, int[] attrib_list); private native int _eglGetDisplay(Object native_display); private native int _eglGetCurrentContext(); private native int _eglGetCurrentDisplay(); |