5#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.h"
7#include <CoreGraphics/CGColorSpace.h>
9#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterView.h"
19 NSAssert(NO,
@"FlutterOverlayView must init or initWithContentsScale");
24 NSAssert(NO,
@"FlutterOverlayView must init or initWithContentsScale");
29 self = [
super initWithFrame:CGRectZero];
32 self.layer.opaque = NO;
33 self.userInteractionEnabled = NO;
34 self.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
40- (instancetype)initWithContentsScale:(CGFloat)contentsScale
41 pixelFormat:(MTLPixelFormat)pixelFormat {
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;
instancetype initWithFrame
instancetype initWithCoder