Flutter Engine
flutter::TestMetalSurface Class Reference

Creates a MTLTexture backed SkSurface and context that can be used to render to in unit-tests. More...

#include <test_metal_surface.h>

Inheritance diagram for flutter::TestMetalSurface:
flutter::TestMetalSurfaceImpl

Public Member Functions

virtual ~TestMetalSurface ()
 
virtual bool IsValid () const
 
virtual sk_sp< GrDirectContext > GetGrContext () const
 
virtual sk_sp< SkSurface > GetSurface () const
 
virtual sk_sp< SkImage > GetRasterSurfaceSnapshot ()
 
virtual TestMetalContext::TextureInfo GetTextureInfo ()
 

Static Public Member Functions

static bool PlatformSupportsMetal ()
 
static std::unique_ptr< TestMetalSurfaceCreate (const TestMetalContext &test_metal_context, SkISize surface_size=SkISize::MakeEmpty())
 
static std::unique_ptr< TestMetalSurfaceCreate (const TestMetalContext &test_metal_context, int64_t texture_id, SkISize surface_size=SkISize::MakeEmpty())
 

Protected Member Functions

 TestMetalSurface ()
 

Detailed Description

Creates a MTLTexture backed SkSurface and context that can be used to render to in unit-tests.

Definition at line 20 of file test_metal_surface.h.

Constructor & Destructor Documentation

◆ ~TestMetalSurface()

flutter::TestMetalSurface::~TestMetalSurface ( )
virtualdefault

Referenced by Create().

◆ TestMetalSurface()

flutter::TestMetalSurface::TestMetalSurface ( )
protecteddefault

Referenced by Create().

Member Function Documentation

◆ Create() [1/2]

std::unique_ptr< TestMetalSurface > flutter::TestMetalSurface::Create ( const TestMetalContext test_metal_context,
SkISize  surface_size = SkISize::MakeEmpty() 
)
static

Definition at line 16 of file test_metal_surface.cc.

Referenced by flutter::testing::TEST_F(), and flutter::testing::EmbedderTestContextMetal::~EmbedderTestContextMetal().

18  {
19  return std::make_unique<TestMetalSurfaceImpl>(test_metal_context,
20  surface_size);
21 }

◆ Create() [2/2]

std::unique_ptr< TestMetalSurface > flutter::TestMetalSurface::Create ( const TestMetalContext test_metal_context,
int64_t  texture_id,
SkISize  surface_size = SkISize::MakeEmpty() 
)
static

Definition at line 23 of file test_metal_surface.cc.

References TestMetalSurface(), texture_id, and ~TestMetalSurface().

26  {
27  return std::make_unique<TestMetalSurfaceImpl>(test_metal_context, texture_id,
28  surface_size);
29 }
int64_t texture_id

◆ GetGrContext()

sk_sp< GrDirectContext > flutter::TestMetalSurface::GetGrContext ( ) const
virtual

Definition at line 39 of file test_metal_surface.cc.

39  {
40  return impl_ ? impl_->GetGrContext() : nullptr;
41 }

◆ GetRasterSurfaceSnapshot()

sk_sp< SkImage > flutter::TestMetalSurface::GetRasterSurfaceSnapshot ( )
virtual

Definition at line 47 of file test_metal_surface.cc.

47  {
48  return impl_ ? impl_->GetRasterSurfaceSnapshot() : nullptr;
49 }

◆ GetSurface()

sk_sp< SkSurface > flutter::TestMetalSurface::GetSurface ( ) const
virtual

Definition at line 43 of file test_metal_surface.cc.

43  {
44  return impl_ ? impl_->GetSurface() : nullptr;
45 }

◆ GetTextureInfo()

TestMetalContext::TextureInfo flutter::TestMetalSurface::GetTextureInfo ( )
virtual

Definition at line 51 of file test_metal_surface.cc.

51  {
52  return impl_ ? impl_->GetTextureInfo() : TestMetalContext::TextureInfo();
53 }

◆ IsValid()

bool flutter::TestMetalSurface::IsValid ( ) const
virtual

Definition at line 35 of file test_metal_surface.cc.

35  {
36  return impl_ ? impl_->IsValid() : false;
37 }

◆ PlatformSupportsMetal()

bool flutter::TestMetalSurface::PlatformSupportsMetal ( )
static

Definition at line 12 of file test_metal_surface.cc.

12  {
13  return true;
14 }

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