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 #import <OpenGLES/EAGL.h> 9 #import <OpenGLES/ES2/gl.h> 10 #import <OpenGLES/ES2/glext.h> 11 #import <QuartzCore/CAEAGLLayer.h> 12 13 #include "flutter/fml/macros.h" 14 #include "flutter/fml/platform/darwin/scoped_nsobject.h" 15 #include "flutter/shell/common/platform_view.h" 16 #include "ios_gl_render_target.h" 17 18 namespace flutter { 19 20 class IOSGLContext { 21 public: 22 IOSGLContext(); 23 24 ~IOSGLContext(); 25 26 std::unique_ptr<IOSGLRenderTarget> CreateRenderTarget( 27 fml::scoped_nsobject<CAEAGLLayer> layer); 28 29 bool MakeCurrent(); 30 31 bool ResourceMakeCurrent(); 32 ColorSpace()33 sk_sp<SkColorSpace> ColorSpace() const { return color_space_; } 34 35 private: 36 fml::scoped_nsobject<EAGLContext> context_; 37 fml::scoped_nsobject<EAGLContext> resource_context_; 38 sk_sp<SkColorSpace> color_space_; 39 40 FML_DISALLOW_COPY_AND_ASSIGN(IOSGLContext); 41 }; 42 43 } // namespace flutter 44 45 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_GL_CONTEXT_H_ 46