Flutter Engine
flutter::AndroidEnvironmentGL Class Reference

#include <android_environment_gl.h>

Inheritance diagram for flutter::AndroidEnvironmentGL:
fml::RefCountedThreadSafe< AndroidEnvironmentGL > fml::internal::RefCountedThreadSafeBase flutter::testing::android::InterceptingAndroidEnvironmentGL

Public Member Functions

bool IsValid () const
 
EGLDisplay Display () const
 
virtual bool SetPresentationTime (EGLSurface surface, fml::TimePoint time) const
 
- Public Member Functions inherited from fml::RefCountedThreadSafe< AndroidEnvironmentGL >
void Release () const
 
- Public Member Functions inherited from fml::internal::RefCountedThreadSafeBase
void AddRef () const
 
bool HasOneRef () const
 
void AssertHasOneRef () const
 

Protected Member Functions

 AndroidEnvironmentGL ()
 
virtual ~AndroidEnvironmentGL ()
 
- Protected Member Functions inherited from fml::RefCountedThreadSafe< AndroidEnvironmentGL >
 RefCountedThreadSafe ()
 
 ~RefCountedThreadSafe ()
 
- Protected Member Functions inherited from fml::internal::RefCountedThreadSafeBase
 RefCountedThreadSafeBase ()
 
 ~RefCountedThreadSafeBase ()
 
bool Release () const
 
void Adopt ()
 

Friends

class InterceptingAndroidEnvironmentGL
 

Detailed Description

Definition at line 21 of file android_environment_gl.h.

Constructor & Destructor Documentation

◆ AndroidEnvironmentGL()

flutter::AndroidEnvironmentGL::AndroidEnvironmentGL ( )
protected

Definition at line 9 of file android_environment_gl.cc.

10  : display_(EGL_NO_DISPLAY), valid_(false) {
11  // Get the display.
12  display_ = eglGetDisplay(EGL_DEFAULT_DISPLAY);
13 
14  if (display_ == EGL_NO_DISPLAY) {
15  return;
16  }
17 
18  // Initialize the display connection.
19  if (eglInitialize(display_, nullptr, nullptr) != EGL_TRUE) {
20  return;
21  }
22 
23  auto* extensions = eglQueryString(display_, EGL_EXTENSIONS);
24  if (strstr(extensions, "EGL_ANDROID_presentation_time")) {
25  presentation_time_proc_ =
26  reinterpret_cast<PFNEGLPRESENTATIONTIMEANDROIDPROC>(
27  eglGetProcAddress("sEGL_ANDROID_presentation_time"));
28  }
29 
30  valid_ = true;
31 }

◆ ~AndroidEnvironmentGL()

flutter::AndroidEnvironmentGL::~AndroidEnvironmentGL ( )
protectedvirtual

Definition at line 33 of file android_environment_gl.cc.

33  {
34  // Disconnect the display if valid.
35  if (display_ != EGL_NO_DISPLAY) {
36  eglTerminate(display_);
37  }
38 }

Member Function Documentation

◆ Display()

EGLDisplay flutter::AndroidEnvironmentGL::Display ( ) const

Definition at line 44 of file android_environment_gl.cc.

44  {
45  return display_;
46 }

◆ IsValid()

bool flutter::AndroidEnvironmentGL::IsValid ( ) const

Definition at line 40 of file android_environment_gl.cc.

40  {
41  return valid_;
42 }

◆ SetPresentationTime()

bool flutter::AndroidEnvironmentGL::SetPresentationTime ( EGLSurface  surface,
fml::TimePoint  time 
) const
virtual

Reimplemented in flutter::testing::android::InterceptingAndroidEnvironmentGL.

Definition at line 48 of file android_environment_gl.cc.

References fml::TimePoint::ToEpochDelta(), and fml::TimeDelta::ToNanoseconds().

Referenced by flutter::testing::android::InterceptingAndroidEnvironmentGL::SetPresentationTime().

49  {
50  if (!presentation_time_proc_) {
51  return false;
52  }
53  return presentation_time_proc_(display_, surface,
54  time.ToEpochDelta().ToNanoseconds());
55 }
TimeDelta ToEpochDelta() const
Definition: time_point.h:47
constexpr int64_t ToNanoseconds() const
Definition: time_delta.h:61

Friends And Related Function Documentation

◆ InterceptingAndroidEnvironmentGL

friend class InterceptingAndroidEnvironmentGL
friend

Definition at line 46 of file android_environment_gl.h.


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