Rename HardwareBufferExternalTexture* to ImageExternalTexture* (flutter/engine#46786)
Image is the more accurate name and we will eventually have a HardwareBufferExternalTexture in the future (see https://developer.android.com/reference/android/graphics/HardwareBufferRenderer available on Android >= 34).
This commit is contained in:
@@ -3007,10 +3007,12 @@ ORIGIN: ../../../flutter/shell/platform/android/external_view_embedder/surface_p
|
||||
ORIGIN: ../../../flutter/shell/platform/android/external_view_embedder/surface_pool.h + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/shell/platform/android/flutter_main.cc + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/shell/platform/android/flutter_main.h + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/shell/platform/android/hardware_buffer_external_texture.h + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/shell/platform/android/hardware_buffer_external_texture_gl.cc + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/shell/platform/android/hardware_buffer_external_texture_gl.h + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/shell/platform/android/hardware_buffer_external_texture_vk.h + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/shell/platform/android/image_external_texture.h + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/shell/platform/android/image_external_texture.cc + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/shell/platform/android/image_external_texture_gl.cc + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/shell/platform/android/image_external_texture_gl.h + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/shell/platform/android/image_external_texture_vk.h + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/shell/platform/android/image_external_texture_vk.cc + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/FlutterInjector.java + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/Log.java + ../../../flutter/LICENSE
|
||||
ORIGIN: ../../../flutter/shell/platform/android/io/flutter/app/FlutterActivity.java + ../../../flutter/LICENSE
|
||||
|
||||
@@ -96,12 +96,12 @@ source_set("flutter_shell_native_src") {
|
||||
"apk_asset_provider.h",
|
||||
"flutter_main.cc",
|
||||
"flutter_main.h",
|
||||
"hardware_buffer_external_texture.cc",
|
||||
"hardware_buffer_external_texture.h",
|
||||
"hardware_buffer_external_texture_gl.cc",
|
||||
"hardware_buffer_external_texture_gl.h",
|
||||
"hardware_buffer_external_texture_vk.cc",
|
||||
"hardware_buffer_external_texture_vk.h",
|
||||
"image_external_texture.cc",
|
||||
"image_external_texture.h",
|
||||
"image_external_texture_gl.cc",
|
||||
"image_external_texture_gl.h",
|
||||
"image_external_texture_vk.cc",
|
||||
"image_external_texture_vk.h",
|
||||
"library_loader.cc",
|
||||
"ndk_helpers.cc",
|
||||
"ndk_helpers.h",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
#include "flutter/shell/platform/android/hardware_buffer_external_texture.h"
|
||||
#include "flutter/shell/platform/android/image_external_texture.h"
|
||||
|
||||
#include <android/hardware_buffer_jni.h>
|
||||
#include <android/sensor.h>
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace flutter {
|
||||
|
||||
HardwareBufferExternalTexture::HardwareBufferExternalTexture(
|
||||
ImageExternalTexture::ImageExternalTexture(
|
||||
int64_t id,
|
||||
const fml::jni::ScopedJavaGlobalRef<jobject>& image_texture_entry,
|
||||
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade)
|
||||
@@ -18,10 +18,10 @@ HardwareBufferExternalTexture::HardwareBufferExternalTexture(
|
||||
jni_facade_(jni_facade) {}
|
||||
|
||||
// Implementing flutter::Texture.
|
||||
void HardwareBufferExternalTexture::Paint(PaintContext& context,
|
||||
const SkRect& bounds,
|
||||
bool freeze,
|
||||
const DlImageSampling sampling) {
|
||||
void ImageExternalTexture::Paint(PaintContext& context,
|
||||
const SkRect& bounds,
|
||||
bool freeze,
|
||||
const DlImageSampling sampling) {
|
||||
if (state_ == AttachmentState::kDetached) {
|
||||
return;
|
||||
}
|
||||
@@ -42,26 +42,25 @@ void HardwareBufferExternalTexture::Paint(PaintContext& context,
|
||||
flutter::DlCanvas::SrcRectConstraint::kStrict // enforce edges
|
||||
);
|
||||
} else {
|
||||
FML_LOG(ERROR)
|
||||
<< "No DlImage available for HardwareBufferExternalTexture to paint.";
|
||||
FML_LOG(ERROR) << "No DlImage available for ImageExternalTexture to paint.";
|
||||
}
|
||||
}
|
||||
|
||||
// Implementing flutter::Texture.
|
||||
void HardwareBufferExternalTexture::MarkNewFrameAvailable() {
|
||||
void ImageExternalTexture::MarkNewFrameAvailable() {
|
||||
new_frame_ready_ = true;
|
||||
}
|
||||
|
||||
// Implementing flutter::Texture.
|
||||
void HardwareBufferExternalTexture::OnTextureUnregistered() {}
|
||||
void ImageExternalTexture::OnTextureUnregistered() {}
|
||||
|
||||
// Implementing flutter::ContextListener.
|
||||
void HardwareBufferExternalTexture::OnGrContextCreated() {
|
||||
void ImageExternalTexture::OnGrContextCreated() {
|
||||
state_ = AttachmentState::kUninitialized;
|
||||
}
|
||||
|
||||
// Implementing flutter::ContextListener.
|
||||
void HardwareBufferExternalTexture::OnGrContextDestroyed() {
|
||||
void ImageExternalTexture::OnGrContextDestroyed() {
|
||||
if (state_ == AttachmentState::kAttached) {
|
||||
dl_image_.reset();
|
||||
Detach();
|
||||
@@ -69,7 +68,7 @@ void HardwareBufferExternalTexture::OnGrContextDestroyed() {
|
||||
state_ = AttachmentState::kDetached;
|
||||
}
|
||||
|
||||
JavaLocalRef HardwareBufferExternalTexture::AcquireLatestImage() {
|
||||
JavaLocalRef ImageExternalTexture::AcquireLatestImage() {
|
||||
JNIEnv* env = fml::jni::AttachCurrentThread();
|
||||
FML_CHECK(env != nullptr);
|
||||
|
||||
@@ -79,15 +78,14 @@ JavaLocalRef HardwareBufferExternalTexture::AcquireLatestImage() {
|
||||
return image_java;
|
||||
}
|
||||
|
||||
void HardwareBufferExternalTexture::CloseImage(
|
||||
const fml::jni::JavaRef<jobject>& image) {
|
||||
void ImageExternalTexture::CloseImage(const fml::jni::JavaRef<jobject>& image) {
|
||||
if (image.obj() == nullptr) {
|
||||
return;
|
||||
}
|
||||
jni_facade_->ImageClose(JavaLocalRef(image));
|
||||
}
|
||||
|
||||
void HardwareBufferExternalTexture::CloseHardwareBuffer(
|
||||
void ImageExternalTexture::CloseHardwareBuffer(
|
||||
const fml::jni::JavaRef<jobject>& hardware_buffer) {
|
||||
if (hardware_buffer.obj() == nullptr) {
|
||||
return;
|
||||
@@ -95,7 +93,7 @@ void HardwareBufferExternalTexture::CloseHardwareBuffer(
|
||||
jni_facade_->HardwareBufferClose(JavaLocalRef(hardware_buffer));
|
||||
}
|
||||
|
||||
JavaLocalRef HardwareBufferExternalTexture::HardwareBufferFor(
|
||||
JavaLocalRef ImageExternalTexture::HardwareBufferFor(
|
||||
const fml::jni::JavaRef<jobject>& image) {
|
||||
if (image.obj() == nullptr) {
|
||||
return JavaLocalRef();
|
||||
@@ -104,7 +102,7 @@ JavaLocalRef HardwareBufferExternalTexture::HardwareBufferFor(
|
||||
return jni_facade_->ImageGetHardwareBuffer(JavaLocalRef(image));
|
||||
}
|
||||
|
||||
AHardwareBuffer* HardwareBufferExternalTexture::AHardwareBufferFor(
|
||||
AHardwareBuffer* ImageExternalTexture::AHardwareBufferFor(
|
||||
const fml::jni::JavaRef<jobject>& hardware_buffer) {
|
||||
JNIEnv* env = fml::jni::AttachCurrentThread();
|
||||
FML_CHECK(env != nullptr);
|
||||
@@ -2,8 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef FLUTTER_SHELL_PLATFORM_ANDROID_HARDWARE_BUFFER_EXTERNAL_TEXTURE_H_
|
||||
#define FLUTTER_SHELL_PLATFORM_ANDROID_HARDWARE_BUFFER_EXTERNAL_TEXTURE_H_
|
||||
#ifndef FLUTTER_SHELL_PLATFORM_ANDROID_IMAGE_EXTERNAL_TEXTURE_H_
|
||||
#define FLUTTER_SHELL_PLATFORM_ANDROID_IMAGE_EXTERNAL_TEXTURE_H_
|
||||
|
||||
#include "flutter/common/graphics/texture.h"
|
||||
#include "flutter/fml/logging.h"
|
||||
@@ -17,14 +17,14 @@ namespace flutter {
|
||||
|
||||
// External texture peered to a sequence of android.hardware.HardwareBuffers.
|
||||
//
|
||||
class HardwareBufferExternalTexture : public flutter::Texture {
|
||||
class ImageExternalTexture : public flutter::Texture {
|
||||
public:
|
||||
explicit HardwareBufferExternalTexture(
|
||||
explicit ImageExternalTexture(
|
||||
int64_t id,
|
||||
const fml::jni::ScopedJavaGlobalRef<jobject>& image_texture_entry,
|
||||
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade);
|
||||
|
||||
virtual ~HardwareBufferExternalTexture() = default;
|
||||
virtual ~ImageExternalTexture() = default;
|
||||
|
||||
// |flutter::Texture|.
|
||||
void Paint(PaintContext& context,
|
||||
@@ -65,9 +65,9 @@ class HardwareBufferExternalTexture : public flutter::Texture {
|
||||
|
||||
sk_sp<flutter::DlImage> dl_image_;
|
||||
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(HardwareBufferExternalTexture);
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(ImageExternalTexture);
|
||||
};
|
||||
|
||||
} // namespace flutter
|
||||
|
||||
#endif // FLUTTER_SHELL_PLATFORM_ANDROID_HARDWARE_BUFFER_EXTERNAL_TEXTURE_H_
|
||||
#endif // FLUTTER_SHELL_PLATFORM_ANDROID_IMAGE_EXTERNAL_TEXTURE_H_
|
||||
@@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "flutter/shell/platform/android/hardware_buffer_external_texture_gl.h"
|
||||
#include "flutter/shell/platform/android/image_external_texture_gl.h"
|
||||
|
||||
#include <android/hardware_buffer_jni.h>
|
||||
#include <android/sensor.h>
|
||||
@@ -28,13 +28,13 @@
|
||||
|
||||
namespace flutter {
|
||||
|
||||
HardwareBufferExternalTextureGL::HardwareBufferExternalTextureGL(
|
||||
ImageExternalTextureGL::ImageExternalTextureGL(
|
||||
int64_t id,
|
||||
const fml::jni::ScopedJavaGlobalRef<jobject>& image_texture_entry,
|
||||
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade)
|
||||
: HardwareBufferExternalTexture(id, image_texture_entry, jni_facade) {}
|
||||
: ImageExternalTexture(id, image_texture_entry, jni_facade) {}
|
||||
|
||||
void HardwareBufferExternalTextureGL::Attach(PaintContext& context) {
|
||||
void ImageExternalTextureGL::Attach(PaintContext& context) {
|
||||
if (state_ == AttachmentState::kUninitialized) {
|
||||
if (!android_image_.is_null()) {
|
||||
JavaLocalRef hardware_buffer = HardwareBufferFor(android_image_);
|
||||
@@ -47,11 +47,11 @@ void HardwareBufferExternalTextureGL::Attach(PaintContext& context) {
|
||||
}
|
||||
}
|
||||
|
||||
void HardwareBufferExternalTextureGL::Detach() {
|
||||
void ImageExternalTextureGL::Detach() {
|
||||
egl_image_.reset();
|
||||
}
|
||||
|
||||
bool HardwareBufferExternalTextureGL::MaybeSwapImages() {
|
||||
bool ImageExternalTextureGL::MaybeSwapImages() {
|
||||
JavaLocalRef image = AcquireLatestImage();
|
||||
if (image.is_null()) {
|
||||
return false;
|
||||
@@ -72,7 +72,7 @@ bool HardwareBufferExternalTextureGL::MaybeSwapImages() {
|
||||
return true;
|
||||
}
|
||||
|
||||
impeller::UniqueEGLImageKHR HardwareBufferExternalTextureGL::CreateEGLImage(
|
||||
impeller::UniqueEGLImageKHR ImageExternalTextureGL::CreateEGLImage(
|
||||
AHardwareBuffer* hardware_buffer) {
|
||||
if (hardware_buffer == nullptr) {
|
||||
return impeller::UniqueEGLImageKHR();
|
||||
@@ -98,31 +98,31 @@ impeller::UniqueEGLImageKHR HardwareBufferExternalTextureGL::CreateEGLImage(
|
||||
return impeller::UniqueEGLImageKHR(maybe_image);
|
||||
}
|
||||
|
||||
HardwareBufferExternalTextureGLSkia::HardwareBufferExternalTextureGLSkia(
|
||||
ImageExternalTextureGLSkia::ImageExternalTextureGLSkia(
|
||||
const std::shared_ptr<AndroidContextGLSkia>& context,
|
||||
int64_t id,
|
||||
const fml::jni::ScopedJavaGlobalRef<jobject>& image_texture_entry,
|
||||
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade)
|
||||
: HardwareBufferExternalTextureGL(id, image_texture_entry, jni_facade) {}
|
||||
: ImageExternalTextureGL(id, image_texture_entry, jni_facade) {}
|
||||
|
||||
void HardwareBufferExternalTextureGLSkia::Attach(PaintContext& context) {
|
||||
void ImageExternalTextureGLSkia::Attach(PaintContext& context) {
|
||||
if (state_ == AttachmentState::kUninitialized) {
|
||||
// After this call state_ will be AttachmentState::kAttached and egl_image_
|
||||
// will have been created if we still have an Image associated with us.
|
||||
HardwareBufferExternalTextureGL::Attach(context);
|
||||
ImageExternalTextureGL::Attach(context);
|
||||
GLuint texture_name;
|
||||
glGenTextures(1, &texture_name);
|
||||
texture_.reset(impeller::GLTexture{texture_name});
|
||||
}
|
||||
}
|
||||
|
||||
void HardwareBufferExternalTextureGLSkia::Detach() {
|
||||
HardwareBufferExternalTextureGL::Detach();
|
||||
void ImageExternalTextureGLSkia::Detach() {
|
||||
ImageExternalTextureGL::Detach();
|
||||
texture_.reset();
|
||||
}
|
||||
|
||||
void HardwareBufferExternalTextureGLSkia::ProcessFrame(PaintContext& context,
|
||||
const SkRect& bounds) {
|
||||
void ImageExternalTextureGLSkia::ProcessFrame(PaintContext& context,
|
||||
const SkRect& bounds) {
|
||||
const bool swapped = MaybeSwapImages();
|
||||
if (!swapped && !egl_image_.is_valid()) {
|
||||
// Nothing to do.
|
||||
@@ -132,7 +132,7 @@ void HardwareBufferExternalTextureGLSkia::ProcessFrame(PaintContext& context,
|
||||
dl_image_ = CreateDlImage(context, bounds);
|
||||
}
|
||||
|
||||
void HardwareBufferExternalTextureGLSkia::BindImageToTexture(
|
||||
void ImageExternalTextureGLSkia::BindImageToTexture(
|
||||
const impeller::UniqueEGLImageKHR& image,
|
||||
GLuint tex) {
|
||||
if (!image.is_valid() || tex == 0) {
|
||||
@@ -143,7 +143,7 @@ void HardwareBufferExternalTextureGLSkia::BindImageToTexture(
|
||||
(GLeglImageOES)image.get().image);
|
||||
}
|
||||
|
||||
sk_sp<flutter::DlImage> HardwareBufferExternalTextureGLSkia::CreateDlImage(
|
||||
sk_sp<flutter::DlImage> ImageExternalTextureGLSkia::CreateDlImage(
|
||||
PaintContext& context,
|
||||
const SkRect& bounds) {
|
||||
GrGLTextureInfo textureInfo = {GL_TEXTURE_EXTERNAL_OES,
|
||||
@@ -155,26 +155,24 @@ sk_sp<flutter::DlImage> HardwareBufferExternalTextureGLSkia::CreateDlImage(
|
||||
kRGBA_8888_SkColorType, kPremul_SkAlphaType, nullptr));
|
||||
}
|
||||
|
||||
HardwareBufferExternalTextureGLImpeller::
|
||||
HardwareBufferExternalTextureGLImpeller(
|
||||
const std::shared_ptr<impeller::ContextGLES>& context,
|
||||
int64_t id,
|
||||
const fml::jni::ScopedJavaGlobalRef<jobject>& image_textury_entry,
|
||||
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade)
|
||||
: HardwareBufferExternalTextureGL(id, image_textury_entry, jni_facade),
|
||||
ImageExternalTextureGLImpeller::ImageExternalTextureGLImpeller(
|
||||
const std::shared_ptr<impeller::ContextGLES>& context,
|
||||
int64_t id,
|
||||
const fml::jni::ScopedJavaGlobalRef<jobject>& image_textury_entry,
|
||||
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade)
|
||||
: ImageExternalTextureGL(id, image_textury_entry, jni_facade),
|
||||
impeller_context_(context) {}
|
||||
|
||||
void HardwareBufferExternalTextureGLImpeller::Detach() {}
|
||||
void ImageExternalTextureGLImpeller::Detach() {}
|
||||
|
||||
void HardwareBufferExternalTextureGLImpeller::Attach(PaintContext& context) {
|
||||
void ImageExternalTextureGLImpeller::Attach(PaintContext& context) {
|
||||
if (state_ == AttachmentState::kUninitialized) {
|
||||
HardwareBufferExternalTextureGL::Attach(context);
|
||||
ImageExternalTextureGL::Attach(context);
|
||||
}
|
||||
}
|
||||
|
||||
void HardwareBufferExternalTextureGLImpeller::ProcessFrame(
|
||||
PaintContext& context,
|
||||
const SkRect& bounds) {
|
||||
void ImageExternalTextureGLImpeller::ProcessFrame(PaintContext& context,
|
||||
const SkRect& bounds) {
|
||||
const bool swapped = MaybeSwapImages();
|
||||
if (!swapped && !egl_image_.is_valid()) {
|
||||
// Nothing to do.
|
||||
@@ -183,7 +181,7 @@ void HardwareBufferExternalTextureGLImpeller::ProcessFrame(
|
||||
dl_image_ = CreateDlImage(context, bounds);
|
||||
}
|
||||
|
||||
sk_sp<flutter::DlImage> HardwareBufferExternalTextureGLImpeller::CreateDlImage(
|
||||
sk_sp<flutter::DlImage> ImageExternalTextureGLImpeller::CreateDlImage(
|
||||
PaintContext& context,
|
||||
const SkRect& bounds) {
|
||||
impeller::TextureDescriptor desc;
|
||||
@@ -2,11 +2,11 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef FLUTTER_SHELL_PLATFORM_ANDROID_HARDWARE_BUFFER_EXTERNAL_TEXTURE_GL_H_
|
||||
#define FLUTTER_SHELL_PLATFORM_ANDROID_HARDWARE_BUFFER_EXTERNAL_TEXTURE_GL_H_
|
||||
#ifndef FLUTTER_SHELL_PLATFORM_ANDROID_IMAGE_EXTERNAL_TEXTURE_GL_H_
|
||||
#define FLUTTER_SHELL_PLATFORM_ANDROID_IMAGE_EXTERNAL_TEXTURE_GL_H_
|
||||
|
||||
#include "flutter/fml/platform/android/scoped_java_ref.h"
|
||||
#include "flutter/shell/platform/android/hardware_buffer_external_texture.h"
|
||||
#include "flutter/shell/platform/android/image_external_texture.h"
|
||||
|
||||
#include "flutter/impeller/renderer/backend/gles/context_gles.h"
|
||||
#include "flutter/impeller/renderer/backend/gles/gles.h"
|
||||
@@ -20,9 +20,9 @@
|
||||
|
||||
namespace flutter {
|
||||
|
||||
class HardwareBufferExternalTextureGL : public HardwareBufferExternalTexture {
|
||||
class ImageExternalTextureGL : public ImageExternalTexture {
|
||||
public:
|
||||
HardwareBufferExternalTextureGL(
|
||||
ImageExternalTextureGL(
|
||||
int64_t id,
|
||||
const fml::jni::ScopedJavaGlobalRef<jobject>& image_textury_entry,
|
||||
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade);
|
||||
@@ -39,13 +39,12 @@ class HardwareBufferExternalTextureGL : public HardwareBufferExternalTexture {
|
||||
fml::jni::ScopedJavaGlobalRef<jobject> android_image_;
|
||||
impeller::UniqueEGLImageKHR egl_image_;
|
||||
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(HardwareBufferExternalTextureGL);
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(ImageExternalTextureGL);
|
||||
};
|
||||
|
||||
class HardwareBufferExternalTextureGLSkia
|
||||
: public HardwareBufferExternalTextureGL {
|
||||
class ImageExternalTextureGLSkia : public ImageExternalTextureGL {
|
||||
public:
|
||||
HardwareBufferExternalTextureGLSkia(
|
||||
ImageExternalTextureGLSkia(
|
||||
const std::shared_ptr<AndroidContextGLSkia>& context,
|
||||
int64_t id,
|
||||
const fml::jni::ScopedJavaGlobalRef<jobject>& image_textury_entry,
|
||||
@@ -62,13 +61,12 @@ class HardwareBufferExternalTextureGLSkia
|
||||
|
||||
impeller::UniqueGLTexture texture_;
|
||||
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(HardwareBufferExternalTextureGLSkia);
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(ImageExternalTextureGLSkia);
|
||||
};
|
||||
|
||||
class HardwareBufferExternalTextureGLImpeller
|
||||
: public HardwareBufferExternalTextureGL {
|
||||
class ImageExternalTextureGLImpeller : public ImageExternalTextureGL {
|
||||
public:
|
||||
HardwareBufferExternalTextureGLImpeller(
|
||||
ImageExternalTextureGLImpeller(
|
||||
const std::shared_ptr<impeller::ContextGLES>& context,
|
||||
int64_t id,
|
||||
const fml::jni::ScopedJavaGlobalRef<jobject>&
|
||||
@@ -85,9 +83,9 @@ class HardwareBufferExternalTextureGLImpeller
|
||||
|
||||
const std::shared_ptr<impeller::ContextGLES> impeller_context_;
|
||||
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(HardwareBufferExternalTextureGLImpeller);
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(ImageExternalTextureGLImpeller);
|
||||
};
|
||||
|
||||
} // namespace flutter
|
||||
|
||||
#endif // FLUTTER_SHELL_PLATFORM_ANDROID_HARDWARE_BUFFER_EXTERNAL_TEXTURE_GL_H_
|
||||
#endif // FLUTTER_SHELL_PLATFORM_ANDROID_IMAGE_EXTERNAL_TEXTURE_GL_H_
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
#include "flutter/shell/platform/android/hardware_buffer_external_texture_vk.h"
|
||||
#include "flutter/shell/platform/android/image_external_texture_vk.h"
|
||||
|
||||
#include "flutter/impeller/core/formats.h"
|
||||
#include "flutter/impeller/core/texture_descriptor.h"
|
||||
@@ -10,27 +10,27 @@
|
||||
|
||||
namespace flutter {
|
||||
|
||||
HardwareBufferExternalTextureVK::HardwareBufferExternalTextureVK(
|
||||
ImageExternalTextureVK::ImageExternalTextureVK(
|
||||
const std::shared_ptr<impeller::ContextVK>& impeller_context,
|
||||
int64_t id,
|
||||
const fml::jni::ScopedJavaGlobalRef<jobject>& image_texture_entry,
|
||||
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade)
|
||||
: HardwareBufferExternalTexture(id, image_texture_entry, jni_facade),
|
||||
: ImageExternalTexture(id, image_texture_entry, jni_facade),
|
||||
impeller_context_(impeller_context) {}
|
||||
|
||||
HardwareBufferExternalTextureVK::~HardwareBufferExternalTextureVK() {}
|
||||
ImageExternalTextureVK::~ImageExternalTextureVK() {}
|
||||
|
||||
void HardwareBufferExternalTextureVK::Attach(PaintContext& context) {
|
||||
void ImageExternalTextureVK::Attach(PaintContext& context) {
|
||||
if (state_ == AttachmentState::kUninitialized) {
|
||||
// First processed frame we are attached.
|
||||
state_ = AttachmentState::kAttached;
|
||||
}
|
||||
}
|
||||
|
||||
void HardwareBufferExternalTextureVK::Detach() {}
|
||||
void ImageExternalTextureVK::Detach() {}
|
||||
|
||||
void HardwareBufferExternalTextureVK::ProcessFrame(PaintContext& context,
|
||||
const SkRect& bounds) {
|
||||
void ImageExternalTextureVK::ProcessFrame(PaintContext& context,
|
||||
const SkRect& bounds) {
|
||||
JavaLocalRef image = AcquireLatestImage();
|
||||
if (image.is_null()) {
|
||||
return;
|
||||
@@ -2,10 +2,10 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef FLUTTER_SHELL_PLATFORM_ANDROID_HARDWARE_BUFFER_EXTERNAL_TEXTURE_VK_H_
|
||||
#define FLUTTER_SHELL_PLATFORM_ANDROID_HARDWARE_BUFFER_EXTERNAL_TEXTURE_VK_H_
|
||||
#ifndef FLUTTER_SHELL_PLATFORM_ANDROID_IMAGE_EXTERNAL_TEXTURE_VK_H_
|
||||
#define FLUTTER_SHELL_PLATFORM_ANDROID_IMAGE_EXTERNAL_TEXTURE_VK_H_
|
||||
|
||||
#include "flutter/shell/platform/android/hardware_buffer_external_texture.h"
|
||||
#include "flutter/shell/platform/android/image_external_texture.h"
|
||||
|
||||
#include "flutter/impeller/renderer/backend/vulkan/android_hardware_buffer_texture_source_vk.h"
|
||||
#include "flutter/impeller/renderer/backend/vulkan/context_vk.h"
|
||||
@@ -14,16 +14,16 @@
|
||||
|
||||
namespace flutter {
|
||||
|
||||
class HardwareBufferExternalTextureVK : public HardwareBufferExternalTexture {
|
||||
class ImageExternalTextureVK : public ImageExternalTexture {
|
||||
public:
|
||||
HardwareBufferExternalTextureVK(
|
||||
ImageExternalTextureVK(
|
||||
const std::shared_ptr<impeller::ContextVK>& impeller_context,
|
||||
int64_t id,
|
||||
const fml::jni::ScopedJavaGlobalRef<jobject>&
|
||||
hardware_buffer_texture_entry,
|
||||
const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade);
|
||||
|
||||
~HardwareBufferExternalTextureVK() override;
|
||||
~ImageExternalTextureVK() override;
|
||||
|
||||
private:
|
||||
void Attach(PaintContext& context) override;
|
||||
@@ -37,4 +37,4 @@ class HardwareBufferExternalTextureVK : public HardwareBufferExternalTexture {
|
||||
|
||||
} // namespace flutter
|
||||
|
||||
#endif // FLUTTER_SHELL_PLATFORM_ANDROID_HARDWARE_BUFFER_EXTERNAL_TEXTURE_VK_H_
|
||||
#endif // FLUTTER_SHELL_PLATFORM_ANDROID_IMAGE_EXTERNAL_TEXTURE_VK_H_
|
||||
@@ -17,11 +17,11 @@
|
||||
#include "flutter/shell/platform/android/android_surface_gl_impeller.h"
|
||||
#include "flutter/shell/platform/android/android_surface_gl_skia.h"
|
||||
#include "flutter/shell/platform/android/android_surface_software.h"
|
||||
#include "flutter/shell/platform/android/hardware_buffer_external_texture_gl.h"
|
||||
#include "flutter/shell/platform/android/image_external_texture_gl.h"
|
||||
#include "flutter/shell/platform/android/surface_texture_external_texture_gl.h"
|
||||
#if IMPELLER_ENABLE_VULKAN // b/258506856 for why this is behind an if
|
||||
#include "flutter/shell/platform/android/android_surface_vulkan_impeller.h"
|
||||
#include "flutter/shell/platform/android/hardware_buffer_external_texture_vk.h"
|
||||
#include "flutter/shell/platform/android/image_external_texture_vk.h"
|
||||
#endif
|
||||
#include "flutter/shell/platform/android/context/android_context.h"
|
||||
#include "flutter/shell/platform/android/external_view_embedder/external_view_embedder.h"
|
||||
@@ -324,18 +324,18 @@ void PlatformViewAndroid::RegisterImageTexture(
|
||||
if (android_context_->RenderingApi() == AndroidRenderingAPI::kOpenGLES) {
|
||||
if (android_context_->GetImpellerContext()) {
|
||||
// Impeller GLES.
|
||||
RegisterTexture(std::make_shared<HardwareBufferExternalTextureGLImpeller>(
|
||||
RegisterTexture(std::make_shared<ImageExternalTextureGLImpeller>(
|
||||
std::static_pointer_cast<impeller::ContextGLES>(
|
||||
android_context_->GetImpellerContext()),
|
||||
texture_id, image_texture_entry, jni_facade_));
|
||||
} else {
|
||||
// Legacy GL.
|
||||
RegisterTexture(std::make_shared<HardwareBufferExternalTextureGLSkia>(
|
||||
RegisterTexture(std::make_shared<ImageExternalTextureGLSkia>(
|
||||
std::static_pointer_cast<AndroidContextGLSkia>(android_context_),
|
||||
texture_id, image_texture_entry, jni_facade_));
|
||||
}
|
||||
} else if (android_context_->RenderingApi() == AndroidRenderingAPI::kVulkan) {
|
||||
RegisterTexture(std::make_shared<HardwareBufferExternalTextureVK>(
|
||||
RegisterTexture(std::make_shared<ImageExternalTextureVK>(
|
||||
std::static_pointer_cast<impeller::ContextVK>(
|
||||
android_context_->GetImpellerContext()),
|
||||
texture_id, image_texture_entry, jni_facade_));
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "flutter/shell/platform/android/android_shell_holder.h"
|
||||
#include "flutter/shell/platform/android/apk_asset_provider.h"
|
||||
#include "flutter/shell/platform/android/flutter_main.h"
|
||||
#include "flutter/shell/platform/android/hardware_buffer_external_texture_gl.h"
|
||||
#include "flutter/shell/platform/android/image_external_texture_gl.h"
|
||||
#include "flutter/shell/platform/android/jni/platform_view_android_jni.h"
|
||||
#include "flutter/shell/platform/android/platform_view_android.h"
|
||||
#include "flutter/shell/platform/android/surface_texture_external_texture_gl.h"
|
||||
|
||||
Reference in New Issue
Block a user