| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/gl/android/surface_texture.h" | 5 #include "ui/gl/android/surface_texture.h" |
| 6 | 6 |
| 7 #include <android/native_window_jni.h> | 7 #include <android/native_window_jni.h> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 } | 40 } |
| 41 | 41 |
| 42 void SurfaceTexture::SetFrameAvailableCallbackOnAnyThread( | 42 void SurfaceTexture::SetFrameAvailableCallbackOnAnyThread( |
| 43 const base::Closure& callback) { | 43 const base::Closure& callback) { |
| 44 JNIEnv* env = base::android::AttachCurrentThread(); | 44 JNIEnv* env = base::android::AttachCurrentThread(); |
| 45 Java_SurfaceTexturePlatformWrapper_setFrameAvailableCallback( | 45 Java_SurfaceTexturePlatformWrapper_setFrameAvailableCallback( |
| 46 env, j_surface_texture_.obj(), | 46 env, j_surface_texture_.obj(), |
| 47 reinterpret_cast<intptr_t>(new SurfaceTextureListener(callback, true))); | 47 reinterpret_cast<intptr_t>(new SurfaceTextureListener(callback, true))); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void SurfaceTexture::SetFrameAvailableCallbackOnSeparateThread( |
| 51 const base::Closure& callback) { |
| 52 JNIEnv* env = base::android::AttachCurrentThread(); |
| 53 Java_SurfaceTexturePlatformWrapper_setFrameAvailableCallbackOnSeparateThread( |
| 54 env, j_surface_texture_.obj(), |
| 55 reinterpret_cast<intptr_t>(new SurfaceTextureListener(callback, true))); |
| 56 } |
| 57 |
| 50 void SurfaceTexture::UpdateTexImage() { | 58 void SurfaceTexture::UpdateTexImage() { |
| 51 JNIEnv* env = base::android::AttachCurrentThread(); | 59 JNIEnv* env = base::android::AttachCurrentThread(); |
| 52 Java_SurfaceTexturePlatformWrapper_updateTexImage(env, | 60 Java_SurfaceTexturePlatformWrapper_updateTexImage(env, |
| 53 j_surface_texture_.obj()); | 61 j_surface_texture_.obj()); |
| 54 } | 62 } |
| 55 | 63 |
| 56 void SurfaceTexture::GetTransformMatrix(float mtx[16]) { | 64 void SurfaceTexture::GetTransformMatrix(float mtx[16]) { |
| 57 JNIEnv* env = base::android::AttachCurrentThread(); | 65 JNIEnv* env = base::android::AttachCurrentThread(); |
| 58 | 66 |
| 59 base::android::ScopedJavaLocalRef<jfloatArray> jmatrix( | 67 base::android::ScopedJavaLocalRef<jfloatArray> jmatrix( |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 ANativeWindow* native_window = ANativeWindow_fromSurface( | 102 ANativeWindow* native_window = ANativeWindow_fromSurface( |
| 95 env, surface.j_surface().obj()); | 103 env, surface.j_surface().obj()); |
| 96 return native_window; | 104 return native_window; |
| 97 } | 105 } |
| 98 | 106 |
| 99 bool SurfaceTexture::RegisterSurfaceTexture(JNIEnv* env) { | 107 bool SurfaceTexture::RegisterSurfaceTexture(JNIEnv* env) { |
| 100 return RegisterNativesImpl(env); | 108 return RegisterNativesImpl(env); |
| 101 } | 109 } |
| 102 | 110 |
| 103 } // namespace gfx | 111 } // namespace gfx |
| OLD | NEW |