Flutter Engine
ios_context_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_GL_CONTEXT_H_
6 #define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_GL_CONTEXT_H_
7 
8 #include "flutter/fml/macros.h"
9 #include "flutter/fml/platform/darwin/scoped_nsobject.h"
10 #include "flutter/shell/common/platform_view.h"
11 #import "flutter/shell/platform/darwin/ios/ios_context.h"
12 #import "flutter/shell/platform/darwin/ios/ios_context_gl.h"
13 #import "flutter/shell/platform/darwin/ios/ios_render_target_gl.h"
14 
15 @class CAEAGLLayer;
16 
17 namespace flutter {
18 
19 class IOSContextGL final : public IOSContext {
20  public:
21  IOSContextGL();
22 
23  // |IOSContext|
24  ~IOSContextGL() override;
25 
26  std::unique_ptr<IOSRenderTargetGL> CreateRenderTarget(fml::scoped_nsobject<CAEAGLLayer> layer);
27 
28  void SetMainContext(const sk_sp<GrDirectContext>& main_context);
29 
30  // |IOSContext|
31  sk_sp<GrDirectContext> CreateResourceContext() override;
32 
33  // |IOSContext|
34  std::unique_ptr<GLContextResult> MakeCurrent() override;
35 
36  // |IOSContext|
37  std::unique_ptr<Texture> CreateExternalTexture(
38  int64_t texture_id,
39  fml::scoped_nsobject<NSObject<FlutterTexture>> texture) override;
40 
41  // |IOSContext|
42  sk_sp<GrDirectContext> GetMainContext() const override;
43 
44  private:
46  fml::scoped_nsobject<EAGLContext> resource_context_;
47  sk_sp<GrDirectContext> main_context_;
48 
49  FML_DISALLOW_COPY_AND_ASSIGN(IOSContextGL);
50 };
51 
52 } // namespace flutter
53 
54 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_GL_CONTEXT_H_
G_BEGIN_DECLS FlTexture * texture
std::unique_ptr< IOSRenderTargetGL > CreateRenderTarget(fml::scoped_nsobject< CAEAGLLayer > layer)
void SetMainContext(const sk_sp< GrDirectContext > &main_context)
int64_t texture_id
std::unique_ptr< GLContextResult > MakeCurrent() override
When using client rendering APIs whose contexts need to be bound to a specific thread, the engine will call this method to give the on-screen context a chance to bind to the current thread.
Manages the lifetime of the on-screen and off-screen rendering contexts on iOS. On-screen contexts ar...
Definition: ios_context.h:33
std::unique_ptr< Texture > CreateExternalTexture(int64_t texture_id, fml::scoped_nsobject< NSObject< FlutterTexture >> texture) override
Creates an external texture proxy of the appropriate client rendering API.
sk_sp< GrDirectContext > GetMainContext() const override
Accessor for the Skia context associated with IOSSurfaces and the raster thread.
sk_sp< GrDirectContext > CreateResourceContext() override
Create a resource context for use on the IO task runner. This resource context is used by Skia to upl...