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

#include <surface_texture_external_texture_gl.h>

Inheritance diagram for flutter::SurfaceTextureExternalTextureGL:
flutter::SurfaceTextureExternalTexture flutter::Texture flutter::ContextListener

Public Member Functions

 SurfaceTextureExternalTextureGL (int64_t id, const fml::jni::ScopedJavaGlobalRef< jobject > &surface_texture, const std::shared_ptr< PlatformViewAndroidJNI > &jni_facade)
 
 ~SurfaceTextureExternalTextureGL () override
 
- Public Member Functions inherited from flutter::SurfaceTextureExternalTexture
 SurfaceTextureExternalTexture (int64_t id, const fml::jni::ScopedJavaGlobalRef< jobject > &surface_texture, const std::shared_ptr< PlatformViewAndroidJNI > &jni_facade)
 
 ~SurfaceTextureExternalTexture () override
 
void Paint (PaintContext &context, const SkRect &bounds, bool freeze, const DlImageSampling sampling) override
 
void OnGrContextCreated () override
 
void OnGrContextDestroyed () override
 
void MarkNewFrameAvailable () override
 
void OnTextureUnregistered () 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

virtual void ProcessFrame (PaintContext &context, const SkRect &bounds) override
 
virtual void Detach () override
 

Additional Inherited Members

- Protected Types inherited from flutter::SurfaceTextureExternalTexture
enum class  AttachmentState { kUninitialized , kAttached , kDetached }
 
- Protected Member Functions inherited from flutter::SurfaceTextureExternalTexture
void Attach (int gl_tex_id)
 
bool ShouldUpdate ()
 
void Update ()
 
 FML_DISALLOW_COPY_AND_ASSIGN (SurfaceTextureExternalTexture)
 
- Protected Attributes inherited from flutter::SurfaceTextureExternalTexture
std::shared_ptr< PlatformViewAndroidJNIjni_facade_
 
fml::jni::ScopedJavaGlobalRef< jobject > surface_texture_
 
AttachmentState state_ = AttachmentState::kUninitialized
 
SkMatrix transform_
 
sk_sp< flutter::DlImagedl_image_
 

Detailed Description

Definition at line 21 of file surface_texture_external_texture_gl.h.

Constructor & Destructor Documentation

◆ SurfaceTextureExternalTextureGL()

flutter::SurfaceTextureExternalTextureGL::SurfaceTextureExternalTextureGL ( int64_t  id,
const fml::jni::ScopedJavaGlobalRef< jobject > &  surface_texture,
const std::shared_ptr< PlatformViewAndroidJNI > &  jni_facade 
)

Definition at line 24 of file surface_texture_external_texture_gl.cc.

28 : SurfaceTextureExternalTexture(id, surface_texture, jni_facade) {}
SurfaceTextureExternalTexture(int64_t id, const fml::jni::ScopedJavaGlobalRef< jobject > &surface_texture, const std::shared_ptr< PlatformViewAndroidJNI > &jni_facade)

◆ ~SurfaceTextureExternalTextureGL()

flutter::SurfaceTextureExternalTextureGL::~SurfaceTextureExternalTextureGL ( )
override

Definition at line 30 of file surface_texture_external_texture_gl.cc.

30 {
31 if (texture_name_ != 0) {
32 glDeleteTextures(1, &texture_name_);
33 }
34}

Member Function Documentation

◆ Detach()

void flutter::SurfaceTextureExternalTextureGL::Detach ( )
overrideprivatevirtual

Reimplemented from flutter::SurfaceTextureExternalTexture.

Definition at line 58 of file surface_texture_external_texture_gl.cc.

58 {
60 if (texture_name_ != 0) {
61 glDeleteTextures(1, &texture_name_);
62 texture_name_ = 0;
63 }
64}

◆ ProcessFrame()

void flutter::SurfaceTextureExternalTextureGL::ProcessFrame ( PaintContext context,
const SkRect bounds 
)
overrideprivatevirtual

Implements flutter::SurfaceTextureExternalTexture.

Definition at line 36 of file surface_texture_external_texture_gl.cc.

37 {
39 // Generate the texture handle.
40 glGenTextures(1, &texture_name_);
41 Attach(texture_name_);
42 }
44
45 // Updates the texture contents and transformation matrix.
46 Update();
47
48 // Create a
49 GrGLTextureInfo textureInfo = {GL_TEXTURE_EXTERNAL_OES, texture_name_,
50 GL_RGBA8_OES};
51 auto backendTexture =
52 GrBackendTextures::MakeGL(1, 1, skgpu::Mipmapped::kNo, textureInfo);
54 context.gr_context, backendTexture, kTopLeft_GrSurfaceOrigin,
56}
@ 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
#define FML_CHECK(condition)
Definition logging.h:85
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)

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