| Flutter Impeller |

Public Types | Public Member Functions | List of all members
impeller::DlPlayground Class Reference

`#include <dl_playground.h>`

Inheritance diagram for impeller::DlPlayground:

## Public Types
using | DisplayListPlaygroundCallback = std::function< sk_sp< flutter::DisplayList >()>
Public Types inherited from impeller::Playground
using | SinglePassCallback = std::function< bool(RenderPass &pass)>

## Public Member Functions
| DlPlayground ()
| ~DlPlayground ()
bool | OpenPlaygroundHere (flutter::DisplayListBuilder &builder)
bool | OpenPlaygroundHere (sk_sp< flutter::DisplayList > list)
bool | OpenPlaygroundHere (DisplayListPlaygroundCallback callback)
SkFont | CreateTestFontOfSize (SkScalar scalar)
SkFont | CreateTestFont ()
Public Member Functions inherited from impeller::PlaygroundTest
| PlaygroundTest ()
virtual | ~PlaygroundTest ()
void | SetUp () override
void | TearDown () override
PlaygroundBackend | GetBackend () const
std::unique_ptr< fml::Mapping > | OpenAssetAsMapping (std::string asset_name) const override
RuntimeStage::Map | OpenAssetAsRuntimeStage (const char *asset_name) const
std::string | GetWindowTitle () const override
bool | BackendSupportsFragmentProgram () const
Public Member Functions inherited from impeller::Playground
| Playground (PlaygroundSwitches switches)
virtual | ~Playground ()
void | SetupContext (PlaygroundBackend backend)
void | SetupWindow ()
void | TeardownWindow ()
Point | GetCursorPosition () const
ISize | GetWindowSize () const
Point | GetContentScale () const
Scalar | GetSecondsElapsed () const
| Get the amount of time elapsed from the start of the playground's execution. More...
std::shared_ptr< Context > | GetContext () const
bool | OpenPlaygroundHere (const Renderer::RenderCallback &render_callback)
bool | OpenPlaygroundHere (SinglePassCallback pass_callback)
std::shared_ptr< Texture > | CreateTextureForFixture (const char *fixture_name, bool enable_mipmapping=false) const
std::shared_ptr< Texture > | CreateTextureCubeForFixture (std::array< const char *, 6 > fixture_names) const
fml::Status | SetCapabilities (const std::shared_ptr< Capabilities > &capabilities)
bool | WillRenderSomething () const

## Additional Inherited Members
Static Public Member Functions inherited from impeller::Playground
static bool | ShouldOpenNewPlaygrounds ()
static std::shared_ptr< CompressedImage > | LoadFixtureImageCompressed (std::shared_ptr< fml::Mapping > mapping)
static std::optional< DecompressedImage > | DecodeImageRGBA (const std::shared_ptr< CompressedImage > &compressed)
static std::shared_ptr< Texture > | CreateTextureForMapping (const std::shared_ptr< Context > &context, std::shared_ptr< fml::Mapping > mapping, bool enable_mipmapping=false)
static bool | SupportsBackend (PlaygroundBackend backend)
Protected Member Functions inherited from impeller::Playground
void | SetWindowSize (ISize size)
Protected Attributes inherited from impeller::Playground
const PlaygroundSwitches | switches_

## Detailed Description

Definition at line 15 of file dl_playground.h.

## Member Typedef Documentation

## ◆ DisplayListPlaygroundCallback

using impeller::DlPlayground::DisplayListPlaygroundCallback = std::function<sk_sp<flutter::DisplayList>()>

Definition at line 18 of file dl_playground.h.

## Constructor & Destructor Documentation

## ◆ DlPlayground()

impeller::DlPlayground::DlPlayground | ( |  | ) |
| default

## ◆ ~DlPlayground()

impeller::DlPlayground::~DlPlayground | ( |  | ) |
| default

## Member Function Documentation

## ◆ CreateTestFont()

SkFont impeller::DlPlayground::CreateTestFont | ( |  | ) |

Definition at line 66 of file dl_playground.cc.

66 {
67 return CreateTestFontOfSize(50);
68 }

References CreateTestFontOfSize().

## ◆ CreateTestFontOfSize()

SkFont impeller::DlPlayground::CreateTestFontOfSize | ( | SkScalar | scalar | ) |

Definition at line 58 of file dl_playground.cc.

58 {
59 static constexpr const char* kTestFontFixture = "Roboto-Regular.ttf";
60 auto mapping = flutter::testing::OpenFixtureAsSkData(kTestFontFixture);
61 FML_CHECK(mapping);
62 sk_sp<SkFontMgr> font_mgr = txt::GetDefaultFontManager();
63 return SkFont{font_mgr->makeFromData(mapping), scalar};
64 }

Referenced by CreateTestFont().

## ◆ OpenPlaygroundHere() [1/3]

bool impeller::DlPlayground::OpenPlaygroundHere | ( | DisplayListPlaygroundCallback | callback | ) |

Definition at line 31 of file dl_playground.cc.

31 {
32 if (!switches_.enable_playground) {
33 return true;
34 }
35
36 AiksContext context(GetContext(), TypographerContextSkia::Make());
37 if (!context.IsValid()) {
38 return false;
39 }
40 return Playground::OpenPlaygroundHere(
41 [&context, &callback](RenderTarget& render_target) -> bool {
42 static bool wireframe = false;
43 if (ImGui::IsKeyPressed(ImGuiKey_Z)) {
44 wireframe = !wireframe;
45 context.GetContentContext().SetWireframe(wireframe);
46 }
47
48 auto list = callback();
49
50 DlDispatcher dispatcher;
51 list->Dispatch(dispatcher);
52 auto picture = dispatcher.EndRecordingAsPicture();
53
54 return context.Render(picture, render_target);
55 });
56 }

References impeller::PlaygroundSwitches::enable_playground, impeller::DlDispatcher::EndRecordingAsPicture(), impeller::AiksContext::GetContentContext(), impeller::Playground::GetContext(), impeller::AiksContext::IsValid(), impeller::TypographerContextSkia::Make(), impeller::Playground::OpenPlaygroundHere(), impeller::AiksContext::Render(), and impeller::Playground::switches_.

## ◆ OpenPlaygroundHere() [2/3]

bool impeller::DlPlayground::OpenPlaygroundHere | ( | flutter::DisplayListBuilder & | builder | ) |

Definition at line 23 of file dl_playground.cc.

23 {
24 return OpenPlaygroundHere(builder.Build());
25 }

References OpenPlaygroundHere().

Referenced by OpenPlaygroundHere().

## ◆ OpenPlaygroundHere() [3/3]

bool impeller::DlPlayground::OpenPlaygroundHere | ( | sk_sp< flutter::DisplayList > | list | ) |

Definition at line 27 of file dl_playground.cc.

27 {
28 return OpenPlaygroundHere([&list]() { return list; });
29 }

References OpenPlaygroundHere().

The documentation for this class was generated from the following files:

- impeller/display_list/dl_playground.h
- impeller/display_list/dl_playground.cc

impeller::DlPlayground::OpenPlaygroundHere
bool OpenPlaygroundHere(flutter::DisplayListBuilder &builder)
Definition: dl_playground.cc:23
impeller::DlPlayground::CreateTestFontOfSize
SkFont CreateTestFontOfSize(SkScalar scalar)
Definition: dl_playground.cc:58
impeller::Playground::switches_
const PlaygroundSwitches switches_
Definition: playground.h:115
impeller::Playground::OpenPlaygroundHere
bool OpenPlaygroundHere(const Renderer::RenderCallback &render_callback)
Definition: playground.cc:189
impeller::Playground::GetContext
std::shared_ptr< Context > GetContext() const
Definition: playground.cc:86
impeller::PlaygroundSwitches::enable_playground
bool enable_playground
Definition: switches.h:17
impeller::TypographerContextSkia::Make
static std::shared_ptr< TypographerContext > Make()
Definition: typographer_context_skia.cc:30