Edit

kc3-lang/angle/util/ios/IOSWindow.mm

Branch :

  • Show log

    Commit

  • Author : James Darpinian
    Date : 2020-12-29 16:25:54
    Hash : ebf00703
    Message : angle_end2end_tests passes on iOS! Miscellaneous test skips and fixes for iOS. Bug: angleproject:5417 Bug: angleproject:5491 Change-Id: Id0785e6243949fc756e4d7923dbbe77a411052f3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2606656 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: James Darpinian <jdarpinian@chromium.org>

  • util/ios/IOSWindow.mm
  • //
    // Copyright 2020 The ANGLE Project Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style license that can be
    // found in the LICENSE file.
    //
    
    // IOSWindow.mm: Implementation of OSWindow for iOS
    
    #include "util/ios/IOSWindow.h"
    
    #include <set>
    
    #include "anglebase/no_destructor.h"
    #include "common/debug.h"
    
    #import <UIKit/UIKit.h>
    
    static CALayer *rootLayer()
    {
        return [[[[[UIApplication sharedApplication] delegate] window] rootViewController] view].layer;
    }
    
    bool IOSWindow::initializeImpl(const std::string &name, int width, int height)
    {
        resize(width, height);
        return true;
    }
    
    EGLNativeWindowType IOSWindow::getNativeWindow() const
    {
        return rootLayer();
    }
    
    bool IOSWindow::setOrientation(int width, int height)
    {
        UNIMPLEMENTED();
        return false;
    }
    
    bool IOSWindow::resize(int width, int height)
    {
        rootLayer().frame = CGRectMake(0, 0, width, height);
        return true;
    }
    
    // static
    OSWindow *OSWindow::New()
    {
        return new IOSWindow;
    }