Flutter Engine
ios_surface_gl.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_SHELL_PLATFORM_DARWIN_IOS_IOS_SURFACE_GL_H_
6 #define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_SURFACE_GL_H_
7 
8 #include "flutter/fml/macros.h"
9 #include "flutter/fml/platform/darwin/scoped_nsobject.h"
10 #include "flutter/shell/gpu/gpu_surface_gl.h"
11 #import "flutter/shell/platform/darwin/ios/ios_context.h"
12 #import "flutter/shell/platform/darwin/ios/ios_render_target_gl.h"
13 #import "flutter/shell/platform/darwin/ios/ios_surface.h"
14 
15 @class CAEAGLLayer;
16 
17 namespace flutter {
18 
19 class IOSSurfaceGL final : public IOSSurface, public GPUSurfaceGLDelegate {
20  public:
21  IOSSurfaceGL(fml::scoped_nsobject<CAEAGLLayer> layer, std::shared_ptr<IOSContext> context);
22 
23  ~IOSSurfaceGL() override;
24 
25  // |IOSSurface|
26  bool IsValid() const override;
27 
28  // |IOSSurface|
29  void UpdateStorageSizeIfNecessary() override;
30 
31  // |IOSSurface|
32  std::unique_ptr<Surface> CreateGPUSurface(GrDirectContext* gr_context) override;
33 
34  // |GPUSurfaceGLDelegate|
35  std::unique_ptr<GLContextResult> GLContextMakeCurrent() override;
36 
37  // |GPUSurfaceGLDelegate|
38  bool GLContextClearCurrent() override;
39 
40  // |GPUSurfaceGLDelegate|
41  bool GLContextPresent(uint32_t fbo_id) override;
42 
43  // |GPUSurfaceGLDelegate|
44  intptr_t GLContextFBO(GLFrameInfo frame_info) const override;
45 
46  // |GPUSurfaceGLDelegate|
47  bool SurfaceSupportsReadback() const override;
48 
49  // |GPUSurfaceGLDelegate|
50  bool AllowsDrawingWhenGpuDisabled() const override;
51 
52  private:
53  std::unique_ptr<IOSRenderTargetGL> render_target_;
54 
55  FML_DISALLOW_COPY_AND_ASSIGN(IOSSurfaceGL);
56 };
57 
58 } // namespace flutter
59 
60 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_SURFACE_GL_H_
bool GLContextPresent(uint32_t fbo_id) override
~IOSSurfaceGL() override
std::unique_ptr< Surface > CreateGPUSurface(GrDirectContext *gr_context) override
IOSSurfaceGL(fml::scoped_nsobject< CAEAGLLayer > layer, std::shared_ptr< IOSContext > context)
bool SurfaceSupportsReadback() const override
intptr_t GLContextFBO(GLFrameInfo frame_info) const override
bool GLContextClearCurrent() override
bool AllowsDrawingWhenGpuDisabled() const override
std::unique_ptr< GLContextResult > GLContextMakeCurrent() override
void UpdateStorageSizeIfNecessary() override
bool IsValid() const override