Flutter Engine
 
Loading...
Searching...
No Matches
flutter::testing::TestGLSurface Class Reference

#include <test_gl_surface.h>

Inheritance diagram for flutter::testing::TestGLSurface:
flutter::testing::TestGLOnscreenOnlySurface

Public Member Functions

 TestGLSurface (DlISize surface_size)
 
 TestGLSurface (std::shared_ptr< TestEGLContext > egl_context, DlISize surface_size)
 
 ~TestGLSurface ()
 
bool MakeResourceCurrent ()
 
- Public Member Functions inherited from flutter::testing::TestGLOnscreenOnlySurface
 TestGLOnscreenOnlySurface (DlISize surface_size)
 
 TestGLOnscreenOnlySurface (std::shared_ptr< TestEGLContext > context, DlISize size)
 
 ~TestGLOnscreenOnlySurface ()
 
const DlISizeGetSurfaceSize () const
 
bool MakeCurrent ()
 
bool ClearCurrent ()
 
bool Present ()
 
uint32_t GetFramebuffer (uint32_t width, uint32_t height) const
 
void * GetProcAddress (const char *name) const
 
sk_sp< SkSurface > GetOnscreenSurface ()
 
sk_sp< GrDirectContext > GetGrContext ()
 
sk_sp< GrDirectContext > CreateGrContext ()
 
sk_sp< SkImage > GetRasterSurfaceSnapshot ()
 
uint32_t GetWindowFBOId () const
 

Additional Inherited Members

- Protected Types inherited from flutter::testing::TestGLOnscreenOnlySurface
using EGLSurface = void *
 
- Protected Member Functions inherited from flutter::testing::TestGLOnscreenOnlySurface
 FML_DISALLOW_COPY_AND_ASSIGN (TestGLOnscreenOnlySurface)
 
- Protected Attributes inherited from flutter::testing::TestGLOnscreenOnlySurface
const DlISize surface_size_
 
std::shared_ptr< TestEGLContextegl_context_
 
EGLSurface onscreen_surface_
 
sk_sp< GrDirectContext > skia_context_
 

Detailed Description

Definition at line 61 of file test_gl_surface.h.

Constructor & Destructor Documentation

◆ TestGLSurface() [1/2]

flutter::testing::TestGLSurface::TestGLSurface ( DlISize  surface_size)
explicit

Definition at line 225 of file test_gl_surface.cc.

226 : TestGLSurface(std::make_shared<TestEGLContext>(), surface_size) {}
TestGLSurface(DlISize surface_size)

◆ TestGLSurface() [2/2]

flutter::testing::TestGLSurface::TestGLSurface ( std::shared_ptr< TestEGLContext egl_context,
DlISize  surface_size 
)
explicit

Definition at line 228 of file test_gl_surface.cc.

230 : TestGLOnscreenOnlySurface(std::move(egl_context), surface_size) {
231 {
232 const EGLint offscreen_surface_attributes[] = {
233 EGL_WIDTH, 1, //
234 EGL_HEIGHT, 1, //
235 EGL_NONE,
236 };
237 offscreen_surface_ = ::eglCreatePbufferSurface(
238 egl_context_->display, // display connection
239 egl_context_->config, // config
240 offscreen_surface_attributes // surface attributes
241 );
242 FML_CHECK(offscreen_surface_ != EGL_NO_SURFACE) << GetEGLError();
243 }
244}
std::shared_ptr< TestEGLContext > egl_context_
TestGLOnscreenOnlySurface(DlISize surface_size)
#define FML_CHECK(condition)
Definition logging.h:104
std::string GetEGLError()

References flutter::testing::TestGLOnscreenOnlySurface::egl_context_, FML_CHECK, and flutter::testing::GetEGLError().

◆ ~TestGLSurface()

flutter::testing::TestGLSurface::~TestGLSurface ( )

Definition at line 246 of file test_gl_surface.cc.

246 {
247 auto result = ::eglDestroySurface(egl_context_->display, offscreen_surface_);
248 FML_CHECK(result == EGL_TRUE) << GetEGLError();
249}

References flutter::testing::TestGLOnscreenOnlySurface::egl_context_, FML_CHECK, and flutter::testing::GetEGLError().

Member Function Documentation

◆ MakeResourceCurrent()

bool flutter::testing::TestGLSurface::MakeResourceCurrent ( )

Definition at line 251 of file test_gl_surface.cc.

251 {
252 auto result =
253 ::eglMakeCurrent(egl_context_->display, offscreen_surface_,
254 offscreen_surface_, egl_context_->offscreen_context);
255
256 if (result == EGL_FALSE) {
257 FML_LOG(ERROR) << "Could not make the resource context current. "
258 << GetEGLError();
259 }
260
261 return result == EGL_TRUE;
262}
#define FML_LOG(severity)
Definition logging.h:101

References flutter::testing::TestGLOnscreenOnlySurface::egl_context_, FML_LOG, and flutter::testing::GetEGLError().


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