1// 2// Copyright 2020 The ANGLE Project Authors. All rights reserved. 3// Use of this source code is governed by a BSD-style license that can be 4// found in the LICENSE file. 5// 6 7// IOSWindow.mm: Implementation of OSWindow for iOS 8 9#include "util/ios/IOSWindow.h" 10 11#include <set> 12 13#include "anglebase/no_destructor.h" 14#include "common/debug.h" 15 16#import <UIKit/UIKit.h> 17 18static CALayer *rootLayer() 19{ 20 return [[[[[UIApplication sharedApplication] delegate] window] rootViewController] view].layer; 21} 22 23bool IOSWindow::initializeImpl(const std::string &name, int width, int height) 24{ 25 resize(width, height); 26 return true; 27} 28 29EGLNativeWindowType IOSWindow::getNativeWindow() const 30{ 31 return rootLayer(); 32} 33 34bool IOSWindow::setOrientation(int width, int height) 35{ 36 UNIMPLEMENTED(); 37 return false; 38} 39 40bool IOSWindow::resize(int width, int height) 41{ 42 rootLayer().frame = CGRectMake(0, 0, width, height); 43 return true; 44} 45 46// static 47OSWindow *OSWindow::New() 48{ 49 return new IOSWindow; 50} 51