Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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 ()
 
void swapBuffers ()
 
virtual void activate (bool isActive)
 
const DisplayParamsgetDisplayParams ()
 
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
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

◆ 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
#define GR_GL_FRAMEBUFFER_BINDING
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
static const uint8_t buffer[]
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)
Protected
Definition GpuTypes.h:61
skgpu::Protected fProtected
Definition GrGLTypes.h:199
SkSurfaceProps fSurfaceProps
sk_sp< SkColorSpace > fColorSpace

◆ 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()
GrContextOptions fGrContextOptions

◆ 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.

◆ 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: