Flutter iOS Embedder
flutter::IOSSurface Class Referenceabstract

#include <ios_surface.h>

Inheritance diagram for flutter::IOSSurface:
flutter::IOSSurfaceMetalImpeller flutter::IOSSurfaceMetalSkia flutter::IOSSurfaceNoop flutter::IOSSurfaceSoftware

Public Member Functions

std::shared_ptr< IOSContextGetContext () const
 
virtual ~IOSSurface ()
 
virtual bool IsValid () const =0
 
virtual void UpdateStorageSizeIfNecessary ()=0
 
virtual std::unique_ptr< Surface > CreateGPUSurface (GrDirectContext *gr_context=nullptr)=0
 

Static Public Member Functions

static std::unique_ptr< IOSSurfaceCreate (std::shared_ptr< IOSContext > context, const fml::scoped_nsobject< CALayer > &layer)
 

Protected Member Functions

 IOSSurface (std::shared_ptr< IOSContext > ios_context)
 

Detailed Description

Definition at line 21 of file ios_surface.h.

Constructor & Destructor Documentation

◆ ~IOSSurface()

flutter::IOSSurface::~IOSSurface ( )
virtualdefault

◆ IOSSurface()

flutter::IOSSurface::IOSSurface ( std::shared_ptr< IOSContext ios_context)
explicitprotected

Definition at line 55 of file ios_surface.mm.

56  : ios_context_(std::move(ios_context)) {
57  FML_DCHECK(ios_context_);
58 }

Member Function Documentation

◆ Create()

std::unique_ptr< IOSSurface > flutter::IOSSurface::Create ( std::shared_ptr< IOSContext context,
const fml::scoped_nsobject< CALayer > &  layer 
)
static

Definition at line 19 of file ios_surface.mm.

20  {
21  FML_DCHECK(layer);
22  FML_DCHECK(context);
23 
24  if (@available(iOS METAL_IOS_VERSION_BASELINE, *)) {
25  if ([layer.get() isKindOfClass:[CAMetalLayer class]]) {
26  switch (context->GetBackend()) {
28 #if !SLIMPELLER
29  return std::make_unique<IOSSurfaceMetalSkia>(
30  fml::scoped_nsobject<CAMetalLayer>((CAMetalLayer*)layer.get()), // Metal layer
31  std::move(context) // context
32  );
33 #else // !SLIMPELLER
34  FML_LOG(FATAL) << "Impeller opt-out unavailable.";
35  return nullptr;
36 #endif // !SLIMPELLER
37  break;
39  return std::make_unique<IOSSurfaceMetalImpeller>(
40  fml::scoped_nsobject<CAMetalLayer>((CAMetalLayer*)layer.get()), // Metal layer
41  std::move(context) // context
42  );
43  }
44  }
45  }
46  if (context->GetBackend() == IOSRenderingBackend::kImpeller) {
47  return std::make_unique<IOSSurfaceNoop>(std::move(context));
48  }
49 
50  return std::make_unique<IOSSurfaceSoftware>(layer, // layer
51  std::move(context) // context
52  );
53 }

References flutter::kImpeller, flutter::kSkia, and METAL_IOS_VERSION_BASELINE.

Referenced by flutter::PlatformViewIOS::attachView(), and flutter::OverlayLayerPool::CreateLayer().

◆ CreateGPUSurface()

virtual std::unique_ptr<Surface> flutter::IOSSurface::CreateGPUSurface ( GrDirectContext *  gr_context = nullptr)
pure virtual

◆ GetContext()

std::shared_ptr< IOSContext > flutter::IOSSurface::GetContext ( ) const

Definition at line 62 of file ios_surface.mm.

62  {
63  return ios_context_;
64 }

Referenced by flutter::IOSSurfaceMetalSkia::IOSSurfaceMetalSkia().

◆ IsValid()

virtual bool flutter::IOSSurface::IsValid ( ) const
pure virtual

◆ UpdateStorageSizeIfNecessary()

virtual void flutter::IOSSurface::UpdateStorageSizeIfNecessary ( )
pure virtual

The documentation for this class was generated from the following files:
flutter::IOSRenderingBackend::kSkia
@ kSkia
flutter::IOSRenderingBackend::kImpeller
@ kImpeller
METAL_IOS_VERSION_BASELINE
#define METAL_IOS_VERSION_BASELINE
Definition: rendering_api_selection.h:40