5#include "flutter/shell/platform/android/surface_texture_external_texture_gl.h"
9#include "flutter/display_list/effects/dl_color_source.h"
27 const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade)
31 if (texture_name_ != 0) {
32 glDeleteTextures(1, &texture_name_);
40 glGenTextures(1, &texture_name_);
60 if (texture_name_ != 0) {
61 glDeleteTextures(1, &texture_name_);
68 const std::shared_ptr<impeller::ContextGLES>& context,
71 const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade)
73 impeller_context_(context) {}
88 static_cast<int>(
bounds.height())};
90 texture_ = std::make_shared<impeller::TextureGLES>(
91 impeller_context_->GetReactor(),
desc,
93 texture_->SetCoordinateSystem(
95 auto maybe_handle = texture_->GetGLHandle();
96 if (!maybe_handle.has_value()) {
97 FML_LOG(
ERROR) <<
"Could not get GL handle from impeller::TextureGLES!";
100 Attach(maybe_handle.value());
@ kTopLeft_GrSurfaceOrigin
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
static sk_sp< DlImage > Make(const SkImage *image)
virtual void Detach() override
~SurfaceTextureExternalTextureGL() override
SurfaceTextureExternalTextureGL(int64_t id, const fml::jni::ScopedJavaGlobalRef< jobject > &surface_texture, const std::shared_ptr< PlatformViewAndroidJNI > &jni_facade)
virtual void ProcessFrame(PaintContext &context, const SkRect &bounds) override
SurfaceTextureExternalTextureImpellerGL(const std::shared_ptr< impeller::ContextGLES > &context, int64_t id, const fml::jni::ScopedJavaGlobalRef< jobject > &surface_texture, const std::shared_ptr< PlatformViewAndroidJNI > &jni_facade)
virtual void Detach() override
~SurfaceTextureExternalTextureImpellerGL() override
virtual void ProcessFrame(PaintContext &context, const SkRect &bounds) override
sk_sp< flutter::DlImage > dl_image_
void Attach(int gl_tex_id)
static sk_sp< DlImageImpeller > Make(std::shared_ptr< Texture > texture, OwningContext owning_context=OwningContext::kIO)
#define FML_LOG(severity)
#define FML_CHECK(condition)
SK_API GrBackendTexture MakeGL(int width, int height, skgpu::Mipmapped, const GrGLTextureInfo &glInfo, std::string_view label={})
SK_API sk_sp< SkImage > BorrowTextureFrom(GrRecordingContext *context, const GrBackendTexture &backendTexture, GrSurfaceOrigin origin, SkColorType colorType, SkAlphaType alphaType, sk_sp< SkColorSpace > colorSpace, TextureReleaseProc textureReleaseProc=nullptr, ReleaseContext releaseContext=nullptr)
Optional< SkRect > bounds
GrDirectContext * gr_context
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...