// Copyright 2016 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_GL_H_ #define FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_GL_H_ #include #include #include "flutter/shell/gpu/gpu_surface_gl.h" #include "flutter/shell/platform/android/android_context_gl.h" #include "flutter/shell/platform/android/android_environment_gl.h" #include "flutter/shell/platform/android/android_surface.h" #include "lib/fxl/macros.h" namespace shell { class AndroidSurfaceGL final : public GPUSurfaceGLDelegate, public AndroidSurface { public: AndroidSurfaceGL(); ~AndroidSurfaceGL() override; bool IsOffscreenContextValid() const; // |shell::AndroidSurface| bool IsValid() const override; // |shell::AndroidSurface| std::unique_ptr CreateGPUSurface() override; // |shell::AndroidSurface| void TeardownOnScreenContext() override; // |shell::AndroidSurface| bool OnScreenSurfaceResize(const SkISize& size) const override; // |shell::AndroidSurface| bool ResourceContextMakeCurrent() override; // |shell::AndroidSurface| bool SetNativeWindow(fxl::RefPtr window) override; // |shell::GPUSurfaceGLDelegate| bool GLContextMakeCurrent() override; // |shell::GPUSurfaceGLDelegate| bool GLContextClearCurrent() override; // |shell::GPUSurfaceGLDelegate| bool GLContextPresent() override; // |shell::GPUSurfaceGLDelegate| intptr_t GLContextFBO() const override; private: fxl::RefPtr onscreen_context_; fxl::RefPtr offscreen_context_; sk_sp gr_context_; FXL_DISALLOW_COPY_AND_ASSIGN(AndroidSurfaceGL); }; } // namespace shell #endif // FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_GL_H_