This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
shell/platform/darwin/macos/framework/Source Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111 */
1212@interface FlutterRenderBackingStore : NSObject
1313
14- @end
15-
16- /* *
17- * Wraps a Metal texture.
18- */
19- @interface FlutterMetalRenderBackingStore : FlutterRenderBackingStore
20-
2114/* *
2215 * MTLTexture referenced by this backing store instance.
2316 */
Original file line number Diff line number Diff line change 55#import " flutter/shell/platform/darwin/macos/framework/Source/FlutterBackingStore.h"
66
77@implementation FlutterRenderBackingStore
8- @end
9-
10- @implementation FlutterMetalRenderBackingStore
118
129- (instancetype )initWithTexture : (id <MTLTexture >)texture {
1310 self = [super init ];
Original file line number Diff line number Diff line change 3737 StartFrame ();
3838 // If the backing store is for the first layer, return the MTLTexture for the
3939 // FlutterView.
40- FlutterMetalRenderBackingStore* backingStore =
41- reinterpret_cast <FlutterMetalRenderBackingStore*>([view backingStoreForSize: size]);
40+ FlutterRenderBackingStore* backingStore = [view backingStoreForSize: size];
4241 backing_store_out->metal .texture .texture =
4342 (__bridge FlutterMetalTextureHandle)backingStore.texture ;
4443 } else {
Original file line number Diff line number Diff line change @@ -43,8 +43,7 @@ - (nullable FlutterView*)getView:(uint64_t)viewId {
4343
4444id <FlutterViewProvider> MockViewProvider () {
4545 FlutterView* viewMock = OCMClassMock ([FlutterView class ]);
46- FlutterMetalRenderBackingStore* backingStoreMock =
47- OCMClassMock ([FlutterMetalRenderBackingStore class ]);
46+ FlutterRenderBackingStore* backingStoreMock = OCMClassMock ([FlutterRenderBackingStore class ]);
4847 __block id <MTLTexture > textureMock = OCMProtocolMock (@protocol (MTLTexture));
4948 OCMStub ([backingStoreMock texture ]).andReturn (textureMock);
5049
Original file line number Diff line number Diff line change @@ -95,8 +95,7 @@ - (FlutterMetalTexture)createTextureForView:(uint64_t)viewId size:(CGSize)size {
9595 // FlutterMetalTexture has texture `null`, therefore is discarded.
9696 return FlutterMetalTexture{};
9797 }
98- FlutterMetalRenderBackingStore* backingStore =
99- (FlutterMetalRenderBackingStore*)[view backingStoreForSize: size];
98+ FlutterRenderBackingStore* backingStore = [view backingStoreForSize: size];
10099 id <MTLTexture > texture = backingStore.texture ;
101100 FlutterMetalTexture embedderTexture;
102101 embedderTexture.struct_size = sizeof (FlutterMetalTexture);
Original file line number Diff line number Diff line change 1010#import " flutter/shell/platform/darwin/macos/framework/Source/FlutterResizeSynchronizer.h"
1111
1212/* *
13- * Represents a buffer that can be resized .
13+ * Provides resizable buffers backed by a MTLTexture .
1414 */
15- @protocol FlutterResizableBackingStoreProvider <FlutterResizeSynchronizerDelegate>
15+ @interface FlutterResizableBackingStoreProvider : NSObject <FlutterResizeSynchronizerDelegate>
1616
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 ;
1723/* *
1824 * Notify of the required backing store size updates. Called during window resize.
1925 */
2531- (nonnull FlutterRenderBackingStore*)backingStore ;
2632
2733@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 88
99#import " flutter/shell/platform/darwin/macos/framework/Source/FlutterSurfaceManager.h"
1010
11- @implementation FlutterMetalResizableBackingStoreProvider {
11+ @implementation FlutterResizableBackingStoreProvider {
1212 id <MTLDevice > _device;
1313 id <MTLCommandQueue > _commandQueue;
1414 FlutterSurfaceManager* _surfaceManager;
Original file line number Diff line number Diff line change @@ -143,7 +143,7 @@ - (void)cancelIdle {
143143- (nonnull FlutterRenderBackingStore*)renderBuffer {
144144 [self ensureBackBuffer ];
145145 id <MTLTexture > texture = _textures[kFlutterSurfaceManagerBackBuffer ];
146- return [[FlutterMetalRenderBackingStore alloc ] initWithTexture: texture];
146+ return [[FlutterRenderBackingStore alloc ] initWithTexture: texture];
147147}
148148
149149- (id <MTLTexture >)createTextureForSurface : (FlutterIOSurfaceHolder*)surface size : (CGSize)size {
Original file line number Diff line number Diff line change @@ -43,8 +43,7 @@ - (instancetype)init {
4343 FlutterSurfaceManager* surfaceManager = CreateSurfaceManager ();
4444 CGSize size = CGSizeMake (100 , 50 );
4545 [surfaceManager ensureSurfaceSize: size];
46- id <MTLTexture > texture =
47- (reinterpret_cast <FlutterMetalRenderBackingStore*>([surfaceManager renderBuffer ])).texture ;
46+ id <MTLTexture > texture = [surfaceManager renderBuffer ].texture ;
4847 CGSize textureSize = CGSizeMake (texture.width , texture.height );
4948 ASSERT_TRUE (CGSizeEqualToSize (size, textureSize));
5049}
@@ -55,8 +54,7 @@ - (instancetype)init {
5554 [surfaceManager ensureSurfaceSize: size];
5655 [surfaceManager renderBuffer ]; // make sure we have back buffer
5756 [surfaceManager swapBuffers ];
58- id <MTLTexture > texture =
59- (reinterpret_cast <FlutterMetalRenderBackingStore*>([surfaceManager renderBuffer ])).texture ;
57+ id <MTLTexture > texture = [surfaceManager renderBuffer ].texture ;
6058 CGSize textureSize = CGSizeMake (texture.width , texture.height );
6159 ASSERT_TRUE (CGSizeEqualToSize (size, textureSize));
6260}
Original file line number Diff line number Diff line change 1212@interface FlutterView () {
1313 __weak id <FlutterViewReshapeListener> _reshapeListener;
1414 FlutterResizeSynchronizer* _resizeSynchronizer;
15- id < FlutterResizableBackingStoreProvider> _resizableBackingStoreProvider;
15+ FlutterResizableBackingStoreProvider* _resizableBackingStoreProvider;
1616}
1717
1818@end
@@ -29,9 +29,9 @@ - (instancetype)initWithMTLDevice:(id<MTLDevice>)device
2929 [self setLayerContentsRedrawPolicy: NSViewLayerContentsRedrawDuringViewResize];
3030 _reshapeListener = reshapeListener;
3131 _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];
3535 _resizeSynchronizer =
3636 [[FlutterResizeSynchronizer alloc ] initWithDelegate: _resizableBackingStoreProvider];
3737 }
You can’t perform that action at this time.
0 commit comments