Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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_AIKS_AIKS_CONTEXT_H_
6#define FLUTTER_IMPELLER_AIKS_AIKS_CONTEXT_H_
7
8#include <memory>
9
10#include "flutter/fml/macros.h"
15
16namespace impeller {
17
18struct Picture;
19
21 public:
22 /// Construct a new AiksContext.
23 ///
24 /// @param context The Impeller context that Aiks should use for
25 /// allocating resources and executing device
26 /// commands. Required.
27 /// @param typographer_context The text backend to use for rendering text. If
28 /// `nullptr` is supplied, then attempting to draw
29 /// text with Aiks will result in validation
30 /// errors.
31 /// @param render_target_allocator Injects a render target allocator or
32 /// allocates its own if none is supplied.
33 AiksContext(std::shared_ptr<Context> context,
34 std::shared_ptr<TypographerContext> typographer_context,
35 std::optional<std::shared_ptr<RenderTargetAllocator>>
36 render_target_allocator = std::nullopt);
37
39
40 bool IsValid() const;
41
42 std::shared_ptr<Context> GetContext() const;
43
45
46 bool Render(const Picture& picture,
47 RenderTarget& render_target,
48 bool reset_host_buffer);
49
50 private:
51 std::shared_ptr<Context> context_;
52 std::unique_ptr<ContentContext> content_context_;
53 bool is_valid_ = false;
54
55 AiksContext(const AiksContext&) = delete;
56
57 AiksContext& operator=(const AiksContext&) = delete;
58};
59
60} // namespace impeller
61
62#endif // FLUTTER_IMPELLER_AIKS_AIKS_CONTEXT_H_
ContentContext & GetContentContext() const
bool Render(const Picture &picture, RenderTarget &render_target, bool reset_host_buffer)
std::shared_ptr< Context > GetContext() const
SK_API sk_sp< PrecompileShader > Picture()