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

#include <dl_playground.h>

Inheritance diagram for impeller::DlPlayground:
impeller::PlaygroundTest impeller::Playground

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::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 15 of file dl_playground.h.

Member Typedef Documentation

◆ DisplayListPlaygroundCallback

Definition at line 17 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 81 of file dl_playground.cc.

81 {
82 return CreateTestFontOfSize(50);
83}
SkFont CreateTestFontOfSize(SkScalar scalar)

◆ CreateTestFontOfSize()

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

Definition at line 73 of file dl_playground.cc.

73 {
74 static constexpr const char* kTestFontFixture = "Roboto-Regular.ttf";
75 auto mapping = flutter::testing::OpenFixtureAsSkData(kTestFontFixture);
76 FML_CHECK(mapping);
78 return SkFont{font_mgr->makeFromData(mapping), scalar};
79}
#define FML_CHECK(condition)
Definition logging.h:85
sk_sp< SkData > OpenFixtureAsSkData(const std::string &fixture_name)
Opens a fixture of the given file name and returns a Skia SkData holding its contents.
Definition testing.cc:64
sk_sp< SkFontMgr > GetDefaultFontManager(uint32_t font_initialization_data)
Definition platform.cc:17

◆ OpenPlaygroundHere() [1/3]

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

Definition at line 33 of file dl_playground.cc.

33 {
35 return true;
36 }
37
38 AiksContext context(GetContext(), TypographerContextSkia::Make());
39 if (!context.IsValid()) {
40 return false;
41 }
43 [&context, &callback](RenderTarget& render_target) -> bool {
44 static bool wireframe = false;
45 if (ImGui::IsKeyPressed(ImGuiKey_Z)) {
46 wireframe = !wireframe;
47 context.GetContentContext().SetWireframe(wireframe);
48 }
49
50 auto list = callback();
51
52#if ENABLE_EXPERIMENTAL_CANVAS
53 TextFrameDispatcher collector(context.GetContentContext(), Matrix());
54 list->Dispatch(collector);
55
56 ExperimentalDlDispatcher impeller_dispatcher(
57 context.GetContentContext(), render_target, IRect::MakeMaximum());
58 list->Dispatch(impeller_dispatcher);
59 impeller_dispatcher.FinishRecording();
60 context.GetContentContext().GetTransientsBuffer().Reset();
61 context.GetContentContext().GetLazyGlyphAtlas()->ResetTextFrames();
62 return true;
63#else
64 DlDispatcher dispatcher;
65 list->Dispatch(dispatcher);
66 auto picture = dispatcher.EndRecordingAsPicture();
67
68 return context.Render(picture, render_target, true);
69#endif
70 });
71}
const PlaygroundSwitches switches_
Definition playground.h:120
std::shared_ptr< Context > GetContext() const
Definition playground.cc:89
bool OpenPlaygroundHere(const Renderer::RenderCallback &render_callback)
static std::shared_ptr< TypographerContext > Make()
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
sk_sp< const SkPicture > picture
Definition SkRecords.h:299
static constexpr TRect MakeMaximum()
Definition rect.h:174

◆ OpenPlaygroundHere() [2/3]

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

Definition at line 25 of file dl_playground.cc.

25 {
26 return OpenPlaygroundHere(builder.Build());
27}
bool OpenPlaygroundHere(flutter::DisplayListBuilder &builder)

◆ OpenPlaygroundHere() [3/3]

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

Definition at line 29 of file dl_playground.cc.

29 {
30 return OpenPlaygroundHere([&list]() { return list; });
31}

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