| Flutter Impeller |

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
5 #include "impeller/aiks/aiks_context.h"
6
7 #include "impeller/aiks/picture.h"
8 #include "impeller/typographer/typographer_context.h"
9
10 namespace impeller {
11
12 AiksContext::AiksContext(
13 std::shared_ptr<Context> context,
14 std::shared_ptr<TypographerContext> typographer_context)
15 : context_(std::move(context)) {
16 if (!context_ || !context_->IsValid()) {
17 return;
18 }
19
20 content_context_ = std::make_unique<ContentContext>(
21 context_, std::move(typographer_context));
22 if (!content_context_->IsValid()) {
23 return;
24 }
25
26 is_valid_ = true;
27 }
28
29 AiksContext::~AiksContext() = default;
30
31 bool AiksContext::IsValid() const {
32 return is_valid_;
33 }
34
35 std::shared_ptr<Context> AiksContext::GetContext() const {
36 return context_;
37 }
38
39 ContentContext& AiksContext::GetContentContext() const {
40 return *content_context_;
41 }
42
43 bool AiksContext::Render(const Picture& picture, RenderTarget& render_target) {
44 if (!IsValid()) {
45 return false;
46 }
47
48 if (picture.pass) {
49 return picture.pass->Render(*content_context_, render_target);
50 }
51
52 return true;
53 }
54
55 } // namespace impeller
impeller::Picture::pass
std::unique_ptr< EntityPass > pass
Definition: picture.h:20
impeller::AiksContext::GetContentContext
ContentContext & GetContentContext() const
Definition: aiks_context.cc:39
impeller::AiksContext::~AiksContext
~AiksContext()
aiks_context.h
typographer_context.h
picture.h
impeller::AiksContext::AiksContext
AiksContext(std::shared_ptr< Context > context, std::shared_ptr< TypographerContext > typographer_context)
Definition: aiks_context.cc:12
impeller::Picture
Definition: picture.h:19
impeller::RenderTarget
Definition: render_target.h:48
impeller::AiksContext::GetContext
std::shared_ptr< Context > GetContext() const
Definition: aiks_context.cc:35
impeller::AiksContext::Render
bool Render(const Picture &picture, RenderTarget &render_target)
Definition: aiks_context.cc:43
std
Definition: comparable.h:98
impeller
Definition: aiks_context.cc:10
impeller::ContentContext
Definition: content_context.h:344
impeller::AiksContext::IsValid
bool IsValid() const
Definition: aiks_context.cc:31