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

Commit b425467

Browse files
authored
Revert "Reland "add non-rendering operation culling to DisplayListBuilder" (#41463) (#42330)"
This reverts commit 3a453f2.
1 parent f3f6a02 commit b425467

20 files changed

+311
-1265
lines changed

display_list/benchmarking/dl_complexity_unittests.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ TEST(DisplayListComplexity, DrawAtlas) {
423423
std::vector<SkRSXform> xforms;
424424
for (int i = 0; i < 10; i++) {
425425
rects.push_back(SkRect::MakeXYWH(0, 0, 10, 10));
426-
xforms.push_back(SkRSXform::Make(1, 0, 0, 0));
426+
xforms.push_back(SkRSXform::Make(0, 0, 0, 0));
427427
}
428428

429429
DisplayListBuilder builder;

display_list/display_list.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ DisplayList::DisplayList()
2222
unique_id_(0),
2323
bounds_({0, 0, 0, 0}),
2424
can_apply_group_opacity_(true),
25-
is_ui_thread_safe_(true),
26-
modifies_transparent_black_(false) {}
25+
is_ui_thread_safe_(true) {}
2726

2827
DisplayList::DisplayList(DisplayListStorage&& storage,
2928
size_t byte_count,
@@ -33,7 +32,6 @@ DisplayList::DisplayList(DisplayListStorage&& storage,
3332
const SkRect& bounds,
3433
bool can_apply_group_opacity,
3534
bool is_ui_thread_safe,
36-
bool modifies_transparent_black,
3735
sk_sp<const DlRTree> rtree)
3836
: storage_(std::move(storage)),
3937
byte_count_(byte_count),
@@ -44,7 +42,6 @@ DisplayList::DisplayList(DisplayListStorage&& storage,
4442
bounds_(bounds),
4543
can_apply_group_opacity_(can_apply_group_opacity),
4644
is_ui_thread_safe_(is_ui_thread_safe),
47-
modifies_transparent_black_(modifies_transparent_black),
4845
rtree_(std::move(rtree)) {}
4946

5047
DisplayList::~DisplayList() {

display_list/display_list.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -265,19 +265,6 @@ class DisplayList : public SkRefCnt {
265265
bool can_apply_group_opacity() const { return can_apply_group_opacity_; }
266266
bool isUIThreadSafe() const { return is_ui_thread_safe_; }
267267

268-
/// @brief Indicates if there are any rendering operations in this
269-
/// DisplayList that will modify a surface of transparent black
270-
/// pixels.
271-
///
272-
/// This condition can be used to determine whether to create a cleared
273-
/// surface, render a DisplayList into it, and then composite the
274-
/// result into a scene. It is not uncommon for code in the engine to
275-
/// come across such degenerate DisplayList objects when slicing up a
276-
/// frame between platform views.
277-
bool modifies_transparent_black() const {
278-
return modifies_transparent_black_;
279-
}
280-
281268
private:
282269
DisplayList(DisplayListStorage&& ptr,
283270
size_t byte_count,
@@ -287,7 +274,6 @@ class DisplayList : public SkRefCnt {
287274
const SkRect& bounds,
288275
bool can_apply_group_opacity,
289276
bool is_ui_thread_safe,
290-
bool modifies_transparent_black,
291277
sk_sp<const DlRTree> rtree);
292278

293279
static uint32_t next_unique_id();
@@ -306,8 +292,6 @@ class DisplayList : public SkRefCnt {
306292

307293
const bool can_apply_group_opacity_;
308294
const bool is_ui_thread_safe_;
309-
const bool modifies_transparent_black_;
310-
311295
const sk_sp<const DlRTree> rtree_;
312296

313297
void Dispatch(DlOpReceiver& ctx,

display_list/display_list_unittests.cc

Lines changed: 0 additions & 160 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include "flutter/testing/testing.h"
2323

2424
#include "third_party/skia/include/core/SkPictureRecorder.h"
25-
#include "third_party/skia/include/core/SkRSXform.h"
2625
#include "third_party/skia/include/core/SkSurface.h"
2726

2827
namespace flutter {
@@ -2875,164 +2874,5 @@ TEST_F(DisplayListTest, DrawSaveDrawCannotInheritOpacity) {
28752874
ASSERT_FALSE(display_list->can_apply_group_opacity());
28762875
}
28772876

2878-
TEST_F(DisplayListTest, NopOperationsOmittedFromRecords) {
2879-
auto run_tests = [](const std::string& name,
2880-
void init(DisplayListBuilder & builder, DlPaint & paint),
2881-
uint32_t expected_op_count = 0u) {
2882-
auto run_one_test =
2883-
[init](const std::string& name,
2884-
void build(DisplayListBuilder & builder, DlPaint & paint),
2885-
uint32_t expected_op_count = 0u) {
2886-
DisplayListBuilder builder;
2887-
DlPaint paint;
2888-
init(builder, paint);
2889-
build(builder, paint);
2890-
auto list = builder.Build();
2891-
if (list->op_count() != expected_op_count) {
2892-
FML_LOG(ERROR) << *list;
2893-
}
2894-
ASSERT_EQ(list->op_count(), expected_op_count) << name;
2895-
ASSERT_TRUE(list->bounds().isEmpty()) << name;
2896-
};
2897-
run_one_test(
2898-
name + " DrawColor",
2899-
[](DisplayListBuilder& builder, DlPaint& paint) {
2900-
builder.DrawColor(paint.getColor(), paint.getBlendMode());
2901-
},
2902-
expected_op_count);
2903-
run_one_test(
2904-
name + " DrawPaint",
2905-
[](DisplayListBuilder& builder, DlPaint& paint) {
2906-
builder.DrawPaint(paint);
2907-
},
2908-
expected_op_count);
2909-
run_one_test(
2910-
name + " DrawRect",
2911-
[](DisplayListBuilder& builder, DlPaint& paint) {
2912-
builder.DrawRect({10, 10, 20, 20}, paint);
2913-
},
2914-
expected_op_count);
2915-
run_one_test(
2916-
name + " Other Draw Ops",
2917-
[](DisplayListBuilder& builder, DlPaint& paint) {
2918-
builder.DrawLine({10, 10}, {20, 20}, paint);
2919-
builder.DrawOval({10, 10, 20, 20}, paint);
2920-
builder.DrawCircle({50, 50}, 20, paint);
2921-
builder.DrawRRect(SkRRect::MakeRectXY({10, 10, 20, 20}, 5, 5), paint);
2922-
builder.DrawDRRect(SkRRect::MakeRectXY({5, 5, 100, 100}, 5, 5),
2923-
SkRRect::MakeRectXY({10, 10, 20, 20}, 5, 5),
2924-
paint);
2925-
builder.DrawPath(kTestPath1, paint);
2926-
builder.DrawArc({10, 10, 20, 20}, 45, 90, true, paint);
2927-
SkPoint pts[] = {{10, 10}, {20, 20}};
2928-
builder.DrawPoints(PointMode::kLines, 2, pts, paint);
2929-
builder.DrawVertices(TestVertices1, DlBlendMode::kSrcOver, paint);
2930-
builder.DrawImage(TestImage1, {10, 10}, DlImageSampling::kLinear,
2931-
&paint);
2932-
builder.DrawImageRect(TestImage1, SkRect{0.0f, 0.0f, 10.0f, 10.0f},
2933-
SkRect{10.0f, 10.0f, 25.0f, 25.0f},
2934-
DlImageSampling::kLinear, &paint);
2935-
builder.DrawImageNine(TestImage1, {10, 10, 20, 20},
2936-
{10, 10, 100, 100}, DlFilterMode::kLinear,
2937-
&paint);
2938-
SkRSXform xforms[] = {{1, 0, 10, 10}, {0, 1, 10, 10}};
2939-
SkRect rects[] = {{10, 10, 20, 20}, {10, 20, 30, 20}};
2940-
builder.DrawAtlas(TestImage1, xforms, rects, nullptr, 2,
2941-
DlBlendMode::kSrcOver, DlImageSampling::kLinear,
2942-
nullptr, &paint);
2943-
builder.DrawTextBlob(TestBlob1, 10, 10, paint);
2944-
2945-
// Dst mode eliminates most rendering ops except for
2946-
// the following two, so we'll prune those manually...
2947-
if (paint.getBlendMode() != DlBlendMode::kDst) {
2948-
builder.DrawDisplayList(TestDisplayList1, paint.getOpacity());
2949-
builder.DrawShadow(kTestPath1, paint.getColor(), 1, true, 1);
2950-
}
2951-
},
2952-
expected_op_count);
2953-
run_one_test(
2954-
name + " SaveLayer",
2955-
[](DisplayListBuilder& builder, DlPaint& paint) {
2956-
builder.SaveLayer(nullptr, &paint, nullptr);
2957-
builder.DrawRect({10, 10, 20, 20}, DlPaint());
2958-
builder.Restore();
2959-
},
2960-
expected_op_count);
2961-
run_one_test(
2962-
name + " inside Save",
2963-
[](DisplayListBuilder& builder, DlPaint& paint) {
2964-
builder.Save();
2965-
builder.DrawRect({10, 10, 20, 20}, paint);
2966-
builder.Restore();
2967-
},
2968-
expected_op_count);
2969-
};
2970-
run_tests("transparent color", //
2971-
[](DisplayListBuilder& builder, DlPaint& paint) {
2972-
paint.setColor(DlColor::kTransparent());
2973-
});
2974-
run_tests("0 alpha", //
2975-
[](DisplayListBuilder& builder, DlPaint& paint) {
2976-
// The transparent test above already tested transparent
2977-
// black (all 0s), we set White color here so we can test
2978-
// the case of all 1s with a 0 alpha
2979-
paint.setColor(DlColor::kWhite());
2980-
paint.setAlpha(0);
2981-
});
2982-
run_tests("BlendMode::kDst", //
2983-
[](DisplayListBuilder& builder, DlPaint& paint) {
2984-
paint.setBlendMode(DlBlendMode::kDst);
2985-
});
2986-
run_tests("Empty rect clip", //
2987-
[](DisplayListBuilder& builder, DlPaint& paint) {
2988-
builder.ClipRect(SkRect::MakeEmpty(), ClipOp::kIntersect, false);
2989-
});
2990-
run_tests("Empty rrect clip", //
2991-
[](DisplayListBuilder& builder, DlPaint& paint) {
2992-
builder.ClipRRect(SkRRect::MakeEmpty(), ClipOp::kIntersect,
2993-
false);
2994-
});
2995-
run_tests("Empty path clip", //
2996-
[](DisplayListBuilder& builder, DlPaint& paint) {
2997-
builder.ClipPath(SkPath(), ClipOp::kIntersect, false);
2998-
});
2999-
run_tests("Transparent SaveLayer", //
3000-
[](DisplayListBuilder& builder, DlPaint& paint) {
3001-
DlPaint save_paint;
3002-
save_paint.setColor(DlColor::kTransparent());
3003-
builder.SaveLayer(nullptr, &save_paint);
3004-
});
3005-
run_tests("0 alpha SaveLayer", //
3006-
[](DisplayListBuilder& builder, DlPaint& paint) {
3007-
DlPaint save_paint;
3008-
// The transparent test above already tested transparent
3009-
// black (all 0s), we set White color here so we can test
3010-
// the case of all 1s with a 0 alpha
3011-
save_paint.setColor(DlColor::kWhite());
3012-
save_paint.setAlpha(0);
3013-
builder.SaveLayer(nullptr, &save_paint);
3014-
});
3015-
run_tests("Dst blended SaveLayer", //
3016-
[](DisplayListBuilder& builder, DlPaint& paint) {
3017-
DlPaint save_paint;
3018-
save_paint.setBlendMode(DlBlendMode::kDst);
3019-
builder.SaveLayer(nullptr, &save_paint);
3020-
});
3021-
run_tests(
3022-
"Nop inside SaveLayer",
3023-
[](DisplayListBuilder& builder, DlPaint& paint) {
3024-
builder.SaveLayer(nullptr, nullptr);
3025-
paint.setBlendMode(DlBlendMode::kDst);
3026-
},
3027-
2u);
3028-
run_tests("DrawImage inside Culled SaveLayer", //
3029-
[](DisplayListBuilder& builder, DlPaint& paint) {
3030-
DlPaint save_paint;
3031-
save_paint.setColor(DlColor::kTransparent());
3032-
builder.SaveLayer(nullptr, &save_paint);
3033-
builder.DrawImage(TestImage1, {10, 10}, DlImageSampling::kLinear);
3034-
});
3035-
}
3036-
30372877
} // namespace testing
30382878
} // namespace flutter

0 commit comments

Comments
 (0)