File tree 10 files changed +19
-44
lines changed
shell/platform/darwin/macos/framework/Source
10 files changed +19
-44
lines changed Original file line number Diff line number Diff line change 11
11
*/
12
12
@interface FlutterRenderBackingStore : NSObject
13
13
14
- @end
15
-
16
- /* *
17
- * Wraps a Metal texture.
18
- */
19
- @interface FlutterMetalRenderBackingStore : FlutterRenderBackingStore
20
-
21
14
/* *
22
15
* MTLTexture referenced by this backing store instance.
23
16
*/
Original file line number Diff line number Diff line change 5
5
#import " flutter/shell/platform/darwin/macos/framework/Source/FlutterBackingStore.h"
6
6
7
7
@implementation FlutterRenderBackingStore
8
- @end
9
-
10
- @implementation FlutterMetalRenderBackingStore
11
8
12
9
- (instancetype )initWithTexture : (id <MTLTexture >)texture {
13
10
self = [super init ];
Original file line number Diff line number Diff line change 37
37
StartFrame ();
38
38
// If the backing store is for the first layer, return the MTLTexture for the
39
39
// FlutterView.
40
- FlutterMetalRenderBackingStore* backingStore =
41
- reinterpret_cast <FlutterMetalRenderBackingStore*>([view backingStoreForSize: size]);
40
+ FlutterRenderBackingStore* backingStore = [view backingStoreForSize: size];
42
41
backing_store_out->metal .texture .texture =
43
42
(__bridge FlutterMetalTextureHandle)backingStore.texture ;
44
43
} else {
Original file line number Diff line number Diff line change @@ -43,8 +43,7 @@ - (nullable FlutterView*)getView:(uint64_t)viewId {
43
43
44
44
id <FlutterViewProvider> MockViewProvider () {
45
45
FlutterView* viewMock = OCMClassMock ([FlutterView class ]);
46
- FlutterMetalRenderBackingStore* backingStoreMock =
47
- OCMClassMock ([FlutterMetalRenderBackingStore class ]);
46
+ FlutterRenderBackingStore* backingStoreMock = OCMClassMock ([FlutterRenderBackingStore class ]);
48
47
__block id <MTLTexture > textureMock = OCMProtocolMock (@protocol (MTLTexture));
49
48
OCMStub ([backingStoreMock texture ]).andReturn (textureMock);
50
49
Original file line number Diff line number Diff line change @@ -95,8 +95,7 @@ - (FlutterMetalTexture)createTextureForView:(uint64_t)viewId size:(CGSize)size {
95
95
// FlutterMetalTexture has texture `null`, therefore is discarded.
96
96
return FlutterMetalTexture{};
97
97
}
98
- FlutterMetalRenderBackingStore* backingStore =
99
- (FlutterMetalRenderBackingStore*)[view backingStoreForSize: size];
98
+ FlutterRenderBackingStore* backingStore = [view backingStoreForSize: size];
100
99
id <MTLTexture > texture = backingStore.texture ;
101
100
FlutterMetalTexture embedderTexture;
102
101
embedderTexture.struct_size = sizeof (FlutterMetalTexture);
Original file line number Diff line number Diff line change 10
10
#import " flutter/shell/platform/darwin/macos/framework/Source/FlutterResizeSynchronizer.h"
11
11
12
12
/* *
13
- * Represents a buffer that can be resized .
13
+ * Provides resizable buffers backed by a MTLTexture .
14
14
*/
15
- @protocol FlutterResizableBackingStoreProvider <FlutterResizeSynchronizerDelegate>
15
+ @interface FlutterResizableBackingStoreProvider : NSObject <FlutterResizeSynchronizerDelegate>
16
16
17
+ /* *
18
+ * Creates a resizable backing store provider for the given CAMetalLayer.
19
+ */
20
+ - (nonnull instancetype )initWithDevice : (nonnull id <MTLDevice >)device
21
+ commandQueue : (nonnull id <MTLCommandQueue >)commandQueue
22
+ layer : (nonnull CALayer *)layer ;
17
23
/* *
18
24
* Notify of the required backing store size updates. Called during window resize.
19
25
*/
25
31
- (nonnull FlutterRenderBackingStore*)backingStore ;
26
32
27
33
@end
28
-
29
- /* *
30
- * Metal-backed FlutterResizableBackingStoreProvider. Backing store in this context implies a
31
- * MTLTexture.
32
- */
33
- @interface FlutterMetalResizableBackingStoreProvider
34
- : NSObject <FlutterResizableBackingStoreProvider>
35
-
36
- /* *
37
- * Creates a resizable backing store provider for the given CAMetalLayer.
38
- */
39
- - (nonnull instancetype )initWithDevice : (nonnull id <MTLDevice >)device
40
- commandQueue : (nonnull id <MTLCommandQueue >)commandQueue
41
- layer : (nonnull CALayer *)layer ;
42
-
43
- @end
Original file line number Diff line number Diff line change 8
8
9
9
#import " flutter/shell/platform/darwin/macos/framework/Source/FlutterSurfaceManager.h"
10
10
11
- @implementation FlutterMetalResizableBackingStoreProvider {
11
+ @implementation FlutterResizableBackingStoreProvider {
12
12
id <MTLDevice > _device;
13
13
id <MTLCommandQueue > _commandQueue;
14
14
FlutterSurfaceManager* _surfaceManager;
Original file line number Diff line number Diff line change @@ -143,7 +143,7 @@ - (void)cancelIdle {
143
143
- (nonnull FlutterRenderBackingStore*)renderBuffer {
144
144
[self ensureBackBuffer ];
145
145
id <MTLTexture > texture = _textures[kFlutterSurfaceManagerBackBuffer ];
146
- return [[FlutterMetalRenderBackingStore alloc ] initWithTexture: texture];
146
+ return [[FlutterRenderBackingStore alloc ] initWithTexture: texture];
147
147
}
148
148
149
149
- (id <MTLTexture >)createTextureForSurface : (FlutterIOSurfaceHolder*)surface size : (CGSize )size {
Original file line number Diff line number Diff line change @@ -43,8 +43,7 @@ - (instancetype)init {
43
43
FlutterSurfaceManager* surfaceManager = CreateSurfaceManager ();
44
44
CGSize size = CGSizeMake (100 , 50 );
45
45
[surfaceManager ensureSurfaceSize: size];
46
- id <MTLTexture > texture =
47
- (reinterpret_cast <FlutterMetalRenderBackingStore*>([surfaceManager renderBuffer ])).texture ;
46
+ id <MTLTexture > texture = [surfaceManager renderBuffer ].texture ;
48
47
CGSize textureSize = CGSizeMake (texture.width , texture.height );
49
48
ASSERT_TRUE (CGSizeEqualToSize (size, textureSize));
50
49
}
@@ -55,8 +54,7 @@ - (instancetype)init {
55
54
[surfaceManager ensureSurfaceSize: size];
56
55
[surfaceManager renderBuffer ]; // make sure we have back buffer
57
56
[surfaceManager swapBuffers ];
58
- id <MTLTexture > texture =
59
- (reinterpret_cast <FlutterMetalRenderBackingStore*>([surfaceManager renderBuffer ])).texture ;
57
+ id <MTLTexture > texture = [surfaceManager renderBuffer ].texture ;
60
58
CGSize textureSize = CGSizeMake (texture.width , texture.height );
61
59
ASSERT_TRUE (CGSizeEqualToSize (size, textureSize));
62
60
}
Original file line number Diff line number Diff line change 12
12
@interface FlutterView () {
13
13
__weak id <FlutterViewReshapeListener> _reshapeListener;
14
14
FlutterResizeSynchronizer* _resizeSynchronizer;
15
- id < FlutterResizableBackingStoreProvider> _resizableBackingStoreProvider;
15
+ FlutterResizableBackingStoreProvider* _resizableBackingStoreProvider;
16
16
}
17
17
18
18
@end
@@ -29,9 +29,9 @@ - (instancetype)initWithMTLDevice:(id<MTLDevice>)device
29
29
[self setLayerContentsRedrawPolicy: NSViewLayerContentsRedrawDuringViewResize];
30
30
_reshapeListener = reshapeListener;
31
31
_resizableBackingStoreProvider =
32
- [[FlutterMetalResizableBackingStoreProvider alloc ] initWithDevice: device
33
- commandQueue: commandQueue
34
- layer: self .layer];
32
+ [[FlutterResizableBackingStoreProvider alloc ] initWithDevice: device
33
+ commandQueue: commandQueue
34
+ layer: self .layer];
35
35
_resizeSynchronizer =
36
36
[[FlutterResizeSynchronizer alloc ] initWithDelegate: _resizableBackingStoreProvider];
37
37
}
You can’t perform that action at this time.
0 commit comments