Flutter Engine
 
Loading...
Searching...
No Matches
ios_context_metal_impeller.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
6
7#include "flutter/impeller/entity/mtl/entity_shaders.h"
11
13
14namespace flutter {
15namespace {
16impeller::Flags SettingsToFlags(const Settings& settings) {
17 return impeller::Flags{
18 .antialiased_lines = settings.impeller_antialiased_lines,
19 };
20}
21} // namespace
22
24 const Settings& settings,
25 const std::shared_ptr<const fml::SyncSwitch>& is_gpu_disabled_sync_switch)
26 : darwin_context_metal_impeller_([[FlutterDarwinContextMetalImpeller alloc]
27 init:SettingsToFlags(settings)
28 gpuDisabledSyncSwitch:is_gpu_disabled_sync_switch]) {
29 if (darwin_context_metal_impeller_.context) {
30 aiks_context_ = std::make_shared<impeller::AiksContext>(
31 darwin_context_metal_impeller_.context, impeller::TypographerContextSkia::Make());
32 }
33}
34
35IOSContextMetalImpeller::~IOSContextMetalImpeller() = default;
36
37IOSRenderingBackend IOSContextMetalImpeller::GetBackend() const {
38 return IOSRenderingBackend::kImpeller;
39}
40
41// |IOSContext|
42std::shared_ptr<impeller::Context> IOSContextMetalImpeller::GetImpellerContext() const {
43 return darwin_context_metal_impeller_.context;
44}
45
46// |IOSContext|
47std::shared_ptr<impeller::AiksContext> IOSContextMetalImpeller::GetAiksContext() const {
48 return aiks_context_;
49}
50
51// |IOSContext|
52std::unique_ptr<Texture> IOSContextMetalImpeller::CreateExternalTexture(
53 int64_t texture_id,
54 NSObject<FlutterTexture>* texture) {
55 return std::make_unique<IOSExternalTextureMetal>([darwin_context_metal_impeller_
56 createExternalTextureWithIdentifier:texture_id
58}
59
60} // namespace flutter
IOSContextMetalImpeller(const Settings &settings, const std::shared_ptr< const fml::SyncSwitch > &is_gpu_disabled_sync_switch)
static std::shared_ptr< TypographerContext > Make()
FlTexture * texture
bool antialiased_lines
When turned on DrawLine will use the experimental antialiased path.
Definition flags.h:14
int64_t texture_id