Chromium Code Reviews| Index: ui/android/java/src/org/chromium/ui/gfx/SurfaceTextureBridge.java |
| diff --git a/ui/android/java/src/org/chromium/ui/gfx/SurfaceTextureBridge.java b/ui/android/java/src/org/chromium/ui/gfx/SurfaceTextureBridge.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..44c9e13d3b708763713bf0bd42f2ce16f74fd92e |
| --- /dev/null |
| +++ b/ui/android/java/src/org/chromium/ui/gfx/SurfaceTextureBridge.java |
| @@ -0,0 +1,62 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +package org.chromium.ui.gfx; |
| + |
| +import android.graphics.SurfaceTexture; |
| + |
| +import org.chromium.base.CalledByNative; |
| +import org.chromium.base.JNINamespace; |
| + |
| +/** |
| + * Bridge class for interacting with SurfaceTexture object from C++ code. |
| + */ |
| +@JNINamespace("gfx") |
| +class SurfaceTextureBridge { |
|
bulach
2013/08/22 09:25:40
iirc we had this "bridge" before, but ended up rem
|
| + @CalledByNative |
| + private static SurfaceTexture create(int textureId) { |
| + return new SurfaceTexture(textureId); |
| + } |
| + |
| + @CalledByNative |
| + private static void destroy(SurfaceTexture surfaceTexture) { |
| + surfaceTexture.setOnFrameAvailableListener(null); |
| + surfaceTexture.release(); |
| + } |
| + |
| + @CalledByNative |
| + private static void setFrameAvailableCallback(SurfaceTexture surfaceTexture, |
| + int nativeSurfaceTextureListener) { |
| + surfaceTexture.setOnFrameAvailableListener( |
| + new SurfaceTextureListener(nativeSurfaceTextureListener)); |
| + } |
| + |
| + @CalledByNative |
| + private static void updateTexImage(SurfaceTexture surfaceTexture) { |
| + surfaceTexture.updateTexImage(); |
| + } |
| + |
| + @CalledByNative |
| + private static void setDefaultBufferSize(SurfaceTexture surfaceTexture, int width, |
| + int height) { |
| + surfaceTexture.setDefaultBufferSize(width, height); |
| + } |
| + |
| + @CalledByNative |
| + private static void getTransformMatrix(SurfaceTexture surfaceTexture, float[] matrix) { |
| + surfaceTexture.getTransformMatrix(matrix); |
| + } |
| + |
| + @CalledByNative |
| + private static void attachToGLContext(SurfaceTexture surfaceTexture, int texName) { |
| + // NOTE: must only be called on API_LEVEL 16 and greater |
|
bulach
2013/08/22 09:25:40
we do remove java asserts on release builds, no? s
|
| + surfaceTexture.attachToGLContext(texName); |
| + } |
| + |
| + @CalledByNative |
| + private static void detachFromGLContext(SurfaceTexture surfaceTexture) { |
| + // NOTE: must only be called on API_LEVEL 16 and greater |
| + surfaceTexture.detachFromGLContext(); |
| + } |
| +} |