Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
impeller::android::NativeWindow Class Reference

A wrapper for ANativeWindow https://developer.android.com/ndk/reference/group/a-native-window. More...

#include <native_window.h>

Public Member Functions

 NativeWindow (ANativeWindow *window)
 
 ~NativeWindow ()
 
 NativeWindow (const NativeWindow &)=delete
 
NativeWindowoperator= (const NativeWindow &)=delete
 
bool IsValid () const
 
ISize GetSize () const
 
ANativeWindowGetHandle () const
 

Detailed Description

A wrapper for ANativeWindow https://developer.android.com/ndk/reference/group/a-native-window.

This wrapper is only available on Android.

Definition at line 20 of file native_window.h.

Constructor & Destructor Documentation

◆ NativeWindow() [1/2]

impeller::android::NativeWindow::NativeWindow ( ANativeWindow window)
explicit

Definition at line 9 of file native_window.cc.

9 : window_(window) {
10 if (window_.get()) {
11 GetProcTable().ANativeWindow_acquire(window_.get());
12 }
13}
const T & get() const
GLFWwindow * window
Definition main.cc:45
const ProcTable & GetProcTable()
Definition proc_table.cc:12

◆ ~NativeWindow()

impeller::android::NativeWindow::~NativeWindow ( )
default

◆ NativeWindow() [2/2]

impeller::android::NativeWindow::NativeWindow ( const NativeWindow )
delete

Member Function Documentation

◆ GetHandle()

ANativeWindow * impeller::android::NativeWindow::GetHandle ( ) const

Definition at line 30 of file native_window.cc.

30 {
31 return window_.get();
32}

◆ GetSize()

ISize impeller::android::NativeWindow::GetSize ( ) const
Returns
The current size of the native window.

Definition at line 21 of file native_window.cc.

21 {
22 if (!IsValid()) {
23 return {};
24 }
25 const int32_t width = ANativeWindow_getWidth(window_.get());
26 const int32_t height = ANativeWindow_getHeight(window_.get());
27 return ISize::MakeWH(std::max(width, 0), std::max(height, 0));
28}
int32_t height
int32_t width
static constexpr TSize MakeWH(Type width, Type height)
Definition size.h:34

◆ IsValid()

bool impeller::android::NativeWindow::IsValid ( ) const

Definition at line 17 of file native_window.cc.

17 {
18 return window_.is_valid();
19}
bool is_valid() const

◆ operator=()

NativeWindow & impeller::android::NativeWindow::operator= ( const NativeWindow )
delete

The documentation for this class was generated from the following files: