Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | List of all members
flutter::ImageExternalTextureGLSkia Class Reference

#include <image_external_texture_gl.h>

Inheritance diagram for flutter::ImageExternalTextureGLSkia:
flutter::ImageExternalTextureGL flutter::ImageExternalTexture flutter::Texture flutter::ContextListener

Public Member Functions

 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)
 
- Public Member Functions inherited from flutter::ImageExternalTextureGL
 ImageExternalTextureGL (int64_t id, const fml::jni::ScopedJavaGlobalRef< jobject > &image_textury_entry, const std::shared_ptr< PlatformViewAndroidJNI > &jni_facade)
 
- Public Member Functions inherited from flutter::ImageExternalTexture
 ImageExternalTexture (int64_t id, const fml::jni::ScopedJavaGlobalRef< jobject > &image_texture_entry, const std::shared_ptr< PlatformViewAndroidJNI > &jni_facade)
 
virtual ~ImageExternalTexture ()=default
 
void Paint (PaintContext &context, const SkRect &bounds, bool freeze, const DlImageSampling sampling) override
 
void MarkNewFrameAvailable () override
 
void OnTextureUnregistered () override
 
void OnGrContextCreated () override
 
void OnGrContextDestroyed () override
 
- Public Member Functions inherited from flutter::Texture
 Texture (int64_t id)
 
virtual ~Texture ()
 
int64_t Id ()
 
- Public Member Functions inherited from flutter::ContextListener
 ContextListener ()
 
 ~ContextListener ()
 

Private Member Functions

void Attach (PaintContext &context) override
 
void Detach () override
 
sk_sp< flutter::DlImageCreateDlImage (PaintContext &context, const SkRect &bounds, std::optional< HardwareBufferKey > id, impeller::UniqueEGLImageKHR &&egl_image) override
 

Additional Inherited Members

- Protected Types inherited from flutter::ImageExternalTexture
enum class  AttachmentState { kUninitialized , kAttached , kDetached }
 
- Protected Member Functions inherited from flutter::ImageExternalTextureGL
void ProcessFrame (PaintContext &context, const SkRect &bounds) override
 
void UpdateImage (JavaLocalRef &hardware_buffer, const SkRect &bounds, PaintContext &context)
 
impeller::UniqueEGLImageKHR CreateEGLImage (AHardwareBuffer *buffer)
 
 FML_DISALLOW_COPY_AND_ASSIGN (ImageExternalTextureGL)
 
- Protected Member Functions inherited from flutter::ImageExternalTexture
JavaLocalRef AcquireLatestImage ()
 
void CloseImage (const fml::jni::JavaRef< jobject > &image)
 
JavaLocalRef HardwareBufferFor (const fml::jni::JavaRef< jobject > &image)
 
void CloseHardwareBuffer (const fml::jni::JavaRef< jobject > &hardware_buffer)
 
AHardwareBufferAHardwareBufferFor (const fml::jni::JavaRef< jobject > &hardware_buffer)
 
 FML_DISALLOW_COPY_AND_ASSIGN (ImageExternalTexture)
 
- Protected Attributes inherited from flutter::ImageExternalTextureGL
std::unordered_map< HardwareBufferKey, GlEntrygl_entries_
 
- Protected Attributes inherited from flutter::ImageExternalTexture
fml::jni::ScopedJavaGlobalRef< jobject > image_texture_entry_
 
std::shared_ptr< PlatformViewAndroidJNIjni_facade_
 
AttachmentState state_ = AttachmentState::kUninitialized
 
sk_sp< flutter::DlImagedl_image_
 
ImageLRU image_lru_ = ImageLRU()
 

Detailed Description

Definition at line 59 of file image_external_texture_gl.h.

Constructor & Destructor Documentation

◆ ImageExternalTextureGLSkia()

flutter::ImageExternalTextureGLSkia::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 
)

Definition at line 110 of file image_external_texture_gl.cc.

115 : ImageExternalTextureGL(id, image_texture_entry, jni_facade) {}
ImageExternalTextureGL(int64_t id, const fml::jni::ScopedJavaGlobalRef< jobject > &image_textury_entry, const std::shared_ptr< PlatformViewAndroidJNI > &jni_facade)

Member Function Documentation

◆ Attach()

void flutter::ImageExternalTextureGLSkia::Attach ( PaintContext context)
overrideprivatevirtual

Reimplemented from flutter::ImageExternalTextureGL.

Definition at line 117 of file image_external_texture_gl.cc.

117 {
119 // After this call state_ will be AttachmentState::kAttached and egl_image_
120 // will have been created if we still have an Image associated with us.
122 }
123}
void Attach(PaintContext &context) override

◆ CreateDlImage()

sk_sp< flutter::DlImage > flutter::ImageExternalTextureGLSkia::CreateDlImage ( PaintContext context,
const SkRect bounds,
std::optional< HardwareBufferKey id,
impeller::UniqueEGLImageKHR &&  egl_image 
)
overrideprivatevirtual

Implements flutter::ImageExternalTextureGL.

Definition at line 140 of file image_external_texture_gl.cc.

144 {
145 GLuint texture_name;
146 glGenTextures(1, &texture_name);
147 auto gl_texture = impeller::GLTexture{texture_name};
148 impeller::UniqueGLTexture unique_texture;
149 unique_texture.reset(gl_texture);
150
151 BindImageToTexture(egl_image, unique_texture.get().texture_name);
152 GrGLTextureInfo textureInfo = {
153 GL_TEXTURE_EXTERNAL_OES, unique_texture.get().texture_name, GL_RGBA8_OES};
154 auto backendTexture =
155 GrBackendTextures::MakeGL(1, 1, skgpu::Mipmapped::kNo, textureInfo);
156
157 gl_entries_[id.value_or(0)] = GlEntry{.egl_image = std::move(egl_image),
158 .texture = std::move(unique_texture)};
160 context.gr_context, backendTexture, kTopLeft_GrSurfaceOrigin,
162}
@ kTopLeft_GrSurfaceOrigin
Definition GrTypes.h:148
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition SkAlphaType.h:29
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
Definition SkColorType.h:24
static sk_sp< DlImage > Make(const SkImage *image)
Definition dl_image.cc:11
std::unordered_map< HardwareBufferKey, GlEntry > gl_entries_
void reset(const T &value=Traits::InvalidValue())
const T & get() const
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)

◆ Detach()

void flutter::ImageExternalTextureGLSkia::Detach ( )
overrideprivatevirtual

The documentation for this class was generated from the following files: