| Index: ui/gl/android/surface_texture.cc
|
| diff --git a/ui/gl/android/surface_texture.cc b/ui/gl/android/surface_texture.cc
|
| index 232705d6fab026478029d1b647ed10b49a0ccc5e..4a48452f77cc74c7a06a032762b956b005cee435 100644
|
| --- a/ui/gl/android/surface_texture.cc
|
| +++ b/ui/gl/android/surface_texture.cc
|
| @@ -6,6 +6,7 @@
|
|
|
| #include <android/native_window_jni.h>
|
|
|
| +#include "base/android/build_info.h"
|
| #include "base/android/jni_android.h"
|
| #include "base/logging.h"
|
| #include "jni/SurfaceTexturePlatformWrapper_jni.h"
|
| @@ -21,6 +22,14 @@ scoped_refptr<SurfaceTexture> SurfaceTexture::Create(int texture_id) {
|
| Java_SurfaceTexturePlatformWrapper_create(env, texture_id));
|
| }
|
|
|
| +scoped_refptr<SurfaceTexture> SurfaceTexture::CreateSingleBuffered(
|
| + int texture_id) {
|
| + DCHECK(IsSingleBufferModeSupported());
|
| + JNIEnv* env = base::android::AttachCurrentThread();
|
| + return new SurfaceTexture(
|
| + Java_SurfaceTexturePlatformWrapper_createSingleBuffered(env, texture_id));
|
| +}
|
| +
|
| SurfaceTexture::SurfaceTexture(
|
| const base::android::ScopedJavaLocalRef<jobject>& j_surface_texture) {
|
| j_surface_texture_.Reset(j_surface_texture);
|
| @@ -46,6 +55,13 @@ void SurfaceTexture::UpdateTexImage() {
|
| j_surface_texture_.obj());
|
| }
|
|
|
| +void SurfaceTexture::ReleaseTexImage() {
|
| + DCHECK(IsSingleBufferModeSupported());
|
| + JNIEnv* env = base::android::AttachCurrentThread();
|
| + Java_SurfaceTexturePlatformWrapper_releaseTexImage(env,
|
| + j_surface_texture_.obj());
|
| +}
|
| +
|
| void SurfaceTexture::GetTransformMatrix(float mtx[16]) {
|
| JNIEnv* env = base::android::AttachCurrentThread();
|
|
|
| @@ -89,6 +105,11 @@ ANativeWindow* SurfaceTexture::CreateSurface() {
|
| return native_window;
|
| }
|
|
|
| +// static
|
| +bool SurfaceTexture::IsSingleBufferModeSupported() {
|
| + return base::android::BuildInfo::GetInstance()->sdk_int() >= 19;
|
| +}
|
| +
|
| bool SurfaceTexture::RegisterSurfaceTexture(JNIEnv* env) {
|
| return RegisterNativesImpl(env);
|
| }
|
|
|