| Flutter iOS Embedder |

ios_surface_metal_impeller.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_IMPELLER_H_
6 #define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_SURFACE_METAL_IMPELLER_H_
7
8 #include "flutter/fml/macros.h"
9 #include "flutter/shell/gpu/gpu_surface_metal_delegate.h"
10 #include "flutter/shell/platform/darwin/ios/ios_surface.h"
11
12 @class CAMetalLayer;
13
14 namespace impeller {
15 class Context;
16 } // namespace impeller
17
18 namespace flutter {
19
20 class SK_API_AVAILABLE_CA_METAL_LAYER IOSSurfaceMetalImpeller final
21 : public IOSSurface,
22 public GPUSurfaceMetalDelegate {
23 public:
24 IOSSurfaceMetalImpeller(const fml::scoped_nsobject<CAMetalLayer>& layer,
25 const std::shared_ptr<IOSContext>& context);
26
27 // |IOSSurface|
28 ~IOSSurfaceMetalImpeller();
29
30 private:
31 fml::scoped_nsobject<CAMetalLayer> layer_;
32 const std::shared_ptr<impeller::Context> impeller_context_;
33 std::shared_ptr<impeller::AiksContext> aiks_context_;
34 bool is_valid_ = false;
35
36 // |IOSSurface|
37 bool IsValid() const override;
38
39 // |IOSSurface|
40 void UpdateStorageSizeIfNecessary() override;
41
42 // |IOSSurface|
43 std::unique_ptr<Surface> CreateGPUSurface(GrDirectContext* gr_context) override;
44
45 // |GPUSurfaceMetalDelegate|
46 GPUCAMetalLayerHandle GetCAMetalLayer(const SkISize& frame_info) const override
47 __attribute__((cf_audited_transfer));
48
49 // |GPUSurfaceMetalDelegate|
50 bool PresentDrawable(GrMTLHandle drawable) const override __attribute__((cf_audited_transfer));
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(IOSSurfaceMetalImpeller);
64 };
65
66 } // namespace flutter
67
68 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_SURFACE_METAL_IMPELLER_H_
flutter::IOSSurface
Definition: ios_surface.h:21
flutter::IOSSurfaceMetalImpeller
Definition: ios_surface_metal_impeller.h:20
ios_surface.h
flutter
Definition: accessibility_bridge.h:28
impeller
Definition: ios_context.h:21