| Flutter iOS Embedder |

Classes | Typedefs | Functions | Variables
FlutterPlatformViewsController.mm File Reference
`#import "shell/platform/darwin/ios/framework/Source/FlutterPlatformViewsController.h"`
`#include "flutter/display_list/effects/image_filters/dl_blur_image_filter.h"`
`#include "flutter/flow/surface_frame.h"`
`#include "flutter/flow/view_slicer.h"`
`#include "flutter/fml/make_copyable.h"`
`#include "flutter/fml/synchronization/count_down_latch.h"`
`#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.h"`
`#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterView.h"`
`#include "flutter/shell/platform/darwin/ios/framework/Source/overlay_layer_pool.h"`
`#import "flutter/shell/platform/darwin/ios/ios_surface.h"`

Go to the source code of this file.

## Classes
struct | LayerData
struct | PlatformViewData

## Typedefs
using | LayersMap = std::unordered_map< int64_t, LayerData >

## Functions
static CATransform3D | GetCATransform3DFromSkMatrix (const SkMatrix &matrix)
static void | ResetAnchor (CALayer *layer)
static CGRect | GetCGRectFromSkRect (const SkRect &clipSkRect)
static bool | ClipRectContainsPlatformViewBoundingRect (const SkRect &clip_rect, const SkRect &platformview_boundingrect, const SkMatrix &transform_matrix)
static bool | ClipRRectContainsPlatformViewBoundingRect (const SkRRect &clip_rrect, const SkRect &platformview_boundingrect, const SkMatrix &transform_matrix)

## Variables
static constexpr int | kDefaultMergedLeaseDuration = 10
static constexpr NSUInteger | kFlutterClippingMaskViewPoolCapacity = 5
std::unordered_map< int64_t, std::unique_ptr< flutter::EmbedderViewSlice > > | _slices
std::unordered_map< std::string, NSObject< FlutterPlatformViewFactory > * > | _factories
std::unordered_map< std::string, FlutterPlatformViewGestureRecognizersBlockingPolicy > | _gestureRecognizersBlockingPolicies
fml::RefPtr< fml::TaskRunner > | _platformTaskRunner
std::unordered_map< int64_t, PlatformViewData > | _platformViews
std::unordered_map< int64_t, flutter::EmbeddedViewParams > | _currentCompositionParams
std::unordered_set< int64_t > | _viewsToDispose
std::vector< int64_t > | _compositionOrder
std::vector< int64_t > | _visitedPlatformViews
std::unordered_set< int64_t > | _viewsToRecomposite
std::vector< int64_t > | _previousCompositionOrder

## Typedef Documentation

## ◆ LayersMap

using LayersMap = std::unordered_map<int64_t, LayerData>

Definition at line 31 of file FlutterPlatformViewsController.mm.

## Function Documentation

## ◆ ClipRectContainsPlatformViewBoundingRect()

static bool ClipRectContainsPlatformViewBoundingRect | ( | const SkRect & | clip_rect,
|  | const SkRect & | platformview_boundingrect,
|  | const SkMatrix & | transform_matrix
| ) |  |
| static

Definition at line 83 of file FlutterPlatformViewsController.mm.

85 {
86 SkRect transformed_rect = transform_matrix.mapRect(clip_rect);
87 return transformed_rect.contains(platformview_boundingrect);
88 }

## ◆ ClipRRectContainsPlatformViewBoundingRect()

static bool ClipRRectContainsPlatformViewBoundingRect | ( | const SkRRect & | clip_rrect,
|  | const SkRect & | platformview_boundingrect,
|  | const SkMatrix & | transform_matrix
| ) |  |
| static

Definition at line 98 of file FlutterPlatformViewsController.mm.

100 {
101 SkVector upper_left = clip_rrect.radii(SkRRect::Corner::kUpperLeft_Corner);
102 SkVector upper_right = clip_rrect.radii(SkRRect::Corner::kUpperRight_Corner);
103 SkVector lower_right = clip_rrect.radii(SkRRect::Corner::kLowerRight_Corner);
104 SkVector lower_left = clip_rrect.radii(SkRRect::Corner::kLowerLeft_Corner);
105 SkScalar transformed_upper_left_x = transform_matrix.mapRadius(upper_left.x());
106 SkScalar transformed_upper_left_y = transform_matrix.mapRadius(upper_left.y());
107 SkScalar transformed_upper_right_x = transform_matrix.mapRadius(upper_right.x());
108 SkScalar transformed_upper_right_y = transform_matrix.mapRadius(upper_right.y());
109 SkScalar transformed_lower_right_x = transform_matrix.mapRadius(lower_right.x());
110 SkScalar transformed_lower_right_y = transform_matrix.mapRadius(lower_right.y());
111 SkScalar transformed_lower_left_x = transform_matrix.mapRadius(lower_left.x());
112 SkScalar transformed_lower_left_y = transform_matrix.mapRadius(lower_left.y());
113 SkRect transformed_clip_rect = transform_matrix.mapRect(clip_rrect.rect());
114 SkRRect transformed_rrect;
115 SkVector corners[] = {{transformed_upper_left_x, transformed_upper_left_y},
116 {transformed_upper_right_x, transformed_upper_right_y},
117 {transformed_lower_right_x, transformed_lower_right_y},
118 {transformed_lower_left_x, transformed_lower_left_y}};
119 transformed_rrect.setRectRadii(transformed_clip_rect, corners);
120 return transformed_rrect.contains(platformview_boundingrect);
121 }

## ◆ GetCATransform3DFromSkMatrix()

static CATransform3D GetCATransform3DFromSkMatrix | ( | const SkMatrix & | matrix | ) |
| static

Definition at line 46 of file FlutterPlatformViewsController.mm.

46 {
47 // Skia only supports 2D transform so we don't map z.
48 CATransform3D transform = CATransform3DIdentity;
49 transform.m11 = matrix.getScaleX();
50 transform.m21 = matrix.getSkewX();
51 transform.m41 = matrix.getTranslateX();
52 transform.m14 = matrix.getPerspX();
53
54 transform.m12 = matrix.getSkewY();
55 transform.m22 = matrix.getScaleY();
56 transform.m42 = matrix.getTranslateY();
57 transform.m24 = matrix.getPerspY();
58 return transform;
59 }

Referenced by FlutterClippingMaskView::clipPath:matrix:, FlutterClippingMaskView::clipRect:matrix:, and FlutterClippingMaskView::clipRRect:matrix:.

## ◆ GetCGRectFromSkRect()

static CGRect GetCGRectFromSkRect | ( | const SkRect & | clipSkRect | ) |
| static

Definition at line 70 of file FlutterPlatformViewsController.mm.

70 {
71 return CGRectMake(clipSkRect.fLeft, clipSkRect.fTop, clipSkRect.fRight - clipSkRect.fLeft,
72 clipSkRect.fBottom - clipSkRect.fTop);
73 }

Referenced by FlutterClippingMaskView::clipRect:matrix:, and FlutterClippingMaskView::clipRRect:matrix:.

## ◆ ResetAnchor()

static void ResetAnchor | ( | CALayer * | layer | ) |
| static

Definition at line 64 of file FlutterPlatformViewsController.mm.

64 {
65 // Flow uses (0, 0) to apply transform matrix so we need to match that in Quartz.
66 layer.anchorPoint = CGPointZero;
67 layer.position = CGPointZero;
68 }

## Variable Documentation

## ◆ _compositionOrder

std::vector<int64_t> _compositionOrder

Definition at line 285 of file FlutterPlatformViewsController.mm.

## ◆ _currentCompositionParams

std::unordered_map<int64_t, flutter::EmbeddedViewParams> _currentCompositionParams

Definition at line 283 of file FlutterPlatformViewsController.mm.

## ◆ _factories

std::unordered_map<std::string, NSObject<FlutterPlatformViewFactory>*> _factories

Definition at line 278 of file FlutterPlatformViewsController.mm.

## ◆ _gestureRecognizersBlockingPolicies

std::unordered_map<std::string, FlutterPlatformViewGestureRecognizersBlockingPolicy> _gestureRecognizersBlockingPolicies

Definition at line 280 of file FlutterPlatformViewsController.mm.

## ◆ _platformTaskRunner

fml::RefPtr<fml::TaskRunner> _platformTaskRunner

Definition at line 281 of file FlutterPlatformViewsController.mm.

## ◆ _platformViews

std::unordered_map<int64_t, PlatformViewData> _platformViews

Definition at line 282 of file FlutterPlatformViewsController.mm.

## ◆ _previousCompositionOrder

std::vector<int64_t> _previousCompositionOrder

Definition at line 288 of file FlutterPlatformViewsController.mm.

## ◆ _slices

std::unordered_map<int64_t, std::unique_ptr<flutter::EmbedderViewSlice> > _slices

Initial value:
{
std::unique_ptr<flutter::OverlayLayerPool> _layerPool

Definition at line 268 of file FlutterPlatformViewsController.mm.

## ◆ _viewsToDispose

std::unordered_set<int64_t> _viewsToDispose

Definition at line 284 of file FlutterPlatformViewsController.mm.

## ◆ _viewsToRecomposite

std::unordered_set<int64_t> _viewsToRecomposite

Definition at line 287 of file FlutterPlatformViewsController.mm.

## ◆ _visitedPlatformViews

std::vector<int64_t> _visitedPlatformViews

Definition at line 286 of file FlutterPlatformViewsController.mm.

## ◆ kDefaultMergedLeaseDuration

constexpr int kDefaultMergedLeaseDuration = 10
| static constexpr

Definition at line 21 of file FlutterPlatformViewsController.mm.

Referenced by FlutterPlatformViewsController::endFrameWithResubmit:threadMerger:impellerEnabled:, and FlutterPlatformViewsController::postPrerollActionWithThreadMerger:impellerEnabled:.

## ◆ kFlutterClippingMaskViewPoolCapacity

constexpr NSUInteger kFlutterClippingMaskViewPoolCapacity = 5
| static constexpr

Definition at line 23 of file FlutterPlatformViewsController.mm.