Flutter Engine
test_gl_surface.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef FLUTTER_TESTING_TEST_GL_SURFACE_H_
6 #define FLUTTER_TESTING_TEST_GL_SURFACE_H_
7 
8 #include <cstdint>
9 
10 #include "flutter/fml/macros.h"
11 #include "third_party/skia/include/gpu/GrDirectContext.h"
12 
13 namespace flutter {
14 namespace testing {
15 
17  public:
18  TestGLSurface(SkISize surface_size);
19 
21 
22  const SkISize& GetSurfaceSize() const;
23 
24  bool MakeCurrent();
25 
26  bool ClearCurrent();
27 
28  bool Present();
29 
30  uint32_t GetFramebuffer(uint32_t width, uint32_t height) const;
31 
32  bool MakeResourceCurrent();
33 
34  void* GetProcAddress(const char* name) const;
35 
36  sk_sp<SkSurface> GetOnscreenSurface();
37 
38  sk_sp<GrDirectContext> GetGrContext();
39 
40  sk_sp<GrDirectContext> CreateGrContext();
41 
42  sk_sp<SkImage> GetRasterSurfaceSnapshot();
43 
44  uint32_t GetWindowFBOId() const;
45 
46  private:
47  // Importing the EGL.h pulls in platform headers which are problematic
48  // (especially X11 which #defineds types like Bool). Any TUs importing
49  // this header then become susceptible to failures because of platform
50  // specific craziness. Don't expose EGL internals via this header.
51  using EGLDisplay = void*;
52  using EGLContext = void*;
53  using EGLSurface = void*;
54 
55  const SkISize surface_size_;
56  EGLDisplay display_;
57  EGLContext onscreen_context_;
58  EGLContext offscreen_context_;
59  EGLSurface onscreen_surface_;
60  EGLSurface offscreen_surface_;
61  sk_sp<GrDirectContext> context_;
62 
63  FML_DISALLOW_COPY_AND_ASSIGN(TestGLSurface);
64 };
65 
66 } // namespace testing
67 } // namespace flutter
68 
69 #endif // FLUTTER_TESTING_TEST_GL_SURFACE_H_
sk_sp< GrDirectContext > CreateGrContext()
TestGLSurface(SkISize surface_size)
const SkISize & GetSurfaceSize() const
uint32_t GetFramebuffer(uint32_t width, uint32_t height) const
void * GetProcAddress(const char *name) const
sk_sp< GrDirectContext > GetGrContext()
sk_sp< SkImage > GetRasterSurfaceSnapshot()
int32_t height
int32_t width
const char * name
Definition: fuchsia.cc:50
sk_sp< SkSurface > GetOnscreenSurface()