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

Remove physical model layer #41593

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ci/licenses_golden/excluded_files
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
../../../flutter/flow/layers/offscreen_surface_unittests.cc
../../../flutter/flow/layers/opacity_layer_unittests.cc
../../../flutter/flow/layers/performance_overlay_layer_unittests.cc
../../../flutter/flow/layers/physical_shape_layer_unittests.cc
../../../flutter/flow/layers/platform_view_layer_unittests.cc
../../../flutter/flow/layers/shader_mask_layer_unittests.cc
../../../flutter/flow/layers/texture_layer_unittests.cc
Expand Down
4 changes: 0 additions & 4 deletions ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -819,8 +819,6 @@ ORIGIN: ../../../flutter/flow/layers/opacity_layer.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/flow/layers/opacity_layer.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/flow/layers/performance_overlay_layer.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/flow/layers/performance_overlay_layer.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/flow/layers/physical_shape_layer.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/flow/layers/physical_shape_layer.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/flow/layers/platform_view_layer.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/flow/layers/platform_view_layer.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/flow/layers/shader_mask_layer.cc + ../../../flutter/LICENSE
Expand Down Expand Up @@ -3415,8 +3413,6 @@ FILE: ../../../flutter/flow/layers/opacity_layer.cc
FILE: ../../../flutter/flow/layers/opacity_layer.h
FILE: ../../../flutter/flow/layers/performance_overlay_layer.cc
FILE: ../../../flutter/flow/layers/performance_overlay_layer.h
FILE: ../../../flutter/flow/layers/physical_shape_layer.cc
FILE: ../../../flutter/flow/layers/physical_shape_layer.h
FILE: ../../../flutter/flow/layers/platform_view_layer.cc
FILE: ../../../flutter/flow/layers/platform_view_layer.h
FILE: ../../../flutter/flow/layers/shader_mask_layer.cc
Expand Down
3 changes: 0 additions & 3 deletions flow/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ source_set("flow") {
"layers/opacity_layer.h",
"layers/performance_overlay_layer.cc",
"layers/performance_overlay_layer.h",
"layers/physical_shape_layer.cc",
"layers/physical_shape_layer.h",
"layers/platform_view_layer.cc",
"layers/platform_view_layer.h",
"layers/shader_mask_layer.cc",
Expand Down Expand Up @@ -162,7 +160,6 @@ if (enable_unittests) {
"layers/offscreen_surface_unittests.cc",
"layers/opacity_layer_unittests.cc",
"layers/performance_overlay_layer_unittests.cc",
"layers/physical_shape_layer_unittests.cc",
"layers/platform_view_layer_unittests.cc",
"layers/shader_mask_layer_unittests.cc",
"layers/texture_layer_unittests.cc",
Expand Down
4 changes: 1 addition & 3 deletions flow/compositor_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ std::optional<SkRect> FrameDamage::ComputeClipRect(
bool has_raster_cache) {
if (layer_tree.root_layer()) {
PaintRegionMap empty_paint_region_map;
DiffContext context(layer_tree.frame_size(),
layer_tree.device_pixel_ratio(),
layer_tree.paint_region_map(),
DiffContext context(layer_tree.frame_size(), layer_tree.paint_region_map(),
prev_layer_tree_ ? prev_layer_tree_->paint_region_map()
: empty_paint_region_map,
has_raster_cache);
Expand Down
2 changes: 0 additions & 2 deletions flow/diff_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
namespace flutter {

DiffContext::DiffContext(SkISize frame_size,
double frame_device_pixel_ratio,
PaintRegionMap& this_frame_paint_region_map,
const PaintRegionMap& last_frame_paint_region_map,
bool has_raster_cache)
: clip_tracker_(DisplayListMatrixClipTracker(kGiantRect, SkMatrix::I())),
rects_(std::make_shared<std::vector<SkRect>>()),
frame_size_(frame_size),
frame_device_pixel_ratio_(frame_device_pixel_ratio),
this_frame_paint_region_map_(this_frame_paint_region_map),
last_frame_paint_region_map_(last_frame_paint_region_map),
has_raster_cache_(has_raster_cache) {}
Expand Down
4 changes: 0 additions & 4 deletions flow/diff_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ using PaintRegionMap = std::map<uint64_t, PaintRegion>;
class DiffContext {
public:
explicit DiffContext(SkISize frame_size,
double device_pixel_aspect_ratio,
PaintRegionMap& this_frame_paint_region_map,
const PaintRegionMap& last_frame_paint_region_map,
bool has_raster_cache);
Expand Down Expand Up @@ -141,8 +140,6 @@ class DiffContext {
int horizontal_clip_alignment = 0,
int vertical_clip_alignment = 0) const;

double frame_device_pixel_ratio() const { return frame_device_pixel_ratio_; };

// Adds the region to current damage. Used for removed layers, where instead
// of diffing the layer its paint region is direcly added to damage.
void AddDamage(const PaintRegion& damage);
Expand Down Expand Up @@ -234,7 +231,6 @@ class DiffContext {
std::shared_ptr<std::vector<SkRect>> rects_;
State state_;
SkISize frame_size_;
double frame_device_pixel_ratio_;
std::vector<State> state_stack_;
std::vector<FilterBoundsAdjustment> filter_bounds_adjustment_stack_;

Expand Down
67 changes: 0 additions & 67 deletions flow/layers/checkerboard_layertree_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "flutter/flow/layers/clip_path_layer.h"
#include "flutter/flow/layers/clip_rect_layer.h"
#include "flutter/flow/layers/clip_rrect_layer.h"
#include "flutter/flow/layers/physical_shape_layer.h"
#include "flutter/flow/testing/layer_test.h"
#include "flutter/flow/testing/mock_layer.h"
#include "flutter/fml/macros.h"
Expand Down Expand Up @@ -221,72 +220,6 @@ TEST_F(CheckerBoardLayerTest, ClipRRectSaveLayerCheckBoard) {
MockCanvas::DrawCall{1, MockCanvas::RestoreData{0}}}));
}

TEST_F(CheckerBoardLayerTest, PhysicalSaveLayerCheckBoard) {
constexpr float initial_elevation = 20.0f;
const SkRect paint_bounds = SkRect::MakeXYWH(0, 0, 8, 8);
SkPath layer_path =
SkPath().addRect(paint_bounds).addOval(paint_bounds.makeInset(0.1, 0.1));
auto layer = std::make_shared<PhysicalShapeLayer>(
SK_ColorGREEN, SK_ColorBLACK, initial_elevation, layer_path,
Clip::antiAliasWithSaveLayer);

layer->Preroll(preroll_context());
// The Fuchsia system compositor handles all elevated PhysicalShapeLayers and
// their shadows , so we do not do any painting there.
EXPECT_EQ(layer->paint_bounds(),
DlCanvas::ComputeShadowBounds(layer_path, initial_elevation, 1.0f,
SkMatrix()));
EXPECT_TRUE(layer->needs_painting(paint_context()));
EXPECT_EQ(layer->elevation(), initial_elevation);

const DlPaint clip_paint;
DlPaint layer_paint;
layer_paint.setColor(SK_ColorGREEN);
layer_paint.setAntiAlias(true);
layer->Paint(paint_context());
EXPECT_EQ(
mock_canvas().draw_calls(),
std::vector(
{MockCanvas::DrawCall{
0, MockCanvas::DrawShadowData{layer_path, DlColor::kBlack(),
initial_elevation, false, 1}},
MockCanvas::DrawCall{0, MockCanvas::SaveData{1}},
MockCanvas::DrawCall{
1, MockCanvas::ClipPathData{layer_path, ClipOp::kIntersect,
MockCanvas::kSoft_ClipEdgeStyle}},
MockCanvas::DrawCall{
1, MockCanvas::SaveLayerData{layer->paint_bounds(), clip_paint,
nullptr, 2}},
MockCanvas::DrawCall{2, MockCanvas::DrawPaintData{layer_paint}},
MockCanvas::DrawCall{2, MockCanvas::RestoreData{1}},
MockCanvas::DrawCall{1, MockCanvas::RestoreData{0}}}));

mock_canvas().reset_draw_calls();

layer->Paint(checkerboard_context());
EXPECT_EQ(
mock_canvas().draw_calls(),
std::vector(
{MockCanvas::DrawCall{
0, MockCanvas::DrawShadowData{layer_path, DlColor::kBlack(),
initial_elevation, false, 1}},
MockCanvas::DrawCall{0, MockCanvas::SaveData{1}},
MockCanvas::DrawCall{
1, MockCanvas::ClipPathData{layer_path, ClipOp::kIntersect,
MockCanvas::kSoft_ClipEdgeStyle}},
MockCanvas::DrawCall{
1, MockCanvas::SaveLayerData{layer->paint_bounds(), clip_paint,
nullptr, 2}},
MockCanvas::DrawCall{2, MockCanvas::DrawPaintData{layer_paint}},
// start DrawCheckerboard calls
MockCanvas::DrawCall{2,
MockCanvas::DrawRectData{layer->paint_bounds(),
checkerboard_paint()}},
// end DrawCheckerboard calls
MockCanvas::DrawCall{2, MockCanvas::RestoreData{1}},
MockCanvas::DrawCall{1, MockCanvas::RestoreData{0}}}));
}

#endif
} // namespace testing
} // namespace flutter
2 changes: 0 additions & 2 deletions flow/layers/layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ struct PrerollContext {
const Stopwatch& raster_time;
const Stopwatch& ui_time;
std::shared_ptr<TextureRegistry> texture_registry;
const float frame_device_pixel_ratio = 1.0f;

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

// Snapshot store to collect leaf layer snapshots. The store is non-null
// only when leaf layer tracing is enabled.
Expand Down
1 change: 0 additions & 1 deletion flow/layers/layer_raster_cache_item.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ bool Rasterize(RasterCacheItem::CacheState cache_state,
.ui_time = paint_context.ui_time,
.texture_registry = paint_context.texture_registry,
.raster_cache = paint_context.raster_cache,
.frame_device_pixel_ratio = paint_context.frame_device_pixel_ratio,
// clang-format on
};

Expand Down
4 changes: 0 additions & 4 deletions flow/layers/layer_tree.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ bool LayerTree::Preroll(CompositorContext::ScopedFrame& frame,
.raster_time = frame.context().raster_time(),
.ui_time = frame.context().ui_time(),
.texture_registry = frame.context().texture_registry(),
.frame_device_pixel_ratio = device_pixel_ratio_,
.raster_cached_entries = &raster_cache_items_,
.display_list_enabled = frame.display_list_builder() != nullptr,
// clang-format on
Expand Down Expand Up @@ -141,7 +140,6 @@ void LayerTree::Paint(CompositorContext::ScopedFrame& frame,
.ui_time = frame.context().ui_time(),
.texture_registry = frame.context().texture_registry(),
.raster_cache = cache,
.frame_device_pixel_ratio = device_pixel_ratio_,
.layer_snapshot_store = snapshot_store,
.enable_leaf_layer_tracing = enable_leaf_layer_tracing_,
.aiks_context = frame.aiks_context(),
Expand Down Expand Up @@ -182,7 +180,6 @@ sk_sp<DisplayList> LayerTree::Flatten(
.raster_time = unused_stopwatch,
.ui_time = unused_stopwatch,
.texture_registry = texture_registry,
.frame_device_pixel_ratio = device_pixel_ratio_
// clang-format on
};

Expand All @@ -199,7 +196,6 @@ sk_sp<DisplayList> LayerTree::Flatten(
.ui_time = unused_stopwatch,
.texture_registry = texture_registry,
.raster_cache = nullptr,
.frame_device_pixel_ratio = device_pixel_ratio_,
.layer_snapshot_store = nullptr,
.enable_leaf_layer_tracing = false,
// clang-format on
Expand Down
2 changes: 0 additions & 2 deletions flow/layers/layer_tree_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ TEST_F(LayerTreeTest, PrerollContextInitialization) {
EXPECT_EQ(&context.raster_time, &mock_raster_time);
EXPECT_EQ(&context.ui_time, &mock_ui_time);
EXPECT_EQ(context.texture_registry.get(), mock_registry.get());
EXPECT_EQ(context.frame_device_pixel_ratio, 1.0f);

EXPECT_EQ(context.has_platform_view, false);
EXPECT_EQ(context.has_texture_layer, false);
Expand Down Expand Up @@ -252,7 +251,6 @@ TEST_F(LayerTreeTest, PaintContextInitialization) {
EXPECT_EQ(context.texture_registry.get(), mock_registry.get());
EXPECT_EQ(context.raster_cache, nullptr);
EXPECT_EQ(context.state_stack.checkerboard_func(), nullptr);
EXPECT_EQ(context.frame_device_pixel_ratio, 1.0f);

EXPECT_EQ(context.enable_leaf_layer_tracing, false);
EXPECT_EQ(context.layer_snapshot_store, nullptr);
Expand Down
1 change: 0 additions & 1 deletion flow/layers/performance_overlay_layer_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ static void TestPerformanceOverlayLayerGold(int refresh_rate) {
.ui_time = mock_stopwatch,
.texture_registry = nullptr,
.raster_cache = nullptr,
.frame_device_pixel_ratio = 1.0f,
// clang-format on
};

Expand Down
124 changes: 0 additions & 124 deletions flow/layers/physical_shape_layer.cc

This file was deleted.

Loading