Flutter iOS Embedder
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 
6 
7 #include "flutter/common/settings.h"
8 #include "flutter/common/task_runners.h"
9 #include "flutter/flow/layers/layer_tree.h"
10 #include "flutter/fml/platform/darwin/cf_utils.h"
11 #include "flutter/fml/synchronization/waitable_event.h"
12 #include "flutter/fml/trace_event.h"
13 #include "flutter/shell/common/platform_view.h"
14 #include "flutter/shell/common/rasterizer.h"
17 #include "third_party/skia/include/utils/mac/SkCGUtils.h"
18 
19 // This is mostly a duplication of FlutterView.
20 // TODO(amirh): once GL support is in evaluate if we can merge this with FlutterView.
21 @implementation FlutterOverlayView
22 
23 - (instancetype)initWithFrame:(CGRect)frame {
24  NSAssert(NO, @"FlutterOverlayView must init or initWithContentsScale");
25  return nil;
26 }
27 
28 - (instancetype)initWithCoder:(NSCoder*)aDecoder {
29  NSAssert(NO, @"FlutterOverlayView must init or initWithContentsScale");
30  return nil;
31 }
32 
33 - (instancetype)init {
34  self = [super initWithFrame:CGRectZero];
35 
36  if (self) {
37  self.layer.opaque = NO;
38  self.userInteractionEnabled = NO;
39  self.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
40  }
41 
42  return self;
43 }
44 
45 - (instancetype)initWithContentsScale:(CGFloat)contentsScale {
46  self = [self init];
47 
48  if ([self.layer isKindOfClass:NSClassFromString(@"CAMetalLayer")]) {
49  self.layer.allowsGroupOpacity = NO;
50  self.layer.contentsScale = contentsScale;
51  self.layer.rasterizationScale = contentsScale;
52  }
53 
54  return self;
55 }
56 
57 + (Class)layerClass {
58  return [FlutterView layerClass];
59 }
60 
61 // TODO(amirh): implement drawLayer to support snapshotting.
62 
63 @end
initWithFrame
instancetype initWithFrame
Definition: FlutterTextInputPlugin.h:164
ios_surface_software.h
FlutterOverlayView.h
initWithCoder
instancetype initWithCoder
Definition: FlutterTextInputPlugin.h:163
FlutterOverlayView
Definition: FlutterOverlayView.h:29
FlutterView
Definition: FlutterView.h:38
FlutterView.h