Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
flutter::testing::DlMetalSurfaceProvider Class Reference

#include <dl_test_surface_metal.h>

Inheritance diagram for flutter::testing::DlMetalSurfaceProvider:
flutter::testing::DlSurfaceProvider

Public Member Functions

 DlMetalSurfaceProvider ()
 
virtual ~DlMetalSurfaceProvider ()=default
 
bool InitializeSurface (size_t width, size_t height, PixelFormat format) override
 
std::shared_ptr< DlSurfaceInstanceGetPrimarySurface () const override
 
std::shared_ptr< DlSurfaceInstanceMakeOffscreenSurface (size_t width, size_t height, PixelFormat format) const override
 
const std::string backend_name () const override
 
BackendType backend_type () const override
 
bool supports (PixelFormat format) const override
 
bool supports_impeller () const override
 
sk_sp< DlPixelDataImpellerSnapshot (const sk_sp< DisplayList > &list, int width, int height) const override
 
virtual sk_sp< DlImageMakeImpellerImage (const sk_sp< DisplayList > &list, int width, int height) const override
 
- Public Member Functions inherited from flutter::testing::DlSurfaceProvider
virtual ~DlSurfaceProvider ()=default
 
virtual bool Snapshot (std::string &filename) const
 

Additional Inherited Members

- Public Types inherited from flutter::testing::DlSurfaceProvider
enum  PixelFormat { kN32PremulPixelFormat , k565PixelFormat }
 
enum  BackendType { kSoftwareBackend , kOpenGlBackend , kMetalBackend }
 
- Static Public Member Functions inherited from flutter::testing::DlSurfaceProvider
static SkImageInfo MakeInfo (PixelFormat format, int w, int h)
 
static std::string BackendName (BackendType type)
 
static std::unique_ptr< DlSurfaceProviderCreate (BackendType backend_type)
 
- Protected Member Functions inherited from flutter::testing::DlSurfaceProvider
 DlSurfaceProvider ()=default
 

Detailed Description

Definition at line 18 of file dl_test_surface_metal.h.

Constructor & Destructor Documentation

◆ DlMetalSurfaceProvider()

flutter::testing::DlMetalSurfaceProvider::DlMetalSurfaceProvider ( )
inlineexplicit

Definition at line 20 of file dl_test_surface_metal.h.

◆ ~DlMetalSurfaceProvider()

virtual flutter::testing::DlMetalSurfaceProvider::~DlMetalSurfaceProvider ( )
virtualdefault

Member Function Documentation

◆ backend_name()

const std::string flutter::testing::DlMetalSurfaceProvider::backend_name ( ) const
inlineoverridevirtual

Implements flutter::testing::DlSurfaceProvider.

Definition at line 31 of file dl_test_surface_metal.h.

31{ return "Metal"; }

◆ backend_type()

BackendType flutter::testing::DlMetalSurfaceProvider::backend_type ( ) const
inlineoverridevirtual

◆ GetPrimarySurface()

std::shared_ptr< DlSurfaceInstance > flutter::testing::DlMetalSurfaceProvider::GetPrimarySurface ( ) const
overridevirtual

Implements flutter::testing::DlSurfaceProvider.

Definition at line 42 of file dl_test_surface_metal.cc.

43 {
44 if (!metal_surface_) {
45 return nullptr;
46 }
47 return metal_surface_;
48}

◆ ImpellerSnapshot()

sk_sp< DlPixelData > flutter::testing::DlMetalSurfaceProvider::ImpellerSnapshot ( const sk_sp< DisplayList > &  list,
int  width,
int  height 
) const
overridevirtual

Reimplemented from flutter::testing::DlSurfaceProvider.

Definition at line 86 of file dl_test_surface_metal.cc.

89 {
90 InitScreenShotter();
91 impeller::DlDispatcher dispatcher;
94 list->Dispatch(dispatcher);
95 auto picture = dispatcher.EndRecordingAsPicture();
96 return sk_make_sp<DlMetalPixelData>(snapshotter_->MakeScreenshot(
97 *aiks_context_, picture, {width, height}, false));
98}
void drawColor(flutter::DlColor color, flutter::DlBlendMode mode) override
sk_sp< const SkPicture > picture
Definition SkRecords.h:299
static constexpr DlColor kTransparent()
Definition dl_color.h:21

◆ InitializeSurface()

bool flutter::testing::DlMetalSurfaceProvider::InitializeSurface ( size_t  width,
size_t  height,
PixelFormat  format 
)
overridevirtual

Implements flutter::testing::DlSurfaceProvider.

Definition at line 31 of file dl_test_surface_metal.cc.

33 {
35 return false;
36 }
37 metal_context_ = std::make_unique<TestMetalContext>();
38 metal_surface_ = MakeOffscreenSurface(width, height, format);
39 return true;
40}
std::shared_ptr< DlSurfaceInstance > MakeOffscreenSurface(size_t width, size_t height, PixelFormat format) const override
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets Path to the Flutter assets directory enable service port Allow the VM service to fallback to automatic port selection if binding to a specified port fails trace Trace early application lifecycle Automatically switches to an endless trace buffer trace skia Filters out all Skia trace event categories except those that are specified in this comma separated list dump skp on shader Automatically dump the skp that triggers new shader compilations This is useful for writing custom ShaderWarmUp to reduce jank By this is not enabled to reduce the overhead purge persistent Remove all existing persistent cache This is mainly for debugging purposes such as reproducing the shader compilation jank trace to Write the timeline trace to a file at the specified path The file will be in Perfetto s proto format
Definition switches.h:203
int32_t height
int32_t width

◆ MakeImpellerImage()

sk_sp< DlImage > flutter::testing::DlMetalSurfaceProvider::MakeImpellerImage ( const sk_sp< DisplayList > &  list,
int  width,
int  height 
) const
overridevirtual

Reimplemented from flutter::testing::DlSurfaceProvider.

Definition at line 100 of file dl_test_surface_metal.cc.

103 {
104 InitScreenShotter();
105 impeller::DlDispatcher dispatcher;
108 list->Dispatch(dispatcher);
109 auto picture = dispatcher.EndRecordingAsPicture();
110 std::shared_ptr<impeller::Image> image =
111 picture.ToImage(*aiks_context_, {width, height});
112 std::shared_ptr<impeller::Texture> texture = image->GetTexture();
114}
static sk_sp< DlImageImpeller > Make(std::shared_ptr< Texture > texture, OwningContext owning_context=OwningContext::kIO)
sk_sp< SkImage > image
Definition examples.cpp:29
FlTexture * texture

◆ MakeOffscreenSurface()

std::shared_ptr< DlSurfaceInstance > flutter::testing::DlMetalSurfaceProvider::MakeOffscreenSurface ( size_t  width,
size_t  height,
PixelFormat  format 
) const
overridevirtual

Implements flutter::testing::DlSurfaceProvider.

Definition at line 50 of file dl_test_surface_metal.cc.

53 {
54 auto surface =
56 surface->GetSurface()->getCanvas()->clear(SK_ColorTRANSPARENT);
57 return std::make_shared<DlMetalSurfaceInstance>(std::move(surface));
58}
constexpr SkColor SK_ColorTRANSPARENT
Definition SkColor.h:99
static std::unique_ptr< TestMetalSurface > Create(const TestMetalContext &test_metal_context, SkISize surface_size=SkISize::MakeEmpty())
VkSurfaceKHR surface
Definition main.cc:49
static constexpr SkISize Make(int32_t w, int32_t h)
Definition SkSize.h:20

◆ supports()

bool flutter::testing::DlMetalSurfaceProvider::supports ( PixelFormat  format) const
inlineoverridevirtual

Implements flutter::testing::DlSurfaceProvider.

Definition at line 33 of file dl_test_surface_metal.h.

33 {
35 }

◆ supports_impeller()

bool flutter::testing::DlMetalSurfaceProvider::supports_impeller ( ) const
inlineoverridevirtual

Reimplemented from flutter::testing::DlSurfaceProvider.

Definition at line 36 of file dl_test_surface_metal.h.

36{ return true; }

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