Flutter iOS Embedder
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
ios_context_metal_skia.mm
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 #if !SLIMPELLER
6 
8 
9 #include "flutter/common/graphics/persistent_cache.h"
10 #include "flutter/fml/logging.h"
11 #import "flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalSkia.h"
13 #include "third_party/skia/include/gpu/ganesh/GrContextOptions.h"
14 
16 
17 namespace flutter {
18 
20  darwin_context_metal_ = [[FlutterDarwinContextMetalSkia alloc] initWithDefaultMTLDevice];
21 }
22 
24 
25 FlutterDarwinContextMetalSkia* IOSContextMetalSkia::GetDarwinContext() const {
26  return darwin_context_metal_;
27 }
28 
31 }
32 
33 sk_sp<GrDirectContext> IOSContextMetalSkia::GetMainContext() const {
34  return darwin_context_metal_.mainContext;
35 }
36 
37 sk_sp<GrDirectContext> IOSContextMetalSkia::GetResourceContext() const {
38  return darwin_context_metal_.resourceContext;
39 }
40 
41 // |IOSContext|
42 sk_sp<GrDirectContext> IOSContextMetalSkia::CreateResourceContext() {
43  return darwin_context_metal_.resourceContext;
44 }
45 
46 // |IOSContext|
47 std::unique_ptr<GLContextResult> IOSContextMetalSkia::MakeCurrent() {
48  // This only makes sense for context that need to be bound to a specific thread.
49  return std::make_unique<GLContextDefaultResult>(true);
50 }
51 
52 // |IOSContext|
53 std::unique_ptr<Texture> IOSContextMetalSkia::CreateExternalTexture(
54  int64_t texture_id,
55  NSObject<FlutterTexture>* texture) {
56  return std::make_unique<IOSExternalTextureMetal>(
57  [darwin_context_metal_ createExternalTextureWithIdentifier:texture_id texture:texture]);
58 }
59 
60 } // namespace flutter
61 
62 #endif // !SLIMPELLER
flutter::IOSRenderingBackend::kSkia
@ kSkia
flutter::IOSContextMetalSkia::GetDarwinContext
FlutterDarwinContextMetalSkia * GetDarwinContext() const
Definition: ios_context_metal_skia.mm:25
flutter::IOSContextMetalSkia::GetResourceContext
sk_sp< GrDirectContext > GetResourceContext() const
Definition: ios_context_metal_skia.mm:37
flutter::IOSContextMetalSkia::GetMainContext
sk_sp< GrDirectContext > GetMainContext() const override
Accessor for the Skia context associated with IOSSurfaces and the raster thread.
Definition: ios_context_metal_skia.mm:33
flutter::IOSContextMetalSkia::GetBackend
IOSRenderingBackend GetBackend() const override
Get the rendering backend used by this context.
Definition: ios_context_metal_skia.mm:29
ios_context_metal_skia.h
flutter::IOSRenderingBackend
IOSRenderingBackend
Definition: rendering_api_selection.h:19
flutter
Definition: accessibility_bridge.h:27
ios_external_texture_metal.h
flutter::IOSContextMetalSkia::IOSContextMetalSkia
IOSContextMetalSkia()
Definition: ios_context_metal_skia.mm:19
flutter::IOSContextMetalSkia::~IOSContextMetalSkia
~IOSContextMetalSkia()
texture_id
int64_t texture_id
Definition: texture_registrar_unittests.cc:24
FLUTTER_ASSERT_ARC
Definition: FlutterChannelKeyResponder.mm:13