| Flutter iOS Embedder |

ios_surface_metal_skia.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_IOS_IOS_SURFACE_METAL_SKIA_H_
6 #define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_SURFACE_METAL_SKIA_H_
7
8 #if !SLIMPELLER
9
10 #include "flutter/fml/macros.h"
11 #include "flutter/shell/gpu/gpu_surface_metal_delegate.h"
12 #import "flutter/shell/platform/darwin/ios/ios_surface.h"
13 #include "third_party/skia/include/gpu/ganesh/mtl/GrMtlTypes.h"
14
15 @class CAMetalLayer;
16
17 namespace flutter {
18
19 class SK_API_AVAILABLE_CA_METAL_LAYER IOSSurfaceMetalSkia final : public IOSSurface,
20 public GPUSurfaceMetalDelegate {
21 public:
22 IOSSurfaceMetalSkia(CAMetalLayer* layer, std::shared_ptr<IOSContext> context);
23
24 // |IOSSurface|
25 ~IOSSurfaceMetalSkia();
26
27 private:
28 CAMetalLayer* layer_;
29 id<MTLDevice> device_;
30 id<MTLCommandQueue> command_queue_;
31 bool is_valid_ = false;
32
33 // |IOSSurface|
34 bool IsValid() const override;
35
36 // |IOSSurface|
37 void UpdateStorageSizeIfNecessary() override;
38
39 // |IOSSurface|
40 std::unique_ptr<Surface> CreateGPUSurface(GrDirectContext* gr_context) override;
41
42 // |GPUSurfaceMetalDelegate|
43 GPUCAMetalLayerHandle GetCAMetalLayer(const SkISize& frame_info) const override
44 __attribute__((cf_audited_transfer));
45
46 // |GPUSurfaceMetalDelegate|
47 bool PresentDrawable(GrMTLHandle drawable) const override __attribute__((cf_audited_transfer));
48
49 // |GPUSurfaceMetalDelegate|
50 bool PreparePresent(GrMTLHandle drawable) const override;
51
52 // |GPUSurfaceMetalDelegate|
53 GPUMTLTextureInfo GetMTLTexture(const SkISize& frame_info) const override
54 __attribute__((cf_audited_transfer));
55
56 // |GPUSurfaceMetalDelegate|
57 bool PresentTexture(GPUMTLTextureInfo texture) const override
58 __attribute__((cf_audited_transfer));
59
60 // |GPUSurfaceMetalDelegate|
61 bool AllowsDrawingWhenGpuDisabled() const override;
62
63 FML_DISALLOW_COPY_AND_ASSIGN(IOSSurfaceMetalSkia);
64 };
65
66 } // namespace flutter
67
68 #endif // !SLIMPELLER
69
70 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_SURFACE_METAL_SKIA_H_
flutter::IOSSurface
Definition: ios_surface.h:20
ios_surface.h
flutter::IOSSurfaceMetalSkia
Definition: ios_surface_metal_skia.h:19
flutter
Definition: accessibility_bridge.h:27