Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
impeller::EntityPlayground Class Reference

#include <entity_playground.h>

Inheritance diagram for impeller::EntityPlayground:
impeller::PlaygroundTest impeller::Playground impeller::testing::GaussianBlurFilterContentsTest

Public Types

using EntityPlaygroundCallback = std::function< bool(ContentContext &context, RenderPass &pass)>
 
- Public Types inherited from impeller::Playground
using SinglePassCallback = std::function< bool(RenderPass &pass)>
 

Public Member Functions

 EntityPlayground ()
 
 ~EntityPlayground ()
 
void SetTypographerContext (std::shared_ptr< TypographerContext > typographer_context)
 
bool OpenPlaygroundHere (Entity entity)
 
bool OpenPlaygroundHere (EntityPass &entity_pass)
 
bool OpenPlaygroundHere (EntityPlaygroundCallback callback)
 
std::shared_ptr< ContentContextGetContentContext () const
 
- Public Member Functions inherited from impeller::PlaygroundTest
 PlaygroundTest ()
 
virtual ~PlaygroundTest ()
 
void SetUp () override
 
void TearDown () override
 
PlaygroundBackend GetBackend () const
 
std::unique_ptr< fml::MappingOpenAssetAsMapping (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, const PlaygroundSwitches &switches)
 
void SetupWindow ()
 
void TeardownWindow ()
 
bool IsPlaygroundEnabled () const
 
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.
 
std::shared_ptr< ContextGetContext () const
 
std::shared_ptr< ContextMakeContext () const
 
bool OpenPlaygroundHere (const Renderer::RenderCallback &render_callback)
 
bool OpenPlaygroundHere (SinglePassCallback pass_callback)
 
std::shared_ptr< TextureCreateTextureForFixture (const char *fixture_name, bool enable_mipmapping=false) const
 
std::shared_ptr< TextureCreateTextureCubeForFixture (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< CompressedImageLoadFixtureImageCompressed (std::shared_ptr< fml::Mapping > mapping)
 
static std::optional< DecompressedImageDecodeImageRGBA (const std::shared_ptr< CompressedImage > &compressed)
 
static std::shared_ptr< TextureCreateTextureForMapping (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 18 of file entity_playground.h.

Member Typedef Documentation

◆ EntityPlaygroundCallback

Definition at line 20 of file entity_playground.h.

Constructor & Destructor Documentation

◆ EntityPlayground()

impeller::EntityPlayground::EntityPlayground ( )

Definition at line 13 of file entity_playground.cc.

14 : typographer_context_(TypographerContextSkia::Make()) {}
static std::shared_ptr< TypographerContext > Make()

◆ ~EntityPlayground()

impeller::EntityPlayground::~EntityPlayground ( )
default

Member Function Documentation

◆ GetContentContext()

std::shared_ptr< ContentContext > impeller::EntityPlayground::GetContentContext ( ) const

Definition at line 45 of file entity_playground.cc.

45 {
46 return std::make_shared<ContentContext>(GetContext(), typographer_context_);
47}
std::shared_ptr< Context > GetContext() const
Definition playground.cc:89

◆ OpenPlaygroundHere() [1/3]

bool impeller::EntityPlayground::OpenPlaygroundHere ( Entity  entity)

Definition at line 49 of file entity_playground.cc.

49 {
51 return true;
52 }
53
54 auto content_context = GetContentContext();
55 if (!content_context->IsValid()) {
56 return false;
57 }
58 SinglePassCallback callback = [&](RenderPass& pass) -> bool {
59 content_context->GetRenderTargetCache()->Start();
60 bool result = entity.Render(*content_context, pass);
61 content_context->GetRenderTargetCache()->End();
62 content_context->GetTransientsBuffer().Reset();
63 return result;
64 };
66}
std::shared_ptr< ContentContext > GetContentContext() const
std::function< bool(RenderPass &pass)> SinglePassCallback
Definition playground.h:52
const PlaygroundSwitches switches_
Definition playground.h:120
bool OpenPlaygroundHere(const Renderer::RenderCallback &render_callback)
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
GAsyncResult * result

◆ OpenPlaygroundHere() [2/3]

bool impeller::EntityPlayground::OpenPlaygroundHere ( EntityPass entity_pass)

Definition at line 23 of file entity_playground.cc.

23 {
25 return true;
26 }
27
28 ContentContext content_context(GetContext(), typographer_context_);
29 if (!content_context.IsValid()) {
30 return false;
31 }
32
33 // Resolve any lingering tracked clips by assigning an arbitrarily high
34 // number. The number to assign just needs to be at least as high as larger
35 // any previously assigned clip depth in the scene. Normally, Aiks handles
36 // this correctly when wrapping up the base pass as an `impeller::Picture`.
37 entity_pass.PopAllClips(99999);
38
39 auto callback = [&](RenderTarget& render_target) -> bool {
40 return entity_pass.Render(content_context, render_target);
41 };
43}
SK_API sk_sp< SkSurface > RenderTarget(GrRecordingContext *context, skgpu::Budgeted budgeted, const SkImageInfo &imageInfo, int sampleCount, GrSurfaceOrigin surfaceOrigin, const SkSurfaceProps *surfaceProps, bool shouldCreateWithMips=false, bool isProtected=false)

◆ OpenPlaygroundHere() [3/3]

bool impeller::EntityPlayground::OpenPlaygroundHere ( EntityPlaygroundCallback  callback)

Definition at line 68 of file entity_playground.cc.

68 {
70 return true;
71 }
72
73 ContentContext content_context(GetContext(), typographer_context_);
74 if (!content_context.IsValid()) {
75 return false;
76 }
77 SinglePassCallback pass_callback = [&](RenderPass& pass) -> bool {
78 static bool wireframe = false;
79 if (ImGui::IsKeyPressed(ImGuiKey_Z)) {
80 wireframe = !wireframe;
81 content_context.SetWireframe(wireframe);
82 }
83 content_context.GetRenderTargetCache()->Start();
84 bool result = callback(content_context, pass);
85 content_context.GetRenderTargetCache()->End();
86 content_context.GetTransientsBuffer().Reset();
87 return result;
88 };
89 return Playground::OpenPlaygroundHere(pass_callback);
90}

◆ SetTypographerContext()

void impeller::EntityPlayground::SetTypographerContext ( std::shared_ptr< TypographerContext typographer_context)

Definition at line 18 of file entity_playground.cc.

19 {
20 typographer_context_ = std::move(typographer_context);
21}

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