Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 9cecc5f

Browse files
authored
Revert "Add GetBoundingRectAfterMutations to EmbeddedViewParams to calculate the final bounding rect for platform view (#19170)" (#19204)
This reverts commit f5c315f.
1 parent f5c315f commit 9cecc5f

File tree

7 files changed

+22
-148
lines changed

7 files changed

+22
-148
lines changed

ci/licenses_golden/licenses_flutter

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ FILE: ../../../flutter/common/task_runners.cc
2626
FILE: ../../../flutter/common/task_runners.h
2727
FILE: ../../../flutter/flow/compositor_context.cc
2828
FILE: ../../../flutter/flow/compositor_context.h
29-
FILE: ../../../flutter/flow/embedded_view_params_unittests.cc
3029
FILE: ../../../flutter/flow/embedded_views.cc
3130
FILE: ../../../flutter/flow/embedded_views.h
3231
FILE: ../../../flutter/flow/gl_context_switch.cc

flow/BUILD.gn

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ executable("flow_unittests") {
130130
testonly = true
131131

132132
sources = [
133-
"embedded_view_params_unittests.cc",
134133
"flow_run_all_unittests.cc",
135134
"flow_test_utils.cc",
136135
"flow_test_utils.h",

flow/embedded_view_params_unittests.cc

Lines changed: 0 additions & 98 deletions
This file was deleted.

flow/embedded_views.h

Lines changed: 9 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -186,49 +186,21 @@ class EmbeddedViewParams {
186186
public:
187187
EmbeddedViewParams() = default;
188188

189-
EmbeddedViewParams(SkMatrix matrix,
190-
SkSize size_points,
191-
MutatorsStack mutators_stack)
192-
: matrix_(matrix),
193-
size_points_(size_points),
194-
mutators_stack_(mutators_stack) {
195-
SkPath path;
196-
SkRect starting_rect = SkRect::MakeSize(size_points);
197-
path.addRect(starting_rect);
198-
path.transform(matrix);
199-
final_bounding_rect_ = path.computeTightBounds();
200-
}
201-
202189
EmbeddedViewParams(const EmbeddedViewParams& other) {
203-
size_points_ = other.size_points_;
204-
mutators_stack_ = other.mutators_stack_;
205-
matrix_ = other.matrix_;
206-
final_bounding_rect_ = other.final_bounding_rect_;
190+
offsetPixels = other.offsetPixels;
191+
sizePoints = other.sizePoints;
192+
mutatorsStack = other.mutatorsStack;
207193
};
208194

209-
// The original size of the platform view before any mutation matrix is
210-
// applied.
211-
const SkSize& sizePoints() const { return size_points_; };
212-
// The mutators stack contains the detailed step by step mutations for this
213-
// platform view.
214-
const MutatorsStack& mutatorsStack() const { return mutators_stack_; };
215-
// The bounding rect of the platform view after applying all the mutations.
216-
//
217-
// Clippings are ignored.
218-
const SkRect& finalBoundingRect() const { return final_bounding_rect_; }
195+
SkPoint offsetPixels;
196+
SkSize sizePoints;
197+
MutatorsStack mutatorsStack;
219198

220199
bool operator==(const EmbeddedViewParams& other) const {
221-
return size_points_ == other.size_points_ &&
222-
mutators_stack_ == other.mutators_stack_ &&
223-
final_bounding_rect_ == other.final_bounding_rect_ &&
224-
matrix_ == other.matrix_;
200+
return offsetPixels == other.offsetPixels &&
201+
sizePoints == other.sizePoints &&
202+
mutatorsStack == other.mutatorsStack;
225203
}
226-
227-
private:
228-
SkMatrix matrix_;
229-
SkSize size_points_;
230-
MutatorsStack mutators_stack_;
231-
SkRect final_bounding_rect_;
232204
};
233205

234206
enum class PostPrerollResult { kResubmitFrame, kSuccess };

flow/layers/platform_view_layer.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@ void PlatformViewLayer::Preroll(PrerollContext* context,
2727
}
2828
context->has_platform_view = true;
2929
std::unique_ptr<EmbeddedViewParams> params =
30-
std::make_unique<EmbeddedViewParams>(matrix, size_,
31-
context->mutators_stack);
30+
std::make_unique<EmbeddedViewParams>();
31+
params->offsetPixels =
32+
SkPoint::Make(matrix.getTranslateX(), matrix.getTranslateY());
33+
params->sizePoints = size_;
34+
params->mutatorsStack = context->mutators_stack;
3235
context->view_embedder->PrerollCompositeEmbeddedView(view_id_,
3336
std::move(params));
3437
}

shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,14 +407,13 @@
407407

408408
void FlutterPlatformViewsController::CompositeWithParams(int view_id,
409409
const EmbeddedViewParams& params) {
410-
CGRect frame = CGRectMake(0, 0, params.sizePoints().width(), params.sizePoints().height());
410+
CGRect frame = CGRectMake(0, 0, params.sizePoints.width(), params.sizePoints.height());
411411
UIView* touchInterceptor = touch_interceptors_[view_id].get();
412412
touchInterceptor.layer.transform = CATransform3DIdentity;
413413
touchInterceptor.frame = frame;
414414
touchInterceptor.alpha = 1;
415415

416-
const MutatorsStack& mutatorStack = params.mutatorsStack();
417-
int currentClippingCount = CountClips(mutatorStack);
416+
int currentClippingCount = CountClips(params.mutatorsStack);
418417
int previousClippingCount = clip_count_[view_id];
419418
if (currentClippingCount != previousClippingCount) {
420419
clip_count_[view_id] = currentClippingCount;
@@ -425,7 +424,7 @@
425424
ReconstructClipViewsChain(currentClippingCount, touchInterceptor, oldPlatformViewRoot);
426425
root_views_[view_id] = fml::scoped_nsobject<UIView>([newPlatformViewRoot retain]);
427426
}
428-
ApplyMutators(mutatorStack, touchInterceptor);
427+
ApplyMutators(params.mutatorsStack, touchInterceptor);
429428
}
430429

431430
SkCanvas* FlutterPlatformViewsController::CompositeEmbeddedView(int view_id) {

shell/platform/embedder/embedder_layers.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ void EmbedderLayers::PushPlatformViewLayer(
108108
view.struct_size = sizeof(FlutterPlatformView);
109109
view.identifier = identifier;
110110

111-
const auto& mutators = params.mutatorsStack();
111+
const auto& mutators = params.mutatorsStack;
112112

113113
std::vector<const FlutterPlatformViewMutation*> mutations_array;
114114

@@ -180,10 +180,10 @@ void EmbedderLayers::PushPlatformViewLayer(
180180
layer.platform_view = platform_views_referenced_.back().get();
181181

182182
const auto layer_bounds =
183-
SkRect::MakeXYWH(params.finalBoundingRect().x(), //
184-
params.finalBoundingRect().y(), //
185-
params.sizePoints().width() * device_pixel_ratio_, //
186-
params.sizePoints().height() * device_pixel_ratio_ //
183+
SkRect::MakeXYWH(params.offsetPixels.x(), //
184+
params.offsetPixels.y(), //
185+
params.sizePoints.width() * device_pixel_ratio_, //
186+
params.sizePoints.height() * device_pixel_ratio_ //
187187
);
188188

189189
const auto transformed_layer_bounds =

0 commit comments

Comments
 (0)