• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/android_native_window.h"
6 
7 namespace flutter {
8 
AndroidNativeWindow(Handle window)9 AndroidNativeWindow::AndroidNativeWindow(Handle window) : window_(window) {}
10 
~AndroidNativeWindow()11 AndroidNativeWindow::~AndroidNativeWindow() {
12   if (window_ != nullptr) {
13     ANativeWindow_release(window_);
14     window_ = nullptr;
15   }
16 }
17 
IsValid() const18 bool AndroidNativeWindow::IsValid() const {
19   return window_ != nullptr;
20 }
21 
handle() const22 AndroidNativeWindow::Handle AndroidNativeWindow::handle() const {
23   return window_;
24 }
25 
GetSize() const26 SkISize AndroidNativeWindow::GetSize() const {
27   return window_ == nullptr ? SkISize::Make(0, 0)
28                             : SkISize::Make(ANativeWindow_getWidth(window_),
29                                             ANativeWindow_getHeight(window_));
30 }
31 
32 }  // namespace flutter
33