| Flutter Impeller |

Public Types | 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
std::shared_ptr< RuntimeStage > | 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
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

## 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 Attributes inherited from impeller::Playground
const PlaygroundSwitches | switches_

## Detailed Description

Definition at line 16 of file aiks_playground.h.

## Member Typedef Documentation

## ◆ AiksPlaygroundCallback

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

Definition at line 19 of file aiks_playground.h.

## Constructor & Destructor Documentation

## ◆ AiksPlayground()

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

Definition at line 16 of file aiks_playground.cc.

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

## ◆ ~AiksPlayground()

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

## Member Function Documentation

## ◆ OpenPlaygroundHere() [1/2]

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

Definition at line 37 of file aiks_playground.cc.

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

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 31 of file aiks_playground.cc.

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

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 21 of file aiks_playground.cc.

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

## ◆ TearDown()

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

Definition at line 26 of file aiks_playground.cc.

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

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:91
impeller::AiksPlayground::OpenPlaygroundHere
bool OpenPlaygroundHere(Picture picture)
Definition: aiks_playground.cc:31
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:16
impeller::TypographerContextSkia::Make
static std::shared_ptr< TypographerContext > Make()
Definition: typographer_context_skia.cc:30