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

Commit b397adc

Browse files
authored
Revert "add non-rendering operation culling to DisplayListBuilder (#41463)"
This reverts commit fb703b1.
1 parent 0ae3719 commit b397adc

20 files changed

+306
-870
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-
affects_transparent_surface_(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 affects_transparent_surface,
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-
affects_transparent_surface_(affects_transparent_surface),
4845
rtree_(std::move(rtree)) {}
4946

5047
DisplayList::~DisplayList() {

display_list/display_list.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,6 @@ class DisplayList : public SkRefCnt {
263263
}
264264

265265
bool can_apply_group_opacity() const { return can_apply_group_opacity_; }
266-
bool affects_transparent_surface() const {
267-
return affects_transparent_surface_;
268-
}
269266
bool isUIThreadSafe() const { return is_ui_thread_safe_; }
270267

271268
private:
@@ -277,7 +274,6 @@ class DisplayList : public SkRefCnt {
277274
const SkRect& bounds,
278275
bool can_apply_group_opacity,
279276
bool is_ui_thread_safe,
280-
bool affects_transparent_surface,
281277
sk_sp<const DlRTree> rtree);
282278

283279
static uint32_t next_unique_id();
@@ -296,8 +292,6 @@ class DisplayList : public SkRefCnt {
296292

297293
const bool can_apply_group_opacity_;
298294
const bool is_ui_thread_safe_;
299-
const bool affects_transparent_surface_;
300-
301295
const sk_sp<const DlRTree> rtree_;
302296

303297
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 {
@@ -2640,164 +2639,5 @@ TEST_F(DisplayListTest, DrawSaveDrawCannotInheritOpacity) {
26402639
ASSERT_FALSE(display_list->can_apply_group_opacity());
26412640
}
26422641

2643-
TEST_F(DisplayListTest, NopOperationsOmittedFromRecords) {
2644-
auto run_tests = [](const std::string& name,
2645-
void init(DisplayListBuilder & builder, DlPaint & paint),
2646-
uint32_t expected_op_count = 0u) {
2647-
auto run_one_test =
2648-
[init](const std::string& name,
2649-
void build(DisplayListBuilder & builder, DlPaint & paint),
2650-
uint32_t expected_op_count = 0u) {
2651-
DisplayListBuilder builder;
2652-
DlPaint paint;
2653-
init(builder, paint);
2654-
build(builder, paint);
2655-
auto list = builder.Build();
2656-
if (list->op_count() != expected_op_count) {
2657-
FML_LOG(ERROR) << *list;
2658-
}
2659-
ASSERT_EQ(list->op_count(), expected_op_count) << name;
2660-
ASSERT_TRUE(list->bounds().isEmpty()) << name;
2661-
};
2662-
run_one_test(
2663-
name + " DrawColor",
2664-
[](DisplayListBuilder& builder, DlPaint& paint) {
2665-
builder.DrawColor(paint.getColor(), paint.getBlendMode());
2666-
},
2667-
expected_op_count);
2668-
run_one_test(
2669-
name + " DrawPaint",
2670-
[](DisplayListBuilder& builder, DlPaint& paint) {
2671-
builder.DrawPaint(paint);
2672-
},
2673-
expected_op_count);
2674-
run_one_test(
2675-
name + " DrawRect",
2676-
[](DisplayListBuilder& builder, DlPaint& paint) {
2677-
builder.DrawRect({10, 10, 20, 20}, paint);
2678-
},
2679-
expected_op_count);
2680-
run_one_test(
2681-
name + " Other Draw Ops",
2682-
[](DisplayListBuilder& builder, DlPaint& paint) {
2683-
builder.DrawLine({10, 10}, {20, 20}, paint);
2684-
builder.DrawOval({10, 10, 20, 20}, paint);
2685-
builder.DrawCircle({50, 50}, 20, paint);
2686-
builder.DrawRRect(SkRRect::MakeRectXY({10, 10, 20, 20}, 5, 5), paint);
2687-
builder.DrawDRRect(SkRRect::MakeRectXY({5, 5, 100, 100}, 5, 5),
2688-
SkRRect::MakeRectXY({10, 10, 20, 20}, 5, 5),
2689-
paint);
2690-
builder.DrawPath(kTestPath1, paint);
2691-
builder.DrawArc({10, 10, 20, 20}, 45, 90, true, paint);
2692-
SkPoint pts[] = {{10, 10}, {20, 20}};
2693-
builder.DrawPoints(PointMode::kLines, 2, pts, paint);
2694-
builder.DrawVertices(TestVertices1, DlBlendMode::kSrcOver, paint);
2695-
builder.DrawImage(TestImage1, {10, 10}, DlImageSampling::kLinear,
2696-
&paint);
2697-
builder.DrawImageRect(TestImage1, SkRect{0.0f, 0.0f, 10.0f, 10.0f},
2698-
SkRect{10.0f, 10.0f, 25.0f, 25.0f},
2699-
DlImageSampling::kLinear, &paint);
2700-
builder.DrawImageNine(TestImage1, {10, 10, 20, 20},
2701-
{10, 10, 100, 100}, DlFilterMode::kLinear,
2702-
&paint);
2703-
SkRSXform xforms[] = {{1, 0, 10, 10}, {0, 1, 10, 10}};
2704-
SkRect rects[] = {{10, 10, 20, 20}, {10, 20, 30, 20}};
2705-
builder.DrawAtlas(TestImage1, xforms, rects, nullptr, 2,
2706-
DlBlendMode::kSrcOver, DlImageSampling::kLinear,
2707-
nullptr, &paint);
2708-
builder.DrawTextBlob(TestBlob1, 10, 10, paint);
2709-
2710-
// Dst mode eliminates most rendering ops except for
2711-
// the following two, so we'll prune those manually...
2712-
if (paint.getBlendMode() != DlBlendMode::kDst) {
2713-
builder.DrawDisplayList(TestDisplayList1, paint.getOpacity());
2714-
builder.DrawShadow(kTestPath1, paint.getColor(), 1, true, 1);
2715-
}
2716-
},
2717-
expected_op_count);
2718-
run_one_test(
2719-
name + " SaveLayer",
2720-
[](DisplayListBuilder& builder, DlPaint& paint) {
2721-
builder.SaveLayer(nullptr, &paint, nullptr);
2722-
builder.DrawRect({10, 10, 20, 20}, DlPaint());
2723-
builder.Restore();
2724-
},
2725-
expected_op_count);
2726-
run_one_test(
2727-
name + " inside Save",
2728-
[](DisplayListBuilder& builder, DlPaint& paint) {
2729-
builder.Save();
2730-
builder.DrawRect({10, 10, 20, 20}, paint);
2731-
builder.Restore();
2732-
},
2733-
expected_op_count);
2734-
};
2735-
run_tests("transparent color", //
2736-
[](DisplayListBuilder& builder, DlPaint& paint) {
2737-
paint.setColor(DlColor::kTransparent());
2738-
});
2739-
run_tests("0 alpha", //
2740-
[](DisplayListBuilder& builder, DlPaint& paint) {
2741-
// The transparent test above already tested transparent
2742-
// black (all 0s), we set White color here so we can test
2743-
// the case of all 1s with a 0 alpha
2744-
paint.setColor(DlColor::kWhite());
2745-
paint.setAlpha(0);
2746-
});
2747-
run_tests("BlendMode::kDst", //
2748-
[](DisplayListBuilder& builder, DlPaint& paint) {
2749-
paint.setBlendMode(DlBlendMode::kDst);
2750-
});
2751-
run_tests("Empty rect clip", //
2752-
[](DisplayListBuilder& builder, DlPaint& paint) {
2753-
builder.ClipRect(SkRect::MakeEmpty(), ClipOp::kIntersect, false);
2754-
});
2755-
run_tests("Empty rrect clip", //
2756-
[](DisplayListBuilder& builder, DlPaint& paint) {
2757-
builder.ClipRRect(SkRRect::MakeEmpty(), ClipOp::kIntersect,
2758-
false);
2759-
});
2760-
run_tests("Empty path clip", //
2761-
[](DisplayListBuilder& builder, DlPaint& paint) {
2762-
builder.ClipPath(SkPath(), ClipOp::kIntersect, false);
2763-
});
2764-
run_tests("Transparent SaveLayer", //
2765-
[](DisplayListBuilder& builder, DlPaint& paint) {
2766-
DlPaint save_paint;
2767-
save_paint.setColor(DlColor::kTransparent());
2768-
builder.SaveLayer(nullptr, &save_paint);
2769-
});
2770-
run_tests("0 alpha SaveLayer", //
2771-
[](DisplayListBuilder& builder, DlPaint& paint) {
2772-
DlPaint save_paint;
2773-
// The transparent test above already tested transparent
2774-
// black (all 0s), we set White color here so we can test
2775-
// the case of all 1s with a 0 alpha
2776-
save_paint.setColor(DlColor::kWhite());
2777-
save_paint.setAlpha(0);
2778-
builder.SaveLayer(nullptr, &save_paint);
2779-
});
2780-
run_tests("Dst blended SaveLayer", //
2781-
[](DisplayListBuilder& builder, DlPaint& paint) {
2782-
DlPaint save_paint;
2783-
save_paint.setBlendMode(DlBlendMode::kDst);
2784-
builder.SaveLayer(nullptr, &save_paint);
2785-
});
2786-
run_tests(
2787-
"Nop inside SaveLayer",
2788-
[](DisplayListBuilder& builder, DlPaint& paint) {
2789-
builder.SaveLayer(nullptr, nullptr);
2790-
paint.setBlendMode(DlBlendMode::kDst);
2791-
},
2792-
2u);
2793-
run_tests("DrawImage inside Culled SaveLayer", //
2794-
[](DisplayListBuilder& builder, DlPaint& paint) {
2795-
DlPaint save_paint;
2796-
save_paint.setColor(DlColor::kTransparent());
2797-
builder.SaveLayer(nullptr, &save_paint);
2798-
builder.DrawImage(TestImage1, {10, 10}, DlImageSampling::kLinear);
2799-
});
2800-
}
2801-
28022642
} // namespace testing
28032643
} // namespace flutter

0 commit comments

Comments
 (0)