Flutter macOS Embedder
FlutterSurface.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef FLUTTER_SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_SOURCE_FLUTTERSURFACE_H_
6 #define FLUTTER_SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_SOURCE_FLUTTERSURFACE_H_
7 
8 #import <Cocoa/Cocoa.h>
9 
10 #import "flutter/shell/platform/embedder/embedder.h"
11 
12 /**
13  * Opaque surface type.
14  * Can be represented as FlutterMetalTexture to cross the embedder API boundary.
15  */
16 @interface FlutterSurface : NSObject
17 
18 - (FlutterMetalTexture)asFlutterMetalTexture;
19 
20 + (nullable FlutterSurface*)fromFlutterMetalTexture:(nonnull const FlutterMetalTexture*)texture;
21 
22 @end
23 
24 /**
25  * Internal FlutterSurface interface used by FlutterSurfaceManager.
26  * Wraps an IOSurface framebuffer and metadata related to the surface.
27  */
29 
30 - (nonnull instancetype)initWithSize:(CGSize)size
31  device:(nonnull id<MTLDevice>)device
32  enableWideGamut:(BOOL)enableWideGamut;
33 
34 @property(readonly, nonatomic, nonnull) IOSurfaceRef ioSurface;
35 @property(readonly, nonatomic) CGSize size;
36 @property(readonly, nonatomic) int64_t textureId;
37 // Whether the surface is currently in use by the compositor.
38 @property(readonly, nonatomic) BOOL isInUse;
39 // Whether the surface was created with wide gamut enabled.
40 @property(readonly, nonatomic) BOOL isWideGamut;
41 
42 @end
43 
45 @property(readwrite, nonatomic) BOOL isInUseOverride;
46 @end
47 
48 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_SOURCE_FLUTTERSURFACE_H_
FlutterMetalTexture asFlutterMetalTexture()