Flutter Engine
 
Loading...
Searching...
No Matches
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
13
14namespace impeller {
15
17 : typographer_context_(TypographerContextSkia::Make()) {}
18
20
22 std::shared_ptr<TypographerContext> typographer_context) {
23 typographer_context_ = std::move(typographer_context);
24}
25
29
31 bool* p_open,
32 ImGuiWindowFlags flags) {
33 ImGui::Begin(name, p_open, flags);
34 return true;
35}
36
38 const sk_sp<flutter::DisplayList>& list) {
39 return OpenPlaygroundHere([list]() { return list; });
40}
41
44 AiksContext renderer(GetContext(), typographer_context_);
45
46 if (!renderer.IsValid()) {
47 return false;
48 }
49
51 [&renderer, &callback](RenderTarget& render_target) -> bool {
52 return RenderToTarget(
53 renderer.GetContentContext(), //
54 render_target, //
55 callback(), //
57 render_target.GetRenderTargetSize().height), //
58 /*reset_host_buffer=*/true, //
59 /*is_onscreen=*/false);
60 });
61}
62
63} // namespace impeller
ContentContext & GetContentContext() const
std::function< sk_sp< flutter::DisplayList >()> AiksDlPlaygroundCallback
bool OpenPlaygroundHere(const AiksDlPlaygroundCallback &callback)
void SetTypographerContext(std::shared_ptr< TypographerContext > typographer_context)
static bool ImGuiBegin(const char *name, bool *p_open, ImGuiWindowFlags flags)
bool OpenPlaygroundHere(const RenderCallback &render_callback)
std::shared_ptr< Context > GetContext() const
Definition playground.cc:91
ISize GetRenderTargetSize() const
FlutterDesktopBinaryReply callback
const char * name
Definition fuchsia.cc:49
bool RenderToTarget(ContentContext &context, RenderTarget render_target, const sk_sp< flutter::DisplayList > &display_list, Rect cull_rect, bool reset_host_buffer, bool is_onscreen)
Render the provided display list to the render target.
static constexpr TRect MakeWH(Type width, Type height)
Definition rect.h:140
Type height
Definition size.h:29
Type width
Definition size.h:28