8#include "flutter/third_party/skia/include/gpu/ganesh/SkImageGanesh.h"
9#include "flutter/third_party/skia/include/gpu/ganesh/gl/GrGLBackendSurface.h"
14 const std::shared_ptr<AndroidContextGLSkia>& context,
17 const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade,
21void ImageExternalTextureGLSkia::Attach(
PaintContext& context) {
29void ImageExternalTextureGLSkia::Detach() {
33void ImageExternalTextureGLSkia::BindImageToTexture(
36 if (!
image.is_valid() || tex == 0) {
39 glBindTexture(GL_TEXTURE_EXTERNAL_OES, tex);
40 glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES,
41 static_cast<GLeglImageOES
>(
image.get().
image));
44sk_sp<flutter::DlImage> ImageExternalTextureGLSkia::CreateDlImage(
45 PaintContext& context,
47 std::optional<HardwareBufferKey>
id,
50 glGenTextures(1, &texture_name);
53 unique_texture.
reset(gl_texture);
55 BindImageToTexture(egl_image, unique_texture.
get().texture_name);
56 GrGLTextureInfo textureInfo = {
57 GL_TEXTURE_EXTERNAL_OES, unique_texture.
get().texture_name, GL_RGBA8_OES};
59 GrBackendTextures::MakeGL(1, 1, skgpu::Mipmapped::kNo, textureInfo);
61 gl_entries_[
id.value_or(0)] = GlEntry{.egl_image = std::move(egl_image),
62 .texture = std::move(unique_texture)};
64 context.gr_context, backendTexture, kTopLeft_GrSurfaceOrigin,
65 kRGBA_8888_SkColorType, kPremul_SkAlphaType,
nullptr));
static sk_sp< DlImage > Make(const SkImage *image)
std::unordered_map< HardwareBufferKey, GlEntry > gl_entries_
void Attach(PaintContext &context) override
ImageExternalTextureGLSkia(const std::shared_ptr< AndroidContextGLSkia > &context, int64_t id, const fml::jni::ScopedJavaGlobalRef< jobject > &image_textury_entry, const std::shared_ptr< PlatformViewAndroidJNI > &jni_facade, ImageExternalTexture::ImageLifecycle lifecycle)
ImageLifecycle
Whether the last image should be reset when the context is destroyed.
void reset(const T &value=Traits::InvalidValue())
FlutterVulkanImage * image
FlutterVulkanImageHandle image