5 #ifndef FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERPLATFORMVIEWS_INTERNAL_H_
6 #define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERPLATFORMVIEWS_INTERNAL_H_
8 #include "flutter/flow/embedded_views.h"
9 #include "flutter/fml/platform/darwin/scoped_nsobject.h"
10 #include "flutter/shell/common/shell.h"
30 - (instancetype)
initWithFrame:(CGRect)frame screenScale:(CGFloat)screenScale;
37 - (void)clipRect:(const SkRect&)clipSkRect matrix:(const SkMatrix&)matrix;
42 - (void)clipRRect:(const SkRRect&)clipSkRRect matrix:(const SkMatrix&)matrix;
47 - (void)clipPath:(const SkPath&)path matrix:(const SkMatrix&)matrix;
63 - (instancetype)initWithCapacity:(NSInteger)capacity;
81 @property(assign, nonatomic, readonly) CGRect
frame;
86 @property(assign, nonatomic, readonly) CGFloat
blurRadius;
110 blurRadius:(CGFloat)blurRadius
111 visualEffectView:(UIVisualEffectView*)visualEffectView NS_DESIGNATED_INITIALIZER;
141 const fml::scoped_nsobject<UIView>& overlay_view_wrapper,
142 std::unique_ptr<IOSSurface> ios_surface,
143 std::unique_ptr<Surface> surface);
170 std::shared_ptr<FlutterPlatformViewLayer> GetLayer(
171 GrDirectContext* gr_context,
172 const std::shared_ptr<IOSContext>& ios_context);
176 std::vector<std::shared_ptr<FlutterPlatformViewLayer>> GetUnusedLayers();
179 void RecycleLayers();
194 size_t available_layer_index_ = 0;
195 std::vector<std::shared_ptr<FlutterPlatformViewLayer>> layers_;
206 fml::WeakPtr<flutter::FlutterPlatformViewsController> GetWeakPtr();
208 void SetFlutterView(UIView* flutter_view);
210 void SetFlutterViewController(UIViewController* flutter_view_controller);
212 UIViewController* getFlutterViewController();
214 void RegisterViewFactory(
215 NSObject<FlutterPlatformViewFactory>* factory,
220 void BeginFrame(SkISize frame_size);
226 void PrerollCompositeEmbeddedView(int64_t view_id,
227 std::unique_ptr<flutter::EmbeddedViewParams> params);
229 size_t EmbeddedViewCount();
236 UIView* GetPlatformViewByID(int64_t view_id);
245 PostPrerollResult PostPrerollAction(
246 const fml::RefPtr<fml::RasterThreadMerger>& raster_thread_merger);
248 void EndFrame(
bool should_resubmit_frame,
249 const fml::RefPtr<fml::RasterThreadMerger>& raster_thread_merger);
251 DlCanvas* CompositeEmbeddedView(int64_t view_id);
255 SkRect GetPlatformViewRect(int64_t view_id);
260 bool SubmitFrame(GrDirectContext* gr_context,
261 const std::shared_ptr<IOSContext>& ios_context,
262 std::unique_ptr<SurfaceFrame>
frame);
268 long FindFirstResponderPlatformViewId();
271 void PushFilterToVisitedPlatformViews(
const std::shared_ptr<const DlImageFilter>& filter,
272 const SkRect& filter_rect);
278 static const size_t kMaxLayerAllocations = 2;
280 using LayersMap = std::map<int64_t, std::vector<std::shared_ptr<FlutterPlatformViewLayer>>>;
294 bool HasPlatformViewThisOrNextFrame();
297 int CountClips(
const MutatorsStack& mutators_stack);
299 void ClipViewSetMaskView(UIView* clipView);
310 void ApplyMutators(
const MutatorsStack& mutators_stack,
311 UIView* embedded_view,
312 const SkRect& bounding_rect);
314 void CompositeWithParams(int64_t view_id,
const EmbeddedViewParams& params);
318 std::shared_ptr<FlutterPlatformViewLayer> GetLayer(GrDirectContext* gr_context,
319 const std::shared_ptr<IOSContext>& ios_context,
320 EmbedderViewSlice* slice,
326 void RemoveUnusedLayers();
329 void BringLayersIntoView(LayersMap layer_map);
333 void BeginCATransaction();
336 void CommitCATransactionIfNeeded();
339 void ResetFrameState();
342 std::unique_ptr<FlutterPlatformViewLayerPool> layer_pool_;
348 std::map<int64_t, std::unique_ptr<EmbedderViewSlice>> slices_;
350 fml::scoped_nsobject<FlutterMethodChannel> channel_;
351 fml::scoped_nsobject<UIView> flutter_view_;
352 fml::scoped_nsobject<UIViewController> flutter_view_controller_;
353 fml::scoped_nsobject<FlutterClippingMaskViewPool> mask_view_pool_;
354 std::map<std::string, fml::scoped_nsobject<NSObject<FlutterPlatformViewFactory>>> factories_;
355 std::map<int64_t, fml::scoped_nsobject<NSObject<FlutterPlatformView>>> views_;
356 std::map<int64_t, fml::scoped_nsobject<FlutterTouchInterceptingView>> touch_interceptors_;
362 std::map<int64_t, fml::scoped_nsobject<UIView>> root_views_;
364 std::map<int64_t, EmbeddedViewParams> current_composition_params_;
367 std::map<int64_t, int64_t> clip_count_;
375 static const int kDefaultMergedLeaseDuration = 10;
379 std::unordered_set<int64_t> views_to_dispose_;
383 std::vector<int64_t> composition_order_;
386 std::vector<int64_t> visited_platform_views_;
389 std::vector<int64_t> active_composition_order_;
392 std::unordered_set<int64_t> views_to_recomposite_;
395 std::map<std::string, FlutterPlatformViewGestureRecognizersBlockingPolicy>
396 gesture_recognizers_blocking_policies;
398 bool catransaction_added_ =
false;
401 std::unique_ptr<fml::WeakPtrFactory<FlutterPlatformViewsController>> weak_factory_;
403 #if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG
407 std::unordered_set<int64_t> non_zero_origin_views_;
421 - (instancetype)initWithEmbeddedView:(UIView*)embeddedView
422 platformViewsController:
423 (fml::WeakPtr<
flutter::FlutterPlatformViewsController>)platformViewsController
424 gestureRecognizersBlockingPolicy:
437 - (void)setFlutterAccessibilityContainer:(NSObject*)flutterAccessibilityContainer;
445 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERPLATFORMVIEWS_INTERNAL_H_