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

Commit cb30390

Browse files
authored
Revert "Reland "add non-rendering operation culling to DisplayListBuilder" (#41463) (#42584)"
This reverts commit 9bb0a59.
1 parent 099a70e commit cb30390

20 files changed

+311
-1267
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
@@ -23,7 +23,6 @@
2323

2424
#include "third_party/skia/include/core/SkBBHFactory.h"
2525
#include "third_party/skia/include/core/SkPictureRecorder.h"
26-
#include "third_party/skia/include/core/SkRSXform.h"
2726
#include "third_party/skia/include/core/SkSurface.h"
2827

2928
namespace flutter {
@@ -3018,164 +3017,5 @@ TEST_F(DisplayListTest, DrawUnorderedRoundRectPathCCW) {
30183017
check_inverted_bounds(renderer, "DrawRoundRectPath Counter-Clockwise");
30193018
}
30203019

3021-
TEST_F(DisplayListTest, NopOperationsOmittedFromRecords) {
3022-
auto run_tests = [](const std::string& name,
3023-
void init(DisplayListBuilder & builder, DlPaint & paint),
3024-
uint32_t expected_op_count = 0u) {
3025-
auto run_one_test =
3026-
[init](const std::string& name,
3027-
void build(DisplayListBuilder & builder, DlPaint & paint),
3028-
uint32_t expected_op_count = 0u) {
3029-
DisplayListBuilder builder;
3030-
DlPaint paint;
3031-
init(builder, paint);
3032-
build(builder, paint);
3033-
auto list = builder.Build();
3034-
if (list->op_count() != expected_op_count) {
3035-
FML_LOG(ERROR) << *list;
3036-
}
3037-
ASSERT_EQ(list->op_count(), expected_op_count) << name;
3038-
ASSERT_TRUE(list->bounds().isEmpty()) << name;
3039-
};
3040-
run_one_test(
3041-
name + " DrawColor",
3042-
[](DisplayListBuilder& builder, DlPaint& paint) {
3043-
builder.DrawColor(paint.getColor(), paint.getBlendMode());
3044-
},
3045-
expected_op_count);
3046-
run_one_test(
3047-
name + " DrawPaint",
3048-
[](DisplayListBuilder& builder, DlPaint& paint) {
3049-
builder.DrawPaint(paint);
3050-
},
3051-
expected_op_count);
3052-
run_one_test(
3053-
name + " DrawRect",
3054-
[](DisplayListBuilder& builder, DlPaint& paint) {
3055-
builder.DrawRect({10, 10, 20, 20}, paint);
3056-
},
3057-
expected_op_count);
3058-
run_one_test(
3059-
name + " Other Draw Ops",
3060-
[](DisplayListBuilder& builder, DlPaint& paint) {
3061-
builder.DrawLine({10, 10}, {20, 20}, paint);
3062-
builder.DrawOval({10, 10, 20, 20}, paint);
3063-
builder.DrawCircle({50, 50}, 20, paint);
3064-
builder.DrawRRect(SkRRect::MakeRectXY({10, 10, 20, 20}, 5, 5), paint);
3065-
builder.DrawDRRect(SkRRect::MakeRectXY({5, 5, 100, 100}, 5, 5),
3066-
SkRRect::MakeRectXY({10, 10, 20, 20}, 5, 5),
3067-
paint);
3068-
builder.DrawPath(kTestPath1, paint);
3069-
builder.DrawArc({10, 10, 20, 20}, 45, 90, true, paint);
3070-
SkPoint pts[] = {{10, 10}, {20, 20}};
3071-
builder.DrawPoints(PointMode::kLines, 2, pts, paint);
3072-
builder.DrawVertices(TestVertices1, DlBlendMode::kSrcOver, paint);
3073-
builder.DrawImage(TestImage1, {10, 10}, DlImageSampling::kLinear,
3074-
&paint);
3075-
builder.DrawImageRect(TestImage1, SkRect{0.0f, 0.0f, 10.0f, 10.0f},
3076-
SkRect{10.0f, 10.0f, 25.0f, 25.0f},
3077-
DlImageSampling::kLinear, &paint);
3078-
builder.DrawImageNine(TestImage1, {10, 10, 20, 20},
3079-
{10, 10, 100, 100}, DlFilterMode::kLinear,
3080-
&paint);
3081-
SkRSXform xforms[] = {{1, 0, 10, 10}, {0, 1, 10, 10}};
3082-
SkRect rects[] = {{10, 10, 20, 20}, {10, 20, 30, 20}};
3083-
builder.DrawAtlas(TestImage1, xforms, rects, nullptr, 2,
3084-
DlBlendMode::kSrcOver, DlImageSampling::kLinear,
3085-
nullptr, &paint);
3086-
builder.DrawTextBlob(TestBlob1, 10, 10, paint);
3087-
3088-
// Dst mode eliminates most rendering ops except for
3089-
// the following two, so we'll prune those manually...
3090-
if (paint.getBlendMode() != DlBlendMode::kDst) {
3091-
builder.DrawDisplayList(TestDisplayList1, paint.getOpacity());
3092-
builder.DrawShadow(kTestPath1, paint.getColor(), 1, true, 1);
3093-
}
3094-
},
3095-
expected_op_count);
3096-
run_one_test(
3097-
name + " SaveLayer",
3098-
[](DisplayListBuilder& builder, DlPaint& paint) {
3099-
builder.SaveLayer(nullptr, &paint, nullptr);
3100-
builder.DrawRect({10, 10, 20, 20}, DlPaint());
3101-
builder.Restore();
3102-
},
3103-
expected_op_count);
3104-
run_one_test(
3105-
name + " inside Save",
3106-
[](DisplayListBuilder& builder, DlPaint& paint) {
3107-
builder.Save();
3108-
builder.DrawRect({10, 10, 20, 20}, paint);
3109-
builder.Restore();
3110-
},
3111-
expected_op_count);
3112-
};
3113-
run_tests("transparent color", //
3114-
[](DisplayListBuilder& builder, DlPaint& paint) {
3115-
paint.setColor(DlColor::kTransparent());
3116-
});
3117-
run_tests("0 alpha", //
3118-
[](DisplayListBuilder& builder, DlPaint& paint) {
3119-
// The transparent test above already tested transparent
3120-
// black (all 0s), we set White color here so we can test
3121-
// the case of all 1s with a 0 alpha
3122-
paint.setColor(DlColor::kWhite());
3123-
paint.setAlpha(0);
3124-
});
3125-
run_tests("BlendMode::kDst", //
3126-
[](DisplayListBuilder& builder, DlPaint& paint) {
3127-
paint.setBlendMode(DlBlendMode::kDst);
3128-
});
3129-
run_tests("Empty rect clip", //
3130-
[](DisplayListBuilder& builder, DlPaint& paint) {
3131-
builder.ClipRect(SkRect::MakeEmpty(), ClipOp::kIntersect, false);
3132-
});
3133-
run_tests("Empty rrect clip", //
3134-
[](DisplayListBuilder& builder, DlPaint& paint) {
3135-
builder.ClipRRect(SkRRect::MakeEmpty(), ClipOp::kIntersect,
3136-
false);
3137-
});
3138-
run_tests("Empty path clip", //
3139-
[](DisplayListBuilder& builder, DlPaint& paint) {
3140-
builder.ClipPath(SkPath(), ClipOp::kIntersect, false);
3141-
});
3142-
run_tests("Transparent SaveLayer", //
3143-
[](DisplayListBuilder& builder, DlPaint& paint) {
3144-
DlPaint save_paint;
3145-
save_paint.setColor(DlColor::kTransparent());
3146-
builder.SaveLayer(nullptr, &save_paint);
3147-
});
3148-
run_tests("0 alpha SaveLayer", //
3149-
[](DisplayListBuilder& builder, DlPaint& paint) {
3150-
DlPaint save_paint;
3151-
// The transparent test above already tested transparent
3152-
// black (all 0s), we set White color here so we can test
3153-
// the case of all 1s with a 0 alpha
3154-
save_paint.setColor(DlColor::kWhite());
3155-
save_paint.setAlpha(0);
3156-
builder.SaveLayer(nullptr, &save_paint);
3157-
});
3158-
run_tests("Dst blended SaveLayer", //
3159-
[](DisplayListBuilder& builder, DlPaint& paint) {
3160-
DlPaint save_paint;
3161-
save_paint.setBlendMode(DlBlendMode::kDst);
3162-
builder.SaveLayer(nullptr, &save_paint);
3163-
});
3164-
run_tests(
3165-
"Nop inside SaveLayer",
3166-
[](DisplayListBuilder& builder, DlPaint& paint) {
3167-
builder.SaveLayer(nullptr, nullptr);
3168-
paint.setBlendMode(DlBlendMode::kDst);
3169-
},
3170-
2u);
3171-
run_tests("DrawImage inside Culled SaveLayer", //
3172-
[](DisplayListBuilder& builder, DlPaint& paint) {
3173-
DlPaint save_paint;
3174-
save_paint.setColor(DlColor::kTransparent());
3175-
builder.SaveLayer(nullptr, &save_paint);
3176-
builder.DrawImage(TestImage1, {10, 10}, DlImageSampling::kLinear);
3177-
});
3178-
}
3179-
31803020
} // namespace testing
31813021
} // namespace flutter

0 commit comments

Comments
 (0)