未验证 提交 2fcd4e79 编写于 作者: C Chris Yang 提交者: GitHub

Do nothing if the params didn't change when compositing iOS platform views. (#8999)

上级 9dfa276f
......@@ -18,6 +18,10 @@ class EmbeddedViewParams {
public:
SkPoint offsetPixels;
SkSize sizePoints;
bool operator==(const EmbeddedViewParams& other) const {
return offsetPixels == other.offsetPixels && sizePoints == other.sizePoints;
}
};
// This is only used on iOS when running in a non headless mode,
......
......@@ -187,7 +187,14 @@ SkCanvas* FlutterPlatformViewsController::CompositeEmbeddedView(
const flutter::EmbeddedViewParams& params) {
// TODO(amirh): assert that this is running on the platform thread once we support the iOS
// embedded views thread configuration.
// TODO(amirh): do nothing if the params didn't change.
// Do nothing if the params didn't change.
if (current_composition_params_.count(view_id) == 1 &&
current_composition_params_[view_id] == params) {
return picture_recorders_[view_id]->getRecordingCanvas();
}
current_composition_params_[view_id] = params;
CGFloat screenScale = [[UIScreen mainScreen] scale];
CGRect rect =
CGRectMake(params.offsetPixels.x() / screenScale, params.offsetPixels.y() / screenScale,
......@@ -209,6 +216,7 @@ void FlutterPlatformViewsController::Reset() {
composition_order_.clear();
active_composition_order_.clear();
picture_recorders_.clear();
current_composition_params_.clear();
}
bool FlutterPlatformViewsController::SubmitFrame(bool gl_rendering,
......@@ -288,6 +296,7 @@ void FlutterPlatformViewsController::DisposeViews() {
views_.erase(viewId);
touch_interceptors_.erase(viewId);
overlays_.erase(viewId);
current_composition_params_.erase(viewId);
}
views_to_dispose_.clear();
}
......
......@@ -88,6 +88,8 @@ class FlutterPlatformViewsController {
std::map<std::string, fml::scoped_nsobject<NSObject<FlutterPlatformViewFactory>>> factories_;
std::map<int64_t, fml::scoped_nsobject<NSObject<FlutterPlatformView>>> views_;
std::map<int64_t, fml::scoped_nsobject<FlutterTouchInterceptingView>> touch_interceptors_;
// Mapping a platform view ID to its latest composition params.
std::map<int64_t, EmbeddedViewParams> current_composition_params_;
std::map<int64_t, std::unique_ptr<FlutterPlatformViewLayer>> overlays_;
// The GrContext that is currently used by all of the overlay surfaces.
// We track this to know when the GrContext for the Flutter app has changed
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册