Flutter Engine
gpu_surface_metal.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_GPU_GPU_SURFACE_METAL_H_
6 #define FLUTTER_SHELL_GPU_GPU_SURFACE_METAL_H_
7 
8 #include <Metal/Metal.h>
9 
10 #include "flutter/flow/surface.h"
11 #include "flutter/fml/macros.h"
12 #include "flutter/fml/platform/darwin/scoped_nsobject.h"
13 #include "flutter/shell/gpu/gpu_surface_delegate.h"
14 #include "third_party/skia/include/gpu/GrDirectContext.h"
15 #include "third_party/skia/include/gpu/mtl/GrMtlTypes.h"
16 
17 @class CAMetalLayer;
18 
19 namespace flutter {
20 
21 class SK_API_AVAILABLE_CA_METAL_LAYER GPUSurfaceMetal : public Surface {
22  public:
25  sk_sp<GrDirectContext> context,
26  fml::scoped_nsprotocol<id<MTLCommandQueue>> command_queue);
27 
28  // |Surface|
29  ~GPUSurfaceMetal() override;
30 
31  private:
34  sk_sp<GrDirectContext> context_;
36  GrMTLHandle next_drawable_ = nullptr;
37 
38  // |Surface|
39  bool IsValid() override;
40 
41  // |Surface|
42  std::unique_ptr<SurfaceFrame> AcquireFrame(const SkISize& size) override;
43 
44  // |Surface|
45  SkMatrix GetRootTransformation() const override;
46 
47  // |Surface|
48  GrDirectContext* GetContext() override;
49 
50  // |Surface|
51  flutter::ExternalViewEmbedder* GetExternalViewEmbedder() override;
52 
53  // |Surface|
54  std::unique_ptr<GLContextResult> MakeRenderContextCurrent() override;
55 
56  void ReleaseUnusedDrawableIfNecessary();
57 
59 };
60 
61 } // namespace flutter
62 
63 #endif // FLUTTER_SHELL_GPU_GPU_SURFACE_METAL_H_
constexpr std::size_t size(T(&array)[N])
Definition: size.h:13
MockDelegate delegate_
Abstract Base Class that represents where we will be rendering content.
Definition: surface.h:18
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition: macros.h:27