• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_ANDROID_ANDROID_SURFACE_H_
6 #define FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_H_
7 
8 #include <memory>
9 
10 #include "flutter/fml/macros.h"
11 #include "flutter/fml/platform/android/jni_util.h"
12 #include "flutter/fml/platform/android/jni_weak_ref.h"
13 #include "flutter/shell/common/platform_view.h"
14 #include "flutter/shell/common/surface.h"
15 #include "flutter/shell/platform/android/android_native_window.h"
16 #include "third_party/skia/include/core/SkSize.h"
17 
18 namespace flutter {
19 
20 class AndroidSurface {
21  public:
22   static std::unique_ptr<AndroidSurface> Create(bool use_software_rendering);
23 
24   virtual ~AndroidSurface();
25 
26   virtual bool IsValid() const = 0;
27 
28   virtual void TeardownOnScreenContext() = 0;
29 
30   virtual std::unique_ptr<Surface> CreateGPUSurface() = 0;
31 
32   virtual bool OnScreenSurfaceResize(const SkISize& size) const = 0;
33 
34   virtual bool ResourceContextMakeCurrent() = 0;
35 
36   virtual bool ResourceContextClearCurrent() = 0;
37 
38   virtual bool SetNativeWindow(fml::RefPtr<AndroidNativeWindow> window) = 0;
39 };
40 
41 }  // namespace flutter
42 
43 #endif  // FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_H_
44