Flutter iOS Embedder
FlutterMetalLayer Class Reference

#import <FlutterMetalLayer.h>

Inheritance diagram for FlutterMetalLayer:

Instance Methods

(id< MTLDevice > preferredDevice) - API_AVAILABLE
 
(nullable id< CAMetalDrawable >) - nextDrawable
 

Class Methods

(BOOL) + enabled
 

Properties

id< MTLDevice > device
 
MTLPixelFormat pixelFormat
 
BOOL framebufferOnly
 
CGSize drawableSize
 
BOOL presentsWithTransaction
 
CGColorSpaceRef colorspace
 

Detailed Description

Drop-in replacement (as far as Flutter is concerned) for CAMetalLayer that can present with transaction from a background thread.

Properties and method declarations must exactly match those in the CAMetalLayer interface declaration.

Definition at line 15 of file FlutterMetalLayer.h.

Method Documentation

◆ API_AVAILABLE

- (id<MTLDevice> preferredDevice) API_AVAILABLE (macos(10.15)) 
(ios(13.0)) 
(tvos(13.0))   

◆ enabled

+ (BOOL) enabled

Returns whether the Metal layer is enabled. This is controlled by FLTUseFlutterMetalLayer value in Info.plist.

Definition at line 439 of file FlutterMetalLayer.mm.

439  {
440  static BOOL enabled = YES;
441  static BOOL didCheckInfoPlist = NO;
442  if (!didCheckInfoPlist) {
443  didCheckInfoPlist = YES;
444  NSNumber* use_flutter_metal_layer =
445  [[NSBundle mainBundle] objectForInfoDictionaryKey:@"FLTUseFlutterMetalLayer"];
446  if (use_flutter_metal_layer != nil && ![use_flutter_metal_layer boolValue]) {
447  enabled = NO;
448  }
449  }
450  return enabled;
451 }

◆ nextDrawable

- (id< CAMetalDrawable >) nextDrawable

Definition at line 385 of file FlutterMetalLayer.mm.

385  {
386  FlutterTexture* texture = [self nextTexture];
387  if (texture == nil) {
388  return nil;
389  }
390  FlutterDrawable* drawable = [[FlutterDrawable alloc] initWithTexture:texture
391  layer:self
392  drawableId:_nextDrawableId++];
393  return drawable;
394 }

Property Documentation

◆ colorspace

- (CGColorSpaceRef) colorspace
readwriteatomicassign

Definition at line 25 of file FlutterMetalLayer.h.

◆ device

- (id<MTLDevice>) device
readwriteatomicretain

Definition at line 17 of file FlutterMetalLayer.h.

◆ drawableSize

- (CGSize) drawableSize
readwriteatomic

Definition at line 23 of file FlutterMetalLayer.h.

◆ framebufferOnly

- (BOOL) framebufferOnly
readwriteatomic

Definition at line 22 of file FlutterMetalLayer.h.

◆ pixelFormat

- (MTLPixelFormat) pixelFormat
readwriteatomic

Definition at line 21 of file FlutterMetalLayer.h.

◆ presentsWithTransaction

- (BOOL) presentsWithTransaction
readwriteatomic

Definition at line 24 of file FlutterMetalLayer.h.


The documentation for this class was generated from the following files:
+[FlutterMetalLayer enabled]
BOOL enabled()
Definition: FlutterMetalLayer.mm:439
FlutterDrawable
Definition: FlutterMetalLayer.mm:81
FlutterTexture
Definition: FlutterMetalLayer.mm:60