Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
surface_control.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_IMPELLER_TOOLKIT_ANDROID_SURFACE_CONTROL_H_
6#define FLUTTER_IMPELLER_TOOLKIT_ANDROID_SURFACE_CONTROL_H_
7
8#include <memory>
9
11
12namespace impeller::android {
13
14//------------------------------------------------------------------------------
15/// @brief A wrapper for ASurfaceControl.
16/// https://developer.android.com/ndk/reference/group/native-activity#asurfacecontrol
17///
18/// Instances of this class represent a node in the hierarchy of
19/// surfaces sent to the system compositor for final composition.
20///
21/// This wrapper is only available on Android API 29 and above.
22///
24 public:
25 //----------------------------------------------------------------------------
26 /// @return `true` if any surface controls can be created on this
27 /// platform.
28 ///
29 static bool IsAvailableOnPlatform();
30
31 //----------------------------------------------------------------------------
32 /// @brief Creates a new surface control and adds it as a child of the
33 /// given window.
34 ///
35 /// @param window The window
36 /// @param[in] debug_name A debug name. See it using
37 /// `adb shell dumpsys SurfaceFlinger` along with
38 /// other control properties. If no debug name is
39 /// specified, the value "Impeller Layer" is used.
40 ///
41 static std::unique_ptr<SurfaceControl> Create(
43 const char* debug_name = nullptr);
44
45 //----------------------------------------------------------------------------
46 /// @brief Removes the surface control from the presentation hierarchy
47 /// managed by the system compositor and release the client side
48 /// reference to the control. At this point, it may be collected
49 /// when the compositor is also done using it.
50 ///
51 virtual ~SurfaceControl() = default;
52
53 virtual bool IsValid() const = 0;
54
55 virtual ASurfaceControl* GetHandle() const = 0;
56
57 //----------------------------------------------------------------------------
58 /// @brief Remove the surface control from the hierarchy of nodes
59 /// presented by the system compositor.
60 ///
61 /// This is called implicitly when the surface control is
62 /// collected.
63 ///
64 /// @return `true` If the control will be removed from the hierarchy of
65 /// nodes presented by the system compositor.
66 ///
67 virtual bool RemoveFromParent() const = 0;
68};
69
70} // namespace impeller::android
71
72#endif // FLUTTER_IMPELLER_TOOLKIT_ANDROID_SURFACE_CONTROL_H_
A wrapper for ASurfaceControl. https://developer.android.com/ndk/reference/group/native-activity#asur...
virtual bool IsValid() const =0
virtual ~SurfaceControl()=default
Removes the surface control from the presentation hierarchy managed by the system compositor and rele...
static std::unique_ptr< SurfaceControl > Create(ANativeWindow *window, const char *debug_name=nullptr)
Creates a new surface control and adds it as a child of the given window.
virtual ASurfaceControl * GetHandle() const =0
virtual bool RemoveFromParent() const =0
Remove the surface control from the hierarchy of nodes presented by the system compositor.
GLFWwindow * window
Definition main.cc:60
struct ANativeWindow ANativeWindow