Flutter Impeller
native_window.cc
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
#include "
impeller/toolkit/android/native_window.h
"
6
7
namespace
impeller::android
{
8
9
NativeWindow::NativeWindow
(ANativeWindow* window) : window_(window) {
10
if
(window_.get()) {
11
GetProcTable
().ANativeWindow_acquire(window_.get());
12
}
13
}
14
15
NativeWindow::~NativeWindow
() =
default
;
16
17
bool
NativeWindow::IsValid
()
const
{
18
return
window_.is_valid();
19
}
20
21
ISize
NativeWindow::GetSize
()
const
{
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
}
29
30
ANativeWindow*
NativeWindow::GetHandle
()
const
{
31
return
window_.get();
32
}
33
34
}
// namespace impeller::android
impeller::android::NativeWindow::GetHandle
ANativeWindow * GetHandle() const
Definition:
native_window.cc:30
impeller::android
Definition:
choreographer.cc:9
impeller::android::NativeWindow::NativeWindow
NativeWindow(ANativeWindow *window)
Definition:
native_window.cc:9
impeller::TSize< int64_t >
impeller::android::NativeWindow::GetSize
ISize GetSize() const
Definition:
native_window.cc:21
native_window.h
impeller::android::NativeWindow::~NativeWindow
~NativeWindow()
impeller::android::NativeWindow::IsValid
bool IsValid() const
Definition:
native_window.cc:17
impeller::android::GetProcTable
const ProcTable & GetProcTable()
Definition:
proc_table.cc:12
impeller::TSize< int64_t >::MakeWH
static constexpr TSize MakeWH(Type width, Type height)
Definition:
size.h:34
impeller
toolkit
android
native_window.cc
Generated by
1.8.17