Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
FlutterOverlayView.mm
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#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.h"
6
7#include <CoreGraphics/CGColorSpace.h>
8
9#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterView.h"
11
12// This is mostly a duplication of FlutterView.
13// TODO(amirh): once GL support is in evaluate if we can merge this with FlutterView.
14@implementation FlutterOverlayView {
15 fml::CFRef<CGColorSpaceRef> _colorSpaceRef;
16}
17
18- (instancetype)initWithFrame:(CGRect)frame {
19 NSAssert(NO, @"FlutterOverlayView must init or initWithContentsScale");
20 return nil;
21}
22
23- (instancetype)initWithCoder:(NSCoder*)aDecoder {
24 NSAssert(NO, @"FlutterOverlayView must init or initWithContentsScale");
25 return nil;
26}
27
28- (instancetype)init {
29 self = [super initWithFrame:CGRectZero];
30
31 if (self) {
32 self.layer.opaque = NO;
33 self.userInteractionEnabled = NO;
34 self.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
35 }
36
37 return self;
38}
39
40- (instancetype)initWithContentsScale:(CGFloat)contentsScale
41 pixelFormat:(MTLPixelFormat)pixelFormat {
42 self = [self init];
43
44 if ([self.layer isKindOfClass:NSClassFromString(@"CAMetalLayer")]) {
45 self.layer.allowsGroupOpacity = NO;
46 self.layer.contentsScale = contentsScale;
47 self.layer.rasterizationScale = contentsScale;
48#pragma clang diagnostic push
49#pragma clang diagnostic ignored "-Wunguarded-availability-new"
50 CAMetalLayer* layer = (CAMetalLayer*)self.layer;
51#pragma clang diagnostic pop
52 layer.pixelFormat = pixelFormat;
53 if (pixelFormat == MTLPixelFormatRGBA16Float || pixelFormat == MTLPixelFormatBGRA10_XR) {
54 self->_colorSpaceRef = fml::CFRef(CGColorSpaceCreateWithName(kCGColorSpaceExtendedSRGB));
55 layer.colorspace = self->_colorSpaceRef;
56 }
57 }
58 return self;
59}
60
61+ (Class)layerClass {
62 return [FlutterView layerClass];
63}
64
65// TODO(amirh): implement drawLayer to support snapshotting.
66
67@end
Class layerClass()
instancetype initWithFrame
instancetype initWithCoder
init(device_serial, adb_binary)
Definition _adb_path.py:12