| Flutter macOS Embedder |

Instance Methods | Properties | List of all members
FlutterSurfaceManager Class Reference

`#import <FlutterSurfaceManager.h>`

Inheritance diagram for FlutterSurfaceManager:

## Instance Methods
(nullable instancetype) | - initWithDevice:commandQueue:layer:delegate:wideGamut:
(void) | - setEnableWideGamut:
(nonnull FlutterSurface *) | - surfaceForSize:
(void) | - presentSurfaces:atTime:notify:

## Properties
FlutterBackBufferCache * | backBufferCache
NSArray< FlutterSurface * > * | frontSurfaces
NSArray< CALayer * > * | layers

## Detailed Description

FlutterSurfaceManager is responsible for providing and presenting Core Animation render surfaces and managing sublayers.

Owned by `FlutterView`.

Definition at line 46 of file FlutterSurfaceManager.h.

## Method Documentation

## ◆ initWithDevice:commandQueue:layer:delegate:wideGamut:

- (nullable instancetype) initWithDevice: |  | (nonnull id< MTLDevice >) | device
commandQueue: |  | (nonnull id< MTLCommandQueue >) | commandQueue
layer: |  | (nonnull CALayer *) | containingLayer
delegate: |  | (nonnull id< FlutterSurfaceManagerDelegate >) | delegate
wideGamut: |  | (BOOL) | wideGamut

Initializes and returns a surface manager that renders to a child layer (referred to as the content layer) of the containing layer.

## ◆ presentSurfaces:atTime:notify:

- (void) presentSurfaces: |  | (nonnull NSArray< FlutterSurfacePresentInfo * > *) | surfaces
atTime: |  | (CFTimeInterval) | presentationTime
notify: |  | (nullable dispatch_block_t) | notify

Sets the provided surfaces as contents of FlutterView. Will create, update and remove sublayers as needed.

Must be called on raster thread. This will schedule a commit on the platform thread and block the raster thread until the commit is done. The `notify` block will be invoked on the platform thread and can be used to perform additional work, such as mutating platform views. It is guaranteed be called in the same CATransaction.

Referenced by flutter::testing::TEST().

## ◆ setEnableWideGamut:

- (void) setEnableWideGamut: |  | (BOOL) | enableWideGamut |

Updates the wide gamut setting. Flushes cached surfaces so new surfaces will be created with the updated pixel format.

Must be called on the platform thread.

Definition at line 39 of file FlutterSurfaceManager.mm.

123 :(BOOL)enableWideGamut {
124 FML_DCHECK([NSThread isMainThread]);
125 if (_wideGamut == enableWideGamut) {
126 return;
127 }
128 _wideGamut = enableWideGamut;
129
130 // Flush cached surfaces since they have the wrong pixel format.
131 [_backBufferCache flush];
132
133 // Clear front surfaces — they will be replaced on the next present.
134 [_frontSurfaces removeAllObjects];
135 }

Referenced by flutter::testing::TEST().

## ◆ surfaceForSize:

- (FlutterSurface *) surfaceForSize: |  | (CGSize) | size |

Returns a back buffer surface of the given size to which Flutter can render content. A cached surface will be returned if available; otherwise a new one will be created.

Must be called on raster thread.

Definition at line 39 of file FlutterSurfaceManager.mm.

149 :(CGSize)size {
150 FlutterSurface* surface = [_backBufferCache removeSurfaceForSize:size];
151 if (surface == nil) {
152 surface = [[FlutterSurface alloc] initWithSize:size device:_device enableWideGamut:_wideGamut];
153 }
154 return surface;
155 }
FlutterSurface
Definition: FlutterSurface.h:17

Referenced by flutter::testing::TEST().

## Property Documentation

## ◆ backBufferCache

- (FlutterBackBufferCache*) backBufferCache
| read nonatomic assign

Provided by category FlutterSurfaceManager(Private).

Definition at line 121 of file FlutterSurfaceManager.h.

Referenced by flutter::testing::TEST().

## ◆ frontSurfaces

- (NSArray<FlutterSurface*>*) frontSurfaces
| read nonatomic assign

Provided by category FlutterSurfaceManager(Private).

Definition at line 122 of file FlutterSurfaceManager.h.

Referenced by flutter::testing::TEST().

## ◆ layers

- (NSArray<CALayer*>*) layers
| read nonatomic assign

Provided by category FlutterSurfaceManager(Private).

Definition at line 123 of file FlutterSurfaceManager.h.

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

- shell/platform/darwin/macos/framework/Source/FlutterSurfaceManager.h
- shell/platform/darwin/macos/framework/Source/FlutterSurfaceManager.mm