Flutter Engine
android_surface.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_ANDROID_ANDROID_SURFACE_H_
6 #define FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_H_
7 
8 #include <memory>
9 #include "flutter/flow/embedded_views.h"
10 #include "flutter/flow/surface.h"
11 #include "flutter/fml/macros.h"
12 #include "flutter/shell/platform/android/context/android_context.h"
13 #include "flutter/shell/platform/android/jni/platform_view_android_jni.h"
14 #include "flutter/shell/platform/android/surface/android_native_window.h"
15 #include "third_party/skia/include/core/SkSize.h"
16 
17 namespace flutter {
18 
19 class AndroidExternalViewEmbedder;
20 
22  public:
23  virtual ~AndroidSurface();
24 
25  virtual bool IsValid() const = 0;
26 
27  virtual void TeardownOnScreenContext() = 0;
28 
29  virtual std::unique_ptr<Surface> CreateGPUSurface(
30  GrDirectContext* gr_context = nullptr) = 0;
31 
32  virtual bool OnScreenSurfaceResize(const SkISize& size) = 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  virtual std::unique_ptr<Surface> CreatePbufferSurface();
41 
42  protected:
43  explicit AndroidSurface(
44  const std::shared_ptr<AndroidContext>& android_context);
45  std::shared_ptr<AndroidContext> android_context_;
46 };
47 
49  public:
50  AndroidSurfaceFactory() = default;
51 
52  virtual ~AndroidSurfaceFactory() = default;
53 
54  virtual std::unique_ptr<AndroidSurface> CreateSurface() = 0;
55 };
56 
57 } // namespace flutter
58 
59 #endif // FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_H_
virtual void TeardownOnScreenContext()=0
virtual bool SetNativeWindow(fml::RefPtr< AndroidNativeWindow > window)=0
std::shared_ptr< AndroidContext > android_context_
constexpr std::size_t size(T(&array)[N])
Definition: size.h:13
virtual bool OnScreenSurfaceResize(const SkISize &size)=0
AndroidSurface(const std::shared_ptr< AndroidContext > &android_context)
virtual bool ResourceContextClearCurrent()=0
virtual bool IsValid() const =0
virtual std::unique_ptr< Surface > CreatePbufferSurface()
virtual bool ResourceContextMakeCurrent()=0
virtual std::unique_ptr< Surface > CreateGPUSurface(GrDirectContext *gr_context=nullptr)=0