Flutter Engine
The Flutter Engine
native_window.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_NATIVE_WINDOW_H_
6#define FLUTTER_IMPELLER_TOOLKIT_ANDROID_NATIVE_WINDOW_H_
7
8#include "flutter/fml/unique_object.h"
11
12namespace impeller::android {
13
14//------------------------------------------------------------------------------
15/// @brief A wrapper for ANativeWindow
16/// https://developer.android.com/ndk/reference/group/a-native-window
17///
18/// This wrapper is only available on Android.
19///
21 public:
23
25
26 NativeWindow(const NativeWindow&) = delete;
27
29
30 bool IsValid() const;
31
32 //----------------------------------------------------------------------------
33 /// @return The current size of the native window.
34 ///
35 ISize GetSize() const;
36
37 ANativeWindow* GetHandle() const;
38
39 private:
40 struct UniqueANativeWindowTraits {
41 static ANativeWindow* InvalidValue() { return nullptr; }
42
43 static bool IsValid(ANativeWindow* value) {
44 return value != InvalidValue();
45 }
46
47 static void Free(ANativeWindow* value) {
48 GetProcTable().ANativeWindow_release(value);
49 }
50 };
51
53};
54
55} // namespace impeller::android
56
57#endif // FLUTTER_IMPELLER_TOOLKIT_ANDROID_NATIVE_WINDOW_H_
A wrapper for ANativeWindow https://developer.android.com/ndk/reference/group/a-native-window.
Definition: native_window.h:20
ANativeWindow * GetHandle() const
NativeWindow(ANativeWindow *window)
Definition: native_window.cc:9
NativeWindow(const NativeWindow &)=delete
NativeWindow & operator=(const NativeWindow &)=delete
GLFWwindow * window
Definition: main.cc:45
uint8_t value
static void Free(FreeList *free_list, uword address, intptr_t size, bool is_protected)
const ProcTable & GetProcTable()
Definition: proc_table.cc:12
struct ANativeWindow ANativeWindow