Flutter Impeller
impeller::PlaygroundImpl Class Referenceabstract

#include <playground_impl.h>

Inheritance diagram for impeller::PlaygroundImpl:
impeller::PlaygroundImplGLES impeller::PlaygroundImplMTL impeller::PlaygroundImplVK

Public Types

using WindowHandle = void *
 

Public Member Functions

virtual ~PlaygroundImpl ()
 
virtual WindowHandle GetWindowHandle () const =0
 
virtual std::shared_ptr< ContextGetContext () const =0
 
virtual std::unique_ptr< SurfaceAcquireSurfaceFrame (std::shared_ptr< Context > context)=0
 
Vector2 GetContentScale () const
 

Static Public Member Functions

static std::unique_ptr< PlaygroundImplCreate (PlaygroundBackend backend, PlaygroundSwitches switches)
 

Protected Member Functions

 PlaygroundImpl (PlaygroundSwitches switches)
 

Protected Attributes

const PlaygroundSwitches switches_
 

Detailed Description

Definition at line 17 of file playground_impl.h.

Member Typedef Documentation

◆ WindowHandle

Definition at line 24 of file playground_impl.h.

Constructor & Destructor Documentation

◆ ~PlaygroundImpl()

impeller::PlaygroundImpl::~PlaygroundImpl ( )
virtualdefault

◆ PlaygroundImpl()

impeller::PlaygroundImpl::PlaygroundImpl ( PlaygroundSwitches  switches)
explicitprotected

Definition at line 48 of file playground_impl.cc.

49  : switches_(switches) {}

Member Function Documentation

◆ AcquireSurfaceFrame()

virtual std::unique_ptr<Surface> impeller::PlaygroundImpl::AcquireSurfaceFrame ( std::shared_ptr< Context context)
pure virtual

◆ Create()

std::unique_ptr< PlaygroundImpl > impeller::PlaygroundImpl::Create ( PlaygroundBackend  backend,
PlaygroundSwitches  switches 
)
static

Definition at line 24 of file playground_impl.cc.

26  {
27  switch (backend) {
28 #if IMPELLER_ENABLE_METAL
30  return std::make_unique<PlaygroundImplMTL>(switches);
31 #endif // IMPELLER_ENABLE_METAL
32 #if IMPELLER_ENABLE_OPENGLES
34  return std::make_unique<PlaygroundImplGLES>(switches);
35 #endif // IMPELLER_ENABLE_OPENGLES
36 #if IMPELLER_ENABLE_VULKAN
38  return std::make_unique<PlaygroundImplVK>(switches);
39 #endif // IMPELLER_ENABLE_VULKAN
40  default:
41  FML_CHECK(false) << "Attempted to create playground with backend that "
42  "isn't available or was disabled on this platform: "
43  << PlaygroundBackendToString(backend);
44  }
45  FML_UNREACHABLE();
46 }

References impeller::kMetal, impeller::kOpenGLES, impeller::kVulkan, and impeller::PlaygroundBackendToString().

Referenced by impeller::testing::MetalScreenshoter::MetalScreenshoter(), and impeller::Playground::SetupContext().

◆ GetContentScale()

Vector2 impeller::PlaygroundImpl::GetContentScale ( ) const

Definition at line 53 of file playground_impl.cc.

53  {
54  auto window = reinterpret_cast<GLFWwindow*>(GetWindowHandle());
55 
56  Vector2 scale(1, 1);
57  ::glfwGetWindowContentScale(window, &scale.x, &scale.y);
58 
59  return scale;
60 }

References GetWindowHandle(), impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

◆ GetContext()

virtual std::shared_ptr<Context> impeller::PlaygroundImpl::GetContext ( ) const
pure virtual

◆ GetWindowHandle()

virtual WindowHandle impeller::PlaygroundImpl::GetWindowHandle ( ) const
pure virtual

Referenced by GetContentScale().

Member Data Documentation

◆ switches_

const PlaygroundSwitches impeller::PlaygroundImpl::switches_
protected

Definition at line 36 of file playground_impl.h.

Referenced by impeller::PlaygroundImplVK::PlaygroundImplVK().


The documentation for this class was generated from the following files:
impeller::PlaygroundBackend::kVulkan
@ kVulkan
impeller::PlaygroundBackend::kMetal
@ kMetal
impeller::PlaygroundBackendToString
std::string PlaygroundBackendToString(PlaygroundBackend backend)
Definition: playground.cc:39
impeller::Vector2
Point Vector2
Definition: point.h:310
impeller::PlaygroundImpl::switches_
const PlaygroundSwitches switches_
Definition: playground_impl.h:36
impeller::PlaygroundImpl::GetWindowHandle
virtual WindowHandle GetWindowHandle() const =0
impeller::PlaygroundBackend::kOpenGLES
@ kOpenGLES