Flutter Engine
 
Loading...
Searching...
No Matches
aiks_context.cc
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
8
9namespace impeller {
10
12 std::shared_ptr<Context> context,
13 std::shared_ptr<TypographerContext> typographer_context,
14 std::optional<std::shared_ptr<RenderTargetAllocator>>
15 render_target_allocator)
16 : context_(std::move(context)) {
17 if (!context_ || !context_->IsValid()) {
18 return;
19 }
20
21 content_context_ = std::make_unique<ContentContext>(
22 context_, std::move(typographer_context),
23 render_target_allocator.has_value() ? render_target_allocator.value()
24 : nullptr);
25 if (!content_context_->IsValid()) {
26 return;
27 }
28
29 is_valid_ = true;
30}
31
33
35 return is_valid_;
36}
37
38std::shared_ptr<Context> AiksContext::GetContext() const {
39 return context_;
40}
41
43 return *content_context_;
44}
45
46} // namespace impeller
ContentContext & GetContentContext() const
AiksContext(std::shared_ptr< Context > context, std::shared_ptr< TypographerContext > typographer_context, std::optional< std::shared_ptr< RenderTargetAllocator > > render_target_allocator=std::nullopt)
std::shared_ptr< Context > GetContext() const
Definition ref_ptr.h:261