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