Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
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 .use_sdfs = settings.impeller_use_sdfs,
20 };
21}
22} // namespace
23
25 const Settings& settings,
26 const std::shared_ptr<const fml::SyncSwitch>& is_gpu_disabled_sync_switch)
27 : darwin_context_metal_impeller_([[FlutterDarwinContextMetalImpeller alloc]
28 init:SettingsToFlags(settings)
29 gpuDisabledSyncSwitch:is_gpu_disabled_sync_switch]) {
30 if (darwin_context_metal_impeller_.context) {
31 aiks_context_ = std::make_shared<impeller::AiksContext>(
32 darwin_context_metal_impeller_.context, impeller::TypographerContextSkia::Make());
33 }
34}
35
36IOSContextMetalImpeller::~IOSContextMetalImpeller() = default;
37
38IOSRenderingBackend IOSContextMetalImpeller::GetBackend() const {
39 return IOSRenderingBackend::kImpeller;
40}
41
42// |IOSContext|
43std::shared_ptr<impeller::Context> IOSContextMetalImpeller::GetImpellerContext() const {
44 return darwin_context_metal_impeller_.context;
45}
46
47// |IOSContext|
48std::shared_ptr<impeller::AiksContext> IOSContextMetalImpeller::GetAiksContext() const {
49 return aiks_context_;
50}
51
52// |IOSContext|
53std::unique_ptr<Texture> IOSContextMetalImpeller::CreateExternalTexture(
54 int64_t texture_id,
55 NSObject<FlutterTexture>* texture) {
56 return std::make_unique<IOSExternalTextureMetal>([darwin_context_metal_impeller_
57 createExternalTextureWithIdentifier:texture_id
59}
60
61} // 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:11
int64_t texture_id