Flutter iOS Embedder
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
ios_context_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_CONTEXT_METAL_SKIA_H_
6 #define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_CONTEXT_METAL_SKIA_H_
7 
8 #if !SLIMPELLER
9 
10 #include <Metal/Metal.h>
11 
12 #include "flutter/fml/macros.h"
13 #include "flutter/fml/platform/darwin/cf_utils.h"
14 #import "flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalSkia.h"
16 #include "third_party/skia/include/gpu/ganesh/GrDirectContext.h"
17 
18 namespace flutter {
19 
20 class IOSContextMetalSkia final : public IOSContext {
21  public:
22  explicit IOSContextMetalSkia();
23 
25 
26  FlutterDarwinContextMetalSkia* GetDarwinContext() const;
27 
28  // |IOSContext|
29  IOSRenderingBackend GetBackend() const override;
30 
31  // |IOSContext|
32  sk_sp<GrDirectContext> GetMainContext() const override;
33 
34  sk_sp<GrDirectContext> GetResourceContext() const;
35 
36  private:
37  FlutterDarwinContextMetalSkia* darwin_context_metal_;
38 
39  // |IOSContext|
40  sk_sp<GrDirectContext> CreateResourceContext() override;
41 
42  // |IOSContext|
43  std::unique_ptr<GLContextResult> MakeCurrent() override;
44 
45  // |IOSContext|
46  std::unique_ptr<Texture> CreateExternalTexture(int64_t texture_id,
47  NSObject<FlutterTexture>* texture) override;
48 
49  FML_DISALLOW_COPY_AND_ASSIGN(IOSContextMetalSkia);
50 };
51 
52 } // namespace flutter
53 
54 #endif // !SLIMPELLER
55 
56 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_CONTEXT_METAL_SKIA_H_
Manages the lifetime of the on-screen and off-screen rendering contexts on iOS. On-screen contexts ar...
Definition: ios_context.h:39
IOSRenderingBackend GetBackend() const override
Get the rendering backend used by this context.
sk_sp< GrDirectContext > GetResourceContext() const
FlutterDarwinContextMetalSkia * GetDarwinContext() const
sk_sp< GrDirectContext > GetMainContext() const override
Accessor for the Skia context associated with IOSSurfaces and the raster thread.
int64_t texture_id