Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
skwindow::internal::GLWindowContext Class Referenceabstract

#include <GLWindowContext.h>

Inheritance diagram for skwindow::internal::GLWindowContext:
skwindow::WindowContext skwindow::internal::ANGLEWindowContext

Public Member Functions

sk_sp< SkSurfacegetBackbufferSurface () override
 
bool isValid () override
 
void resize (int w, int h) override
 
void setDisplayParams (const DisplayParams &params) override
 
- Public Member Functions inherited from skwindow::WindowContext
 WindowContext (const DisplayParams &)
 
virtual ~WindowContext ()
 
virtual sk_sp< SkSurfacegetBackbufferSurface ()=0
 
void swapBuffers ()
 
virtual bool isValid ()=0
 
virtual void resize (int w, int h)=0
 
virtual void activate (bool isActive)
 
const DisplayParamsgetDisplayParams ()
 
virtual void setDisplayParams (const DisplayParams &params)=0
 
GrDirectContextdirectContext () const
 
int width () const
 
int height () const
 
SkISize dimensions () const
 
int sampleCount () const
 
int stencilBits () const
 

Protected Member Functions

 GLWindowContext (const DisplayParams &)
 
void initializeContext ()
 
virtual sk_sp< const GrGLInterfaceonInitializeContext ()=0
 
void destroyContext ()
 
virtual void onDestroyContext ()=0
 
- Protected Member Functions inherited from skwindow::WindowContext
virtual bool isGpuContext ()
 
virtual void onSwapBuffers ()=0
 

Protected Attributes

sk_sp< const GrGLInterfacefBackendContext
 
sk_sp< SkSurfacefSurface
 
- Protected Attributes inherited from skwindow::WindowContext
sk_sp< GrDirectContextfContext
 
int fWidth
 
int fHeight
 
DisplayParams fDisplayParams
 
int fSampleCount = 1
 
int fStencilBits = 0
 

Detailed Description

Definition at line 20 of file GLWindowContext.h.

Constructor & Destructor Documentation

◆ GLWindowContext()

skwindow::internal::GLWindowContext::GLWindowContext ( const DisplayParams params)
protected

Definition at line 25 of file GLWindowContext.cpp.

27 , fBackendContext(nullptr)
28 , fSurface(nullptr) {
30}
static uint32_t GrNextPow2(uint32_t n)
Definition: SkMathPriv.h:302
DisplayParams fDisplayParams
Definition: WindowContext.h:71
WindowContext(const DisplayParams &)
sk_sp< const GrGLInterface > fBackendContext
const EmbeddedViewParams * params

Member Function Documentation

◆ destroyContext()

void skwindow::internal::GLWindowContext::destroyContext ( )
protected

Definition at line 45 of file GLWindowContext.cpp.

45 {
46 fSurface.reset(nullptr);
47
48 if (fContext) {
49 // in case we have outstanding refs to this (lua?)
52 }
53
54 fBackendContext.reset(nullptr);
55
56 this->onDestroyContext();
57}
void abandonContext() override
void reset(T *ptr=nullptr)
Definition: SkRefCnt.h:310
sk_sp< GrDirectContext > fContext
Definition: WindowContext.h:63

◆ getBackbufferSurface()

sk_sp< SkSurface > skwindow::internal::GLWindowContext::getBackbufferSurface ( )
overridevirtual

Implements skwindow::WindowContext.

Definition at line 59 of file GLWindowContext.cpp.

59 {
60 if (nullptr == fSurface) {
61 if (fContext) {
64
66 fbInfo.fFBOID = buffer;
67 fbInfo.fFormat = GR_GL_RGBA8;
69
71 fHeight,
74 fbInfo);
75
77 backendRT,
82 }
83 }
84
85 return fSurface;
86}
#define GR_GL_RGBA8
Definition: GrGLDefines.h:524
#define GR_GL_FRAMEBUFFER_BINDING
Definition: GrGLDefines.h:951
int GrGLint
Definition: GrGLTypes.h:108
#define GR_GL_CALL(IFACE, X)
Definition: GrGLUtil.h:381
@ kBottomLeft_GrSurfaceOrigin
Definition: GrTypes.h:149
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
Definition: SkColorType.h:24
T * get() const
Definition: SkRefCnt.h:303
SK_API GrBackendRenderTarget MakeGL(int width, int height, int sampleCnt, int stencilBits, const GrGLFramebufferInfo &glInfo)
SK_API sk_sp< SkSurface > WrapBackendRenderTarget(GrRecordingContext *context, const GrBackendRenderTarget &backendRenderTarget, GrSurfaceOrigin origin, SkColorType colorType, sk_sp< SkColorSpace > colorSpace, const SkSurfaceProps *surfaceProps, RenderTargetReleaseProc releaseProc=nullptr, ReleaseContext releaseContext=nullptr)
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 buffer
Definition: switches.h:126
Protected
Definition: GpuTypes.h:61
skgpu::Protected fProtected
Definition: GrGLTypes.h:199
SkSurfaceProps fSurfaceProps
Definition: DisplayParams.h:68
sk_sp< SkColorSpace > fColorSpace
Definition: DisplayParams.h:59

◆ initializeContext()

void skwindow::internal::GLWindowContext::initializeContext ( )
protected

Definition at line 32 of file GLWindowContext.cpp.

32 {
34
36
40 this->initializeContext();
41 return;
42 }
43}
#define SkASSERT(cond)
Definition: SkAssert.h:116
virtual sk_sp< const GrGLInterface > onInitializeContext()=0
SK_API sk_sp< GrDirectContext > MakeGL(sk_sp< const GrGLInterface >, const GrContextOptions &)
GrContextOptions fGrContextOptions
Definition: DisplayParams.h:61

◆ isValid()

bool skwindow::internal::GLWindowContext::isValid ( )
inlineoverridevirtual

Implements skwindow::WindowContext.

Definition at line 24 of file GLWindowContext.h.

24{ return SkToBool(fBackendContext.get()); }
static constexpr bool SkToBool(const T &x)
Definition: SkTo.h:35

◆ onDestroyContext()

virtual void skwindow::internal::GLWindowContext::onDestroyContext ( )
protectedpure virtual

◆ onInitializeContext()

virtual sk_sp< const GrGLInterface > skwindow::internal::GLWindowContext::onInitializeContext ( )
protectedpure virtual

◆ resize()

void skwindow::internal::GLWindowContext::resize ( int  w,
int  h 
)
overridevirtual

Implements skwindow::WindowContext.

Definition at line 88 of file GLWindowContext.cpp.

88 {
89 this->destroyContext();
90 this->initializeContext();
91}

◆ setDisplayParams()

void skwindow::internal::GLWindowContext::setDisplayParams ( const DisplayParams params)
overridevirtual

Implements skwindow::WindowContext.

Definition at line 93 of file GLWindowContext.cpp.

93 {
95 this->destroyContext();
96 this->initializeContext();
97}

Member Data Documentation

◆ fBackendContext

sk_sp<const GrGLInterface> skwindow::internal::GLWindowContext::fBackendContext
protected

Definition at line 43 of file GLWindowContext.h.

◆ fSurface

sk_sp<SkSurface> skwindow::internal::GLWindowContext::fSurface
protected

Definition at line 44 of file GLWindowContext.h.


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