Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
shell
platform
darwin
ios
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
#import "flutter/shell/platform/darwin/ios/ios_context_metal_skia.h"
6
7
#include "flutter/common/graphics/persistent_cache.h"
8
#include "flutter/fml/logging.h"
9
#import "flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalSkia.h"
10
#import "flutter/shell/platform/darwin/ios/ios_external_texture_metal.h"
11
#include "
third_party/skia/include/gpu/GrContextOptions.h
"
12
13
FLUTTER_ASSERT_ARC
14
15
namespace
flutter
{
16
17
IOSContextMetalSkia::IOSContextMetalSkia
(
MsaaSampleCount
msaa_samples) :
IOSContext
(msaa_samples) {
18
darwin_context_metal_ =
fml::scoped_nsobject<FlutterDarwinContextMetalSkia>
{
19
[[
FlutterDarwinContextMetalSkia
alloc] initWithDefaultMTLDevice]};
20
}
21
22
IOSContextMetalSkia::~IOSContextMetalSkia
() =
default
;
23
24
fml::scoped_nsobject<FlutterDarwinContextMetalSkia>
IOSContextMetalSkia::GetDarwinContext
()
const
{
25
return
darwin_context_metal_;
26
}
27
28
IOSRenderingBackend
IOSContextMetalSkia::GetBackend
()
const
{
29
return
IOSRenderingBackend::kSkia
;
30
}
31
32
sk_sp<GrDirectContext>
IOSContextMetalSkia::GetMainContext
()
const
{
33
return
darwin_context_metal_.
get
().mainContext;
34
}
35
36
sk_sp<GrDirectContext>
IOSContextMetalSkia::GetResourceContext
()
const
{
37
return
darwin_context_metal_.
get
().resourceContext;
38
}
39
40
// |IOSContext|
41
sk_sp<GrDirectContext>
IOSContextMetalSkia::CreateResourceContext
() {
42
return
darwin_context_metal_.
get
().resourceContext;
43
}
44
45
// |IOSContext|
46
std::unique_ptr<GLContextResult>
IOSContextMetalSkia::MakeCurrent
() {
47
// This only makes sense for context that need to be bound to a specific thread.
48
return
std::make_unique<GLContextDefaultResult>(
true
);
49
}
50
51
// |IOSContext|
52
std::unique_ptr<Texture>
IOSContextMetalSkia::CreateExternalTexture
(
53
int64_t
texture_id
,
54
fml::scoped_nsobject
<NSObject<FlutterTexture>>
texture
) {
55
return
std::make_unique<IOSExternalTextureMetal>(
56
fml::scoped_nsobject<FlutterDarwinExternalTextureMetal>
{
57
[darwin_context_metal_ createExternalTextureWithIdentifier:
texture_id
texture
:
texture
]});
58
}
59
60
}
// namespace flutter
GrContextOptions.h
flutter::IOSContextMetalSkia::IOSContextMetalSkia
IOSContextMetalSkia(MsaaSampleCount msaa_samples)
Definition
ios_context_metal_skia.mm:17
flutter::IOSContextMetalSkia::GetBackend
IOSRenderingBackend GetBackend() const override
Get the rendering backend used by this context.
Definition
ios_context_metal_skia.mm:28
flutter::IOSContextMetalSkia::~IOSContextMetalSkia
~IOSContextMetalSkia()
flutter::IOSContextMetalSkia::CreateResourceContext
sk_sp< GrDirectContext > CreateResourceContext() override
Create a resource context for use on the IO task runner. This resource context is used by Skia to upl...
Definition
ios_context_metal_skia.mm:41
flutter::IOSContextMetalSkia::MakeCurrent
std::unique_ptr< GLContextResult > MakeCurrent() override
When using client rendering APIs whose contexts need to be bound to a specific thread,...
Definition
ios_context_metal_skia.mm:46
flutter::IOSContextMetalSkia::GetResourceContext
sk_sp< GrDirectContext > GetResourceContext() const
Definition
ios_context_metal_skia.mm:36
flutter::IOSContextMetalSkia::CreateExternalTexture
std::unique_ptr< Texture > CreateExternalTexture(int64_t texture_id, fml::scoped_nsobject< NSObject< FlutterTexture > > texture) override
Creates an external texture proxy of the appropriate client rendering API.
Definition
ios_context_metal_skia.mm:52
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:32
flutter::IOSContextMetalSkia::GetDarwinContext
fml::scoped_nsobject< FlutterDarwinContextMetalSkia > GetDarwinContext() const
Definition
ios_context_metal_skia.mm:24
flutter::IOSContext
Manages the lifetime of the on-screen and off-screen rendering contexts on iOS. On-screen contexts ar...
Definition
ios_context.h:40
fml::ScopedTypeRef::get
T get() const __attribute((ns_returns_not_retained))
Definition
scoped_typeref.h:123
fml::scoped_nsobject
Definition
scoped_nsobject.h:152
sk_sp
Definition
SkRefCnt.h:220
FlutterDarwinContextMetalSkia
Definition
FlutterDarwinContextMetalSkia.h:22
texture
FlTexture * texture
Definition
mock_texture_registrar.cc:24
MsaaSampleCount
MsaaSampleCount
Definition
msaa_sample_count.h:9
FLUTTER_ASSERT_ARC
Definition
FlutterChannelKeyResponder.mm:13
flutter
Definition
asset_manager.cc:10
flutter::IOSRenderingBackend
IOSRenderingBackend
Definition
rendering_api_selection.h:19
flutter::IOSRenderingBackend::kSkia
@ kSkia
texture_id
int64_t texture_id
Definition
texture_registrar_unittests.cc:24
Generated on Fri Apr 26 2024 06:14:25 for Flutter Engine by
1.9.8