diff options
Diffstat (limited to 'native')
-rw-r--r-- | native/android/surface_texture.cpp | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/native/android/surface_texture.cpp b/native/android/surface_texture.cpp index ced2792775d4..3049ec16e2d4 100644 --- a/native/android/surface_texture.cpp +++ b/native/android/surface_texture.cpp @@ -23,25 +23,19 @@ #include <gui/Surface.h> -#include <android_runtime/android_graphics_SurfaceTexture.h> +#include <gui/surfacetexture/surface_texture_platform.h> -#include "surfacetexture/SurfaceTexture.h" +#include <android_runtime/android_graphics_SurfaceTexture.h> using namespace android; -struct ASurfaceTexture { - sp<SurfaceTexture> consumer; - sp<IGraphicBufferProducer> producer; -}; - ASurfaceTexture* ASurfaceTexture_fromSurfaceTexture(JNIEnv* env, jobject surfacetexture) { if (!surfacetexture || !android_SurfaceTexture_isInstanceOf(env, surfacetexture)) { return nullptr; } - ASurfaceTexture* ast = new ASurfaceTexture; - ast->consumer = SurfaceTexture_getSurfaceTexture(env, surfacetexture); - ast->producer = SurfaceTexture_getProducer(env, surfacetexture); - return ast; + auto consumer = SurfaceTexture_getSurfaceTexture(env, surfacetexture); + auto producer = SurfaceTexture_getProducer(env, surfacetexture); + return ASurfaceTexture_create(consumer, producer); } ANativeWindow* ASurfaceTexture_acquireANativeWindow(ASurfaceTexture* st) { |