| Flutter Impeller |

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

`#include <aiks_playground.h>`

Inheritance diagram for impeller::AiksPlayground:

## Public Types
using | AiksPlaygroundCallback = std::function< std::optional< Picture >(AiksContext &renderer)>
Public Types inherited from impeller::Playground
using | SinglePassCallback = std::function< bool(RenderPass &pass)>

## Public Member Functions
| AiksPlayground ()
| ~AiksPlayground ()
void | TearDown () override
void | SetTypographerContext (std::shared_ptr< TypographerContext > typographer_context)
bool | OpenPlaygroundHere (Picture picture)
bool | OpenPlaygroundHere (AiksPlaygroundCallback callback)
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
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
std::shared_ptr< Context > | MakeContext () 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

## Static Public Member Functions
static bool | ImGuiBegin (const char *name, bool *p_open, ImGuiWindowFlags flags)
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)

## Additional Inherited Members
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 18 of file aiks_playground.h.

## Member Typedef Documentation

## ◆ AiksPlaygroundCallback

using impeller::AiksPlayground::AiksPlaygroundCallback = std::function<std::optional<Picture>(AiksContext& renderer)>

Definition at line 21 of file aiks_playground.h.

## Constructor & Destructor Documentation

## ◆ AiksPlayground()

impeller::AiksPlayground::AiksPlayground | ( |  | ) |

Definition at line 15 of file aiks_playground.cc.

16 : typographer_context_(TypographerContextSkia::Make()) {}

## ◆ ~AiksPlayground()

impeller::AiksPlayground::~AiksPlayground | ( |  | ) |
| default

## Member Function Documentation

## ◆ ImGuiBegin()

bool impeller::AiksPlayground::ImGuiBegin | ( | const char * | name,
|  | bool * | p_open,
|  | ImGuiWindowFlags | flags
| ) |  |
| static

Definition at line 59 of file aiks_playground.cc.

61 {
62 ImGui::Begin(name, p_open, flags);
63 return true;
64 }

Referenced by impeller::testing::TEST_P().

## ◆ OpenPlaygroundHere() [1/2]

bool impeller::AiksPlayground::OpenPlaygroundHere | ( | AiksPlaygroundCallback | callback | ) |

Definition at line 36 of file aiks_playground.cc.

36 {
37 if (!switches_.enable_playground) {
38 return true;
39 }
40
41 AiksContext renderer(GetContext(), typographer_context_);
42
43 if (!renderer.IsValid()) {
44 return false;
45 }
46
47 return Playground::OpenPlaygroundHere(
48 [this, &renderer, &callback](RenderTarget& render_target) -> bool {
49 const std::optional<Picture>& picture = inspector_.RenderInspector(
50 renderer, [&]() { return callback(renderer); });
51
52 if (!picture.has_value()) {
53 return false;
54 }
55 return renderer.Render(*picture, render_target, true);
56 });
57 }

References impeller::PlaygroundSwitches::enable_playground, impeller::Playground::GetContext(), impeller::AiksContext::IsValid(), impeller::Playground::OpenPlaygroundHere(), impeller::AiksContext::Render(), impeller::AiksInspector::RenderInspector(), and impeller::Playground::switches_.

## ◆ OpenPlaygroundHere() [2/2]

bool impeller::AiksPlayground::OpenPlaygroundHere | ( | Picture | picture | ) |

Definition at line 30 of file aiks_playground.cc.

30 {
31 return OpenPlaygroundHere([&picture](AiksContext& renderer) -> Picture {
32 return std::move(picture);
33 });
34 }

Referenced by impeller::testing::CanRenderConicalGradientWithDithering(), impeller::testing::CanRenderLinearGradientWithDithering(), impeller::testing::CanRenderRadialGradientWithDithering(), and impeller::testing::CanRenderSweepGradientWithDithering().

## ◆ SetTypographerContext()

void impeller::AiksPlayground::SetTypographerContext | ( | std::shared_ptr< TypographerContext > | typographer_context | ) |

Definition at line 20 of file aiks_playground.cc.

21 {
22 typographer_context_ = std::move(typographer_context);
23 }

## ◆ TearDown()

void impeller::AiksPlayground::TearDown | ( |  | ) |
| override

Definition at line 25 of file aiks_playground.cc.

25 {
26 inspector_.HackResetDueToTextureLeaks();
27 PlaygroundTest::TearDown();
28 }

References impeller::AiksInspector::HackResetDueToTextureLeaks(), and impeller::PlaygroundTest::TearDown().

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

- impeller/aiks/aiks_playground.h
- impeller/aiks/aiks_playground.cc

impeller::AiksInspector::RenderInspector
const std::optional< Picture > & RenderInspector(AiksContext &aiks_context, const std::function< std::optional< Picture >()> &picture_callback)
Definition: aiks_playground_inspector.cc:25
impeller::AiksInspector::HackResetDueToTextureLeaks
void HackResetDueToTextureLeaks()
Definition: aiks_playground_inspector.cc:66
impeller::PlaygroundTest::TearDown
void TearDown() override
Definition: playground_test.cc:39
impeller::Playground::switches_
const PlaygroundSwitches switches_
Definition: playground.h:117
impeller::AiksPlayground::OpenPlaygroundHere
bool OpenPlaygroundHere(Picture picture)
Definition: aiks_playground.cc:30
impeller::Playground::OpenPlaygroundHere
bool OpenPlaygroundHere(const Renderer::RenderCallback &render_callback)
Definition: playground.cc:198
impeller::Playground::GetContext
std::shared_ptr< Context > GetContext() const
Definition: playground.cc:89
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:32