Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
impeller::EntityPlayground Class Reference

#include <entity_playground.h>

Inheritance diagram for impeller::EntityPlayground:
impeller::PlaygroundTest impeller::Playground impeller::testing::BlendFilterContentsTest impeller::testing::GaussianBlurFilterContentsTest impeller::testing::MatrixFilterContentsTest impeller::testing::MorphologyFilterContentsTest

Public Types

using EntityPlaygroundCallback = std::function< bool(ContentContext &context, RenderPass &pass)>
 
- Public Types inherited from impeller::Playground
using SinglePassCallback = std::function< bool(RenderPass &pass)>
 
using RenderCallback = std::function< bool(RenderTarget &render_target)>
 
using GLProcAddressResolver = std::function< void *(const char *proc_name)>
 
using VKProcAddressResolver = std::function< void *(void *instance, const char *proc_name)>
 

Public Member Functions

 EntityPlayground ()
 
 ~EntityPlayground ()
 
bool OpenPlaygroundHere (Entity entity)
 
bool OpenPlaygroundHere (EntityPlaygroundCallback callback)
 
- 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
 
absl::StatusOr< RuntimeStage::MapOpenAssetAsRuntimeStage (const char *asset_name) const
 
std::string GetWindowTitle () const override
 
- Public Member Functions inherited from impeller::Playground
 Playground (PlaygroundBackend backend, const PlaygroundSwitches &switches)
 
virtual ~Playground ()
 
bool IsPlaygroundEnabled () const
 
Point GetCursorPosition () const
 
ISize GetWindowSize () const
 
IRect GetWindowBounds () 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
 
ContentContextGetContentContext () const
 
std::shared_ptr< TypographerContextGetTypographerContext () const
 
bool OpenPlaygroundHere (const 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
 Returns true if OpenPlaygroundHere will actually render anything.
 
GLProcAddressResolver CreateGLProcAddressResolver () const
 
VKProcAddressResolver CreateVKProcAddressResolver () const
 
void SetGPUDisabled (bool disabled) const
 Mark the GPU as unavilable.
 
RuntimeStageBackend GetRuntimeStageBackend () 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 TearDownContextData ()
 
virtual void EnsureContextIsUnique ()
 Make sure that when the context is later created that it will not be shared with any other playgrounds.
 
bool PlatformSupportsWideGamutTests () const
 Returns true if the platform can support wide gamuts.
 
virtual bool EnsureContextSupportsWideGamut ()
 Make sure that when the context is later created that it will support wide gamuts if the platform supports it. Returns whether the platform supports wide gamut.
 
virtual void EnsureContextSupportsAntialiasLines ()
 Make sure that when the context is later created that it will support the experimental AA lines flag.
 
const PlaygroundSwitchesGetSwitches () const
 Return an unmodifiable reference to the current switches. The switches might change at the start of a test as it has a brief opportunity to call any of the Ensure* methods that define the environment it expects, but should be stable by the time any subsequent methods that might perform work are called.
 
void SetTypographerContext (std::shared_ptr< TypographerContext > typographer_context)
 
void SetWindowSize (ISize size)
 

Detailed Description

Definition at line 16 of file entity_playground.h.

Member Typedef Documentation

◆ EntityPlaygroundCallback

Definition at line 18 of file entity_playground.h.

Constructor & Destructor Documentation

◆ EntityPlayground()

impeller::EntityPlayground::EntityPlayground ( )
default

◆ ~EntityPlayground()

impeller::EntityPlayground::~EntityPlayground ( )
default

Member Function Documentation

◆ OpenPlaygroundHere() [1/2]

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

Definition at line 17 of file entity_playground.cc.

17 {
18 if (!IsPlaygroundEnabled()) {
19 return true;
20 }
21
22 ContentContext& content_context = GetContentContext();
23 if (!content_context.IsValid()) {
24 return false;
25 }
26 SinglePassCallback callback = [&](RenderPass& pass) -> bool {
27 content_context.GetRenderTargetCache()->Start();
28 bool result = entity.Render(content_context, pass);
29 content_context.GetRenderTargetCache()->End();
30 content_context.GetTransientsDataBuffer().Reset();
31 content_context.GetTransientsIndexesBuffer().Reset();
32 return result;
33 };
35}
bool OpenPlaygroundHere(const RenderCallback &render_callback)
bool IsPlaygroundEnabled() const
std::function< bool(RenderPass &pass)> SinglePassCallback
Definition playground.h:39
ContentContext & GetContentContext() const
FlutterDesktopBinaryReply callback

References callback, impeller::Playground::GetContentContext(), impeller::ContentContext::GetRenderTargetCache(), impeller::ContentContext::GetTransientsDataBuffer(), impeller::ContentContext::GetTransientsIndexesBuffer(), impeller::Playground::IsPlaygroundEnabled(), impeller::ContentContext::IsValid(), impeller::Playground::OpenPlaygroundHere(), impeller::Entity::Render(), and impeller::HostBuffer::Reset().

◆ OpenPlaygroundHere() [2/2]

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

Definition at line 37 of file entity_playground.cc.

37 {
38 if (!IsPlaygroundEnabled()) {
39 return true;
40 }
41
42 ContentContext& content_context = GetContentContext();
43 if (!content_context.IsValid()) {
44 return false;
45 }
46 SinglePassCallback pass_callback = [&](RenderPass& pass) -> bool {
47 content_context.GetRenderTargetCache()->Start();
48 bool result = callback(content_context, pass);
49 content_context.GetRenderTargetCache()->End();
50 content_context.GetTransientsDataBuffer().Reset();
51 content_context.GetTransientsIndexesBuffer().Reset();
52 return result;
53 };
54 return Playground::OpenPlaygroundHere(pass_callback);
55}

References callback, impeller::Playground::GetContentContext(), impeller::ContentContext::GetRenderTargetCache(), impeller::ContentContext::GetTransientsDataBuffer(), impeller::ContentContext::GetTransientsIndexesBuffer(), impeller::Playground::IsPlaygroundEnabled(), impeller::ContentContext::IsValid(), impeller::Playground::OpenPlaygroundHere(), and impeller::HostBuffer::Reset().


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