Flutter Engine
flutter::IOSSwitchableGLContext Class Referencefinal

#include <ios_switchable_gl_context.h>

Inheritance diagram for flutter::IOSSwitchableGLContext:
flutter::SwitchableGLContext

Public Member Functions

 IOSSwitchableGLContext (EAGLContext *context)
 
bool SetCurrent () override
 
bool RemoveCurrent () override
 
- Public Member Functions inherited from flutter::SwitchableGLContext
 SwitchableGLContext ()
 
virtual ~SwitchableGLContext ()
 
 FML_DISALLOW_COPY_AND_ASSIGN (SwitchableGLContext)
 

Detailed Description

The iOS implementation of a |SwitchableGLContext|.

It wraps a pointer to an EAGLContext. When passed in the constructor of the |GLContextSwitch|, this EAGLContext is set to current. When the |GLContextSwitch| destroys, the current context will be restored to the context before setting this EAGLContext to current.

Note: An |IOSSwitchableGLContext| doesn't retain the EAGLContext. Someone else must retain the pointer and outlive all the |IOSSwitchableGLContext|. This object is meant to be only owned by a |GLContextSwitch| and should be destroyed when The |GLContectSwitch| destroys.

Definition at line 27 of file ios_switchable_gl_context.h.

Constructor & Destructor Documentation

◆ IOSSwitchableGLContext()

flutter::IOSSwitchableGLContext::IOSSwitchableGLContext ( EAGLContext *  context)

Definition at line 11 of file ios_switchable_gl_context.mm.

11 : context_(context){};

Member Function Documentation

◆ RemoveCurrent()

bool flutter::IOSSwitchableGLContext::RemoveCurrent ( )
overridevirtual

Implements flutter::SwitchableGLContext.

Definition at line 21 of file ios_switchable_gl_context.mm.

References FML_DCHECK_CREATION_THREAD_IS_CURRENT.

21  {
23  return [EAGLContext setCurrentContext:previous_context_];
24 };
#define FML_DCHECK_CREATION_THREAD_IS_CURRENT(c)

◆ SetCurrent()

bool flutter::IOSSwitchableGLContext::SetCurrent ( )
overridevirtual

Implements flutter::SwitchableGLContext.

Definition at line 13 of file ios_switchable_gl_context.mm.

References flutter::testing::current_context, FML_DCHECK, and FML_DCHECK_CREATION_THREAD_IS_CURRENT.

13  {
15  FML_DCHECK(context_ != nullptr);
16  EAGLContext* current_context = EAGLContext.currentContext;
17  previous_context_ = current_context;
18  return [EAGLContext setCurrentContext:context_];
19 };
#define FML_DCHECK(condition)
Definition: logging.h:86
FML_THREAD_LOCAL fml::ThreadLocalUniquePtr< int > current_context
#define FML_DCHECK_CREATION_THREAD_IS_CURRENT(c)

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