Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
FlutterDarwinExternalTextureMetal Class Reference

#include <FlutterDarwinExternalTextureMetal.h>

Inheritance diagram for FlutterDarwinExternalTextureMetal:

Instance Methods

(nullable instancetype) - initWithTextureCache:textureID:texture:enableImpeller:
 
(void) - paintContext:bounds:freeze:sampling:
 
(void) - onGrContextCreated
 
(void) - onGrContextDestroyed
 
(void) - markNewFrameAvailable
 
(void) - onTextureUnregistered
 

Properties

int64_t textureID
 

Detailed Description

Definition at line 45 of file FlutterDarwinExternalTextureMetal.h.

Method Documentation

◆ initWithTextureCache:textureID:texture:enableImpeller:

- (nullable instancetype) initWithTextureCache: (nonnull CVMetalTextureCacheRef)  textureCache
textureID: (int64_t)  textureID
texture: (nonnull NSObject< FlutterTexture > *)  texture
enableImpeller: (BOOL enableImpeller 

◆ markNewFrameAvailable

- (void) markNewFrameAvailable

Definition at line 37 of file FlutterDarwinExternalTextureMetal.mm.

117 {
119}

◆ onGrContextCreated

- (void) onGrContextCreated

Definition at line 37 of file FlutterDarwinExternalTextureMetal.mm.

100 {
101 // External images in this backend have no thread affinity and are not tied to the context in any
102 // way. Instead, they are tied to the Metal device which is associated with the cache already and
103 // is consistent throughout the shell run.
104}

◆ onGrContextDestroyed

- (void) onGrContextDestroyed

Definition at line 37 of file FlutterDarwinExternalTextureMetal.mm.

106 {
107 // The image must be reset because it is tied to the onscreen context. But the pixel buffer that
108 // created the image is still around. In case of context reacquisition, that last pixel
109 // buffer will be used to materialize the image in case the application fails to provide a new
110 // one.
111 _externalImage.reset();
112 if (_textureCache) {
113 CVMetalTextureCacheFlush(_textureCache, /* options (must be zero) */ 0);
114 }
115}
sk_sp< flutter::DlImage > _externalImage

◆ onTextureUnregistered

- (void) onTextureUnregistered

Definition at line 37 of file FlutterDarwinExternalTextureMetal.mm.

121 {
122 if ([_externalTexture respondsToSelector:@selector(onTextureUnregistered:)]) {
123 [_externalTexture onTextureUnregistered:_externalTexture];
124 }
125}
NSObject< FlutterTexture > * _externalTexture

◆ paintContext:bounds:freeze:sampling:

- (void) paintContext: (flutter::Texture::PaintContext&)  context
bounds: (const SkRect&)  bounds
freeze: (BOOL freeze
sampling: (const flutter::DlImageSampling sampling 

Definition at line 37 of file FlutterDarwinExternalTextureMetal.mm.

62 bounds:(const SkRect&)bounds
63 freeze:(BOOL)freeze
64 sampling:(const flutter::DlImageSampling)sampling {
65 const bool needsUpdatedTexture = (!freeze && _textureFrameAvailable) || !_externalImage;
66
67 if (needsUpdatedTexture) {
68 [self onNeedsUpdatedTexture:context];
69 }
70
71 if (_externalImage) {
72 context.canvas->DrawImageRect(
73 _externalImage, // image
74 flutter::DlRect::Make(_externalImage->GetBounds()), // source rect
75 flutter::ToDlRect(bounds), // destination rect
76 sampling, // sampling
77 context.paint, // paint
79 );
80 }
81}
virtual void DrawImageRect(const sk_sp< DlImage > &image, const DlRect &src, const DlRect &dst, DlImageSampling sampling, const DlPaint *paint=nullptr, DlSrcRectConstraint constraint=DlSrcRectConstraint::kFast)=0
const DlRect & ToDlRect(const SkRect &rect)
static constexpr std::enable_if_t< std::is_floating_point_v< FT >, TRect > Make(const TRect< U > &rect)
Definition rect.h:181
int BOOL

Property Documentation

◆ textureID

- (int64_t) textureID
readnonatomicassign

Definition at line 65 of file FlutterDarwinExternalTextureMetal.h.


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