Flutter Engine
The Flutter Engine
android_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 "flutter/shell/platform/android/surface/android_native_window.h"
6
7namespace flutter {
8
9AndroidNativeWindow::AndroidNativeWindow(Handle window, bool is_fake_window)
10 : window_(window), is_fake_window_(is_fake_window) {}
11
12AndroidNativeWindow::AndroidNativeWindow(Handle window)
13 : AndroidNativeWindow(window, /*is_fake_window=*/false) {}
14
15AndroidNativeWindow::~AndroidNativeWindow() {
16 if (window_ != nullptr) {
17#if FML_OS_ANDROID
18 ANativeWindow_release(window_);
19 window_ = nullptr;
20#endif // FML_OS_ANDROID
21 }
22}
23
24bool AndroidNativeWindow::IsValid() const {
25 return window_ != nullptr;
26}
27
28AndroidNativeWindow::Handle AndroidNativeWindow::handle() const {
29 return window_;
30}
31
32SkISize AndroidNativeWindow::GetSize() const {
33#if FML_OS_ANDROID
34 return window_ == nullptr ? SkISize::Make(0, 0)
35 : SkISize::Make(ANativeWindow_getWidth(window_),
36 ANativeWindow_getHeight(window_));
37#else // FML_OS_ANDROID
38 return SkISize::Make(0, 0);
39#endif // FML_OS_ANDROID
40}
41
42} // namespace flutter
GLFWwindow * window
Definition: main.cc:45
Definition: SkSize.h:16
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20