Flutter Engine
The Flutter Engine
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
14
15namespace impeller {
16
17struct Picture;
18
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
38
39 bool IsValid() const;
40
41 std::shared_ptr<Context> GetContext() const;
42
44
45 bool Render(const Picture& picture,
46 RenderTarget& render_target,
47 bool reset_host_buffer);
48
49 private:
50 std::shared_ptr<Context> context_;
51 std::unique_ptr<ContentContext> content_context_;
52 bool is_valid_ = false;
53
54 AiksContext(const AiksContext&) = delete;
55
56 AiksContext& operator=(const AiksContext&) = delete;
57};
58
59} // namespace impeller
60
61#endif // FLUTTER_IMPELLER_AIKS_AIKS_CONTEXT_H_
ContentContext & GetContentContext() const
Definition: aiks_context.cc:44
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:13
bool IsValid() const
Definition: aiks_context.cc:36
bool Render(const Picture &picture, RenderTarget &render_target, bool reset_host_buffer)
Definition: aiks_context.cc:48
std::shared_ptr< Context > GetContext() const
Definition: aiks_context.cc:40
sk_sp< const SkPicture > picture
Definition: SkRecords.h:299
SK_API sk_sp< PrecompileShader > Picture()