Flutter Engine
The Flutter Engine
aiks_playground.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
7#include <memory>
8#include <optional>
9
14
15namespace impeller {
16
18 : typographer_context_(TypographerContextSkia::Make()) {}
19
21
23 std::shared_ptr<TypographerContext> typographer_context) {
24 typographer_context_ = std::move(typographer_context);
25}
26
29}
30
33 return true;
34 }
35
36 AiksContext renderer(GetContext(), typographer_context_);
37
38 if (!renderer.IsValid()) {
39 return false;
40 }
41
43 [&renderer, &picture](RenderTarget& render_target) -> bool {
44 return renderer.Render(picture, render_target, true);
45 });
46}
47
50 return true;
51 }
52
53 AiksContext renderer(GetContext(), typographer_context_);
54
55 if (!renderer.IsValid()) {
56 return false;
57 }
58
60 [&renderer, &callback](RenderTarget& render_target) -> bool {
61 std::optional<Picture> picture = callback(renderer);
62 if (!picture.has_value()) {
63 return false;
64 }
65 return renderer.Render(*picture, render_target, true);
66 });
67}
68
70 bool* p_open,
71 ImGuiWindowFlags flags) {
72 ImGui::Begin(name, p_open, flags);
73 return true;
74}
75
77 const sk_sp<flutter::DisplayList>& list) {
78 DlDispatcher dispatcher;
79 list->Dispatch(dispatcher);
81 return OpenPlaygroundHere(std::move(picture));
82}
83
86 AiksContext renderer(GetContext(), typographer_context_);
87
88 if (!renderer.IsValid()) {
89 return false;
90 }
91
93 [&renderer, &callback](RenderTarget& render_target) -> bool {
94 auto display_list = callback();
95 DlDispatcher dispatcher;
96 display_list->Dispatch(dispatcher);
98
99 return renderer.Render(picture, render_target, true);
100 });
101}
102
103} // namespace impeller
void Dispatch(DlOpReceiver &ctx) const
std::function< sk_sp< flutter::DisplayList >()> AiksDlPlaygroundCallback
void SetTypographerContext(std::shared_ptr< TypographerContext > typographer_context)
bool OpenPlaygroundHere(Picture picture)
static bool ImGuiBegin(const char *name, bool *p_open, ImGuiWindowFlags flags)
std::function< std::optional< Picture >(AiksContext &renderer)> AiksPlaygroundCallback
const PlaygroundSwitches switches_
Definition: playground.h:118
std::shared_ptr< Context > GetContext() const
Definition: playground.cc:90
bool OpenPlaygroundHere(const Renderer::RenderCallback &render_callback)
Definition: playground.cc:204
FlutterSemanticsFlag flags
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)
sk_sp< const SkPicture > picture
Definition: SkRecords.h:299
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32