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

Commit 1057b40

Browse files
Remove physical model layer (#41593)
Removes the physical model layer and associated engine code. This was already deprecated and removed in the framework. By removing it in the engine, we can also remove the need for layer tree diff/paint/preroll to have the device pixel ratio. This will simplify some of the multi-view work Fixes flutter/flutter#125720
1 parent 28e4a21 commit 1057b40

39 files changed

+5
-1921
lines changed

ci/licenses_golden/excluded_files

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
../../../flutter/flow/layers/offscreen_surface_unittests.cc
6868
../../../flutter/flow/layers/opacity_layer_unittests.cc
6969
../../../flutter/flow/layers/performance_overlay_layer_unittests.cc
70-
../../../flutter/flow/layers/physical_shape_layer_unittests.cc
7170
../../../flutter/flow/layers/platform_view_layer_unittests.cc
7271
../../../flutter/flow/layers/shader_mask_layer_unittests.cc
7372
../../../flutter/flow/layers/texture_layer_unittests.cc

ci/licenses_golden/licenses_flutter

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -819,8 +819,6 @@ ORIGIN: ../../../flutter/flow/layers/opacity_layer.cc + ../../../flutter/LICENSE
819819
ORIGIN: ../../../flutter/flow/layers/opacity_layer.h + ../../../flutter/LICENSE
820820
ORIGIN: ../../../flutter/flow/layers/performance_overlay_layer.cc + ../../../flutter/LICENSE
821821
ORIGIN: ../../../flutter/flow/layers/performance_overlay_layer.h + ../../../flutter/LICENSE
822-
ORIGIN: ../../../flutter/flow/layers/physical_shape_layer.cc + ../../../flutter/LICENSE
823-
ORIGIN: ../../../flutter/flow/layers/physical_shape_layer.h + ../../../flutter/LICENSE
824822
ORIGIN: ../../../flutter/flow/layers/platform_view_layer.cc + ../../../flutter/LICENSE
825823
ORIGIN: ../../../flutter/flow/layers/platform_view_layer.h + ../../../flutter/LICENSE
826824
ORIGIN: ../../../flutter/flow/layers/shader_mask_layer.cc + ../../../flutter/LICENSE
@@ -3415,8 +3413,6 @@ FILE: ../../../flutter/flow/layers/opacity_layer.cc
34153413
FILE: ../../../flutter/flow/layers/opacity_layer.h
34163414
FILE: ../../../flutter/flow/layers/performance_overlay_layer.cc
34173415
FILE: ../../../flutter/flow/layers/performance_overlay_layer.h
3418-
FILE: ../../../flutter/flow/layers/physical_shape_layer.cc
3419-
FILE: ../../../flutter/flow/layers/physical_shape_layer.h
34203416
FILE: ../../../flutter/flow/layers/platform_view_layer.cc
34213417
FILE: ../../../flutter/flow/layers/platform_view_layer.h
34223418
FILE: ../../../flutter/flow/layers/shader_mask_layer.cc

flow/BUILD.gn

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ source_set("flow") {
5656
"layers/opacity_layer.h",
5757
"layers/performance_overlay_layer.cc",
5858
"layers/performance_overlay_layer.h",
59-
"layers/physical_shape_layer.cc",
60-
"layers/physical_shape_layer.h",
6159
"layers/platform_view_layer.cc",
6260
"layers/platform_view_layer.h",
6361
"layers/shader_mask_layer.cc",
@@ -162,7 +160,6 @@ if (enable_unittests) {
162160
"layers/offscreen_surface_unittests.cc",
163161
"layers/opacity_layer_unittests.cc",
164162
"layers/performance_overlay_layer_unittests.cc",
165-
"layers/physical_shape_layer_unittests.cc",
166163
"layers/platform_view_layer_unittests.cc",
167164
"layers/shader_mask_layer_unittests.cc",
168165
"layers/texture_layer_unittests.cc",

flow/compositor_context.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ std::optional<SkRect> FrameDamage::ComputeClipRect(
1616
bool has_raster_cache) {
1717
if (layer_tree.root_layer()) {
1818
PaintRegionMap empty_paint_region_map;
19-
DiffContext context(layer_tree.frame_size(),
20-
layer_tree.device_pixel_ratio(),
21-
layer_tree.paint_region_map(),
19+
DiffContext context(layer_tree.frame_size(), layer_tree.paint_region_map(),
2220
prev_layer_tree_ ? prev_layer_tree_->paint_region_map()
2321
: empty_paint_region_map,
2422
has_raster_cache);

flow/diff_context.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@
88
namespace flutter {
99

1010
DiffContext::DiffContext(SkISize frame_size,
11-
double frame_device_pixel_ratio,
1211
PaintRegionMap& this_frame_paint_region_map,
1312
const PaintRegionMap& last_frame_paint_region_map,
1413
bool has_raster_cache)
1514
: clip_tracker_(DisplayListMatrixClipTracker(kGiantRect, SkMatrix::I())),
1615
rects_(std::make_shared<std::vector<SkRect>>()),
1716
frame_size_(frame_size),
18-
frame_device_pixel_ratio_(frame_device_pixel_ratio),
1917
this_frame_paint_region_map_(this_frame_paint_region_map),
2018
last_frame_paint_region_map_(last_frame_paint_region_map),
2119
has_raster_cache_(has_raster_cache) {}

flow/diff_context.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ using PaintRegionMap = std::map<uint64_t, PaintRegion>;
4343
class DiffContext {
4444
public:
4545
explicit DiffContext(SkISize frame_size,
46-
double device_pixel_aspect_ratio,
4746
PaintRegionMap& this_frame_paint_region_map,
4847
const PaintRegionMap& last_frame_paint_region_map,
4948
bool has_raster_cache);
@@ -141,8 +140,6 @@ class DiffContext {
141140
int horizontal_clip_alignment = 0,
142141
int vertical_clip_alignment = 0) const;
143142

144-
double frame_device_pixel_ratio() const { return frame_device_pixel_ratio_; };
145-
146143
// Adds the region to current damage. Used for removed layers, where instead
147144
// of diffing the layer its paint region is direcly added to damage.
148145
void AddDamage(const PaintRegion& damage);
@@ -234,7 +231,6 @@ class DiffContext {
234231
std::shared_ptr<std::vector<SkRect>> rects_;
235232
State state_;
236233
SkISize frame_size_;
237-
double frame_device_pixel_ratio_;
238234
std::vector<State> state_stack_;
239235
std::vector<FilterBoundsAdjustment> filter_bounds_adjustment_stack_;
240236

flow/layers/checkerboard_layertree_unittests.cc

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include "flutter/flow/layers/clip_path_layer.h"
66
#include "flutter/flow/layers/clip_rect_layer.h"
77
#include "flutter/flow/layers/clip_rrect_layer.h"
8-
#include "flutter/flow/layers/physical_shape_layer.h"
98
#include "flutter/flow/testing/layer_test.h"
109
#include "flutter/flow/testing/mock_layer.h"
1110
#include "flutter/fml/macros.h"
@@ -221,72 +220,6 @@ TEST_F(CheckerBoardLayerTest, ClipRRectSaveLayerCheckBoard) {
221220
MockCanvas::DrawCall{1, MockCanvas::RestoreData{0}}}));
222221
}
223222

224-
TEST_F(CheckerBoardLayerTest, PhysicalSaveLayerCheckBoard) {
225-
constexpr float initial_elevation = 20.0f;
226-
const SkRect paint_bounds = SkRect::MakeXYWH(0, 0, 8, 8);
227-
SkPath layer_path =
228-
SkPath().addRect(paint_bounds).addOval(paint_bounds.makeInset(0.1, 0.1));
229-
auto layer = std::make_shared<PhysicalShapeLayer>(
230-
SK_ColorGREEN, SK_ColorBLACK, initial_elevation, layer_path,
231-
Clip::antiAliasWithSaveLayer);
232-
233-
layer->Preroll(preroll_context());
234-
// The Fuchsia system compositor handles all elevated PhysicalShapeLayers and
235-
// their shadows , so we do not do any painting there.
236-
EXPECT_EQ(layer->paint_bounds(),
237-
DlCanvas::ComputeShadowBounds(layer_path, initial_elevation, 1.0f,
238-
SkMatrix()));
239-
EXPECT_TRUE(layer->needs_painting(paint_context()));
240-
EXPECT_EQ(layer->elevation(), initial_elevation);
241-
242-
const DlPaint clip_paint;
243-
DlPaint layer_paint;
244-
layer_paint.setColor(SK_ColorGREEN);
245-
layer_paint.setAntiAlias(true);
246-
layer->Paint(paint_context());
247-
EXPECT_EQ(
248-
mock_canvas().draw_calls(),
249-
std::vector(
250-
{MockCanvas::DrawCall{
251-
0, MockCanvas::DrawShadowData{layer_path, DlColor::kBlack(),
252-
initial_elevation, false, 1}},
253-
MockCanvas::DrawCall{0, MockCanvas::SaveData{1}},
254-
MockCanvas::DrawCall{
255-
1, MockCanvas::ClipPathData{layer_path, ClipOp::kIntersect,
256-
MockCanvas::kSoft_ClipEdgeStyle}},
257-
MockCanvas::DrawCall{
258-
1, MockCanvas::SaveLayerData{layer->paint_bounds(), clip_paint,
259-
nullptr, 2}},
260-
MockCanvas::DrawCall{2, MockCanvas::DrawPaintData{layer_paint}},
261-
MockCanvas::DrawCall{2, MockCanvas::RestoreData{1}},
262-
MockCanvas::DrawCall{1, MockCanvas::RestoreData{0}}}));
263-
264-
mock_canvas().reset_draw_calls();
265-
266-
layer->Paint(checkerboard_context());
267-
EXPECT_EQ(
268-
mock_canvas().draw_calls(),
269-
std::vector(
270-
{MockCanvas::DrawCall{
271-
0, MockCanvas::DrawShadowData{layer_path, DlColor::kBlack(),
272-
initial_elevation, false, 1}},
273-
MockCanvas::DrawCall{0, MockCanvas::SaveData{1}},
274-
MockCanvas::DrawCall{
275-
1, MockCanvas::ClipPathData{layer_path, ClipOp::kIntersect,
276-
MockCanvas::kSoft_ClipEdgeStyle}},
277-
MockCanvas::DrawCall{
278-
1, MockCanvas::SaveLayerData{layer->paint_bounds(), clip_paint,
279-
nullptr, 2}},
280-
MockCanvas::DrawCall{2, MockCanvas::DrawPaintData{layer_paint}},
281-
// start DrawCheckerboard calls
282-
MockCanvas::DrawCall{2,
283-
MockCanvas::DrawRectData{layer->paint_bounds(),
284-
checkerboard_paint()}},
285-
// end DrawCheckerboard calls
286-
MockCanvas::DrawCall{2, MockCanvas::RestoreData{1}},
287-
MockCanvas::DrawCall{1, MockCanvas::RestoreData{0}}}));
288-
}
289-
290223
#endif
291224
} // namespace testing
292225
} // namespace flutter

flow/layers/layer.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ struct PrerollContext {
6363
const Stopwatch& raster_time;
6464
const Stopwatch& ui_time;
6565
std::shared_ptr<TextureRegistry> texture_registry;
66-
const float frame_device_pixel_ratio = 1.0f;
6766

6867
// These allow us to track properties like elevation, opacity, and the
6968
// presence of a platform view during Preroll.
@@ -114,7 +113,6 @@ struct PaintContext {
114113
const Stopwatch& ui_time;
115114
std::shared_ptr<TextureRegistry> texture_registry;
116115
const RasterCache* raster_cache;
117-
const float frame_device_pixel_ratio = 1.0f;
118116

119117
// Snapshot store to collect leaf layer snapshots. The store is non-null
120118
// only when leaf layer tracing is enabled.

flow/layers/layer_raster_cache_item.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ bool Rasterize(RasterCacheItem::CacheState cache_state,
118118
.ui_time = paint_context.ui_time,
119119
.texture_registry = paint_context.texture_registry,
120120
.raster_cache = paint_context.raster_cache,
121-
.frame_device_pixel_ratio = paint_context.frame_device_pixel_ratio,
122121
// clang-format on
123122
};
124123

flow/layers/layer_tree.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ bool LayerTree::Preroll(CompositorContext::ScopedFrame& frame,
6464
.raster_time = frame.context().raster_time(),
6565
.ui_time = frame.context().ui_time(),
6666
.texture_registry = frame.context().texture_registry(),
67-
.frame_device_pixel_ratio = device_pixel_ratio_,
6867
.raster_cached_entries = &raster_cache_items_,
6968
.display_list_enabled = frame.display_list_builder() != nullptr,
7069
// clang-format on
@@ -141,7 +140,6 @@ void LayerTree::Paint(CompositorContext::ScopedFrame& frame,
141140
.ui_time = frame.context().ui_time(),
142141
.texture_registry = frame.context().texture_registry(),
143142
.raster_cache = cache,
144-
.frame_device_pixel_ratio = device_pixel_ratio_,
145143
.layer_snapshot_store = snapshot_store,
146144
.enable_leaf_layer_tracing = enable_leaf_layer_tracing_,
147145
.aiks_context = frame.aiks_context(),
@@ -182,7 +180,6 @@ sk_sp<DisplayList> LayerTree::Flatten(
182180
.raster_time = unused_stopwatch,
183181
.ui_time = unused_stopwatch,
184182
.texture_registry = texture_registry,
185-
.frame_device_pixel_ratio = device_pixel_ratio_
186183
// clang-format on
187184
};
188185

@@ -199,7 +196,6 @@ sk_sp<DisplayList> LayerTree::Flatten(
199196
.ui_time = unused_stopwatch,
200197
.texture_registry = texture_registry,
201198
.raster_cache = nullptr,
202-
.frame_device_pixel_ratio = device_pixel_ratio_,
203199
.layer_snapshot_store = nullptr,
204200
.enable_leaf_layer_tracing = false,
205201
// clang-format on

flow/layers/layer_tree_unittests.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ TEST_F(LayerTreeTest, PrerollContextInitialization) {
216216
EXPECT_EQ(&context.raster_time, &mock_raster_time);
217217
EXPECT_EQ(&context.ui_time, &mock_ui_time);
218218
EXPECT_EQ(context.texture_registry.get(), mock_registry.get());
219-
EXPECT_EQ(context.frame_device_pixel_ratio, 1.0f);
220219

221220
EXPECT_EQ(context.has_platform_view, false);
222221
EXPECT_EQ(context.has_texture_layer, false);
@@ -252,7 +251,6 @@ TEST_F(LayerTreeTest, PaintContextInitialization) {
252251
EXPECT_EQ(context.texture_registry.get(), mock_registry.get());
253252
EXPECT_EQ(context.raster_cache, nullptr);
254253
EXPECT_EQ(context.state_stack.checkerboard_func(), nullptr);
255-
EXPECT_EQ(context.frame_device_pixel_ratio, 1.0f);
256254

257255
EXPECT_EQ(context.enable_leaf_layer_tracing, false);
258256
EXPECT_EQ(context.layer_snapshot_store, nullptr);

flow/layers/performance_overlay_layer_unittests.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ static void TestPerformanceOverlayLayerGold(int refresh_rate) {
7474
.ui_time = mock_stopwatch,
7575
.texture_registry = nullptr,
7676
.raster_cache = nullptr,
77-
.frame_device_pixel_ratio = 1.0f,
7877
// clang-format on
7978
};
8079

flow/layers/physical_shape_layer.cc

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

0 commit comments

Comments
 (0)