| Flutter Impeller |

aiks_context.h
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 #ifndef FLUTTER_IMPELLER_DISPLAY_LIST_AIKS_CONTEXT_H_
6 #define FLUTTER_IMPELLER_DISPLAY_LIST_AIKS_CONTEXT_H_
7
8 #include <memory>
9
10 #include "impeller/entity/contents/content_context.h"
11 #include "impeller/renderer/context.h"
12 #include "impeller/renderer/render_target.h"
13 #include "impeller/typographer/typographer_context.h"
14
15 namespace impeller {
16
17 struct Picture;
18
19 class AiksContext {
20 public:
21 /// Construct a new AiksContext.
22 ///
23 /// @param context The Impeller context that Aiks should use for
24 /// allocating resources and executing device
25 /// commands. Required.
26 /// @param typographer_context The text backend to use for rendering text. If
27 /// `nullptr` is supplied, then attempting to draw
28 /// text with Aiks will result in validation
29 /// errors.
30 /// @param render_target_allocator Injects a render target allocator or
31 /// allocates its own if none is supplied.
32 AiksContext(std::shared_ptr<Context> context,
33 std::shared_ptr<TypographerContext> typographer_context,
34 std::optional<std::shared_ptr<RenderTargetAllocator>>
35 render_target_allocator = std::nullopt);
36
37 ~AiksContext();
38
39 bool IsValid() const;
40
41 std::shared_ptr<Context> GetContext() const;
42
43 ContentContext& GetContentContext() const;
44
45 private:
46 std::shared_ptr<Context> context_;
47 std::unique_ptr<ContentContext> content_context_;
48 bool is_valid_ = false;
49
50 AiksContext(const AiksContext&) = delete;
51
52 AiksContext& operator=(const AiksContext&) = delete;
53 };
54
55 } // namespace impeller
56
57 #endif // FLUTTER_IMPELLER_DISPLAY_LIST_AIKS_CONTEXT_H_
impeller::AiksContext
Definition: aiks_context.h:19
impeller::AiksContext::GetContentContext
ContentContext & GetContentContext() const
Definition: aiks_context.cc:42
impeller::AiksContext::AiksContext
AiksContext(std::shared_ptr< Context > context, std::shared_ptr< TypographerContext > typographer_context, std::optional< std::shared_ptr< RenderTargetAllocator >> render_target_allocator=std::nullopt)
Definition: aiks_context.cc:11
impeller::AiksContext::~AiksContext
~AiksContext()
impeller::AiksContext::IsValid
bool IsValid() const
Definition: aiks_context.cc:34
impeller::AiksContext::GetContext
std::shared_ptr< Context > GetContext() const
Definition: aiks_context.cc:38
impeller::ContentContext
Definition: content_context.h:138
content_context.h
impeller
Definition: allocation.cc:12
render_target.h
context.h
typographer_context.h