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

Commit bd1cedb

Browse files
author
jonahwilliams
committed
[Impeller] disable entity culling by default.
1 parent 899b88a commit bd1cedb

5 files changed

Lines changed: 17 additions & 16 deletions

File tree

impeller/entity/contents/clip_contents.cc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,8 @@ Contents::ClipCoverage ClipContents::GetClipCoverage(
6262
FML_UNREACHABLE();
6363
}
6464

65-
bool ClipContents::ShouldRender(
66-
const Entity& entity,
67-
const std::optional<Rect>& clip_coverage) const {
65+
bool ClipContents::ShouldRender(const Entity& entity,
66+
const Rect& clip_coverage) const {
6867
return true;
6968
}
7069

@@ -159,9 +158,8 @@ Contents::ClipCoverage ClipRestoreContents::GetClipCoverage(
159158
return {.type = ClipCoverage::Type::kRestore, .coverage = std::nullopt};
160159
}
161160

162-
bool ClipRestoreContents::ShouldRender(
163-
const Entity& entity,
164-
const std::optional<Rect>& clip_coverage) const {
161+
bool ClipRestoreContents::ShouldRender(const Entity& entity,
162+
const Rect& clip_coverage) const {
165163
return true;
166164
}
167165

impeller/entity/contents/clip_contents.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ClipContents final : public Contents {
3535

3636
// |Contents|
3737
bool ShouldRender(const Entity& entity,
38-
const std::optional<Rect>& clip_coverage) const override;
38+
const Rect& clip_coverage) const override;
3939

4040
// |Contents|
4141
bool Render(const ContentContext& renderer,
@@ -78,7 +78,7 @@ class ClipRestoreContents final : public Contents {
7878

7979
// |Contents|
8080
bool ShouldRender(const Entity& entity,
81-
const std::optional<Rect>& clip_coverage) const override;
81+
const Rect& clip_coverage) const override;
8282

8383
// |Contents|
8484
bool Render(const ContentContext& renderer,

impeller/entity/contents/contents.cc

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,19 +131,15 @@ bool Contents::ApplyColorFilter(
131131
}
132132

133133
bool Contents::ShouldRender(const Entity& entity,
134-
const std::optional<Rect>& clip_coverage) const {
135-
if (!clip_coverage.has_value()) {
136-
return false;
137-
}
138-
134+
const Rect& clip_coverage) const {
139135
auto coverage = GetCoverage(entity);
140136
if (!coverage.has_value()) {
141137
return false;
142138
}
143139
if (coverage == Rect::MakeMaximum()) {
144140
return true;
145141
}
146-
return clip_coverage->IntersectsWithRect(coverage.value());
142+
return clip_coverage.IntersectsWithRect(coverage.value());
147143
}
148144

149145
void Contents::SetCoverageHint(std::optional<Rect> coverage_hint) {

impeller/entity/contents/contents.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class Contents {
123123
const std::string& label = "Snapshot") const;
124124

125125
virtual bool ShouldRender(const Entity& entity,
126-
const std::optional<Rect>& clip_coverage) const;
126+
const Rect& clip_coverage) const;
127127

128128
//----------------------------------------------------------------------------
129129
/// @brief Return the color source's intrinsic size, if available.

impeller/entity/entity.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,14 @@ Contents::ClipCoverage Entity::GetClipCoverage(
7171
}
7272

7373
bool Entity::ShouldRender(const std::optional<Rect>& clip_coverage) const {
74-
return contents_->ShouldRender(*this, clip_coverage);
74+
if (!clip_coverage.has_value()) {
75+
return false;
76+
}
77+
#ifdef IMPELLER_CONTENT_CULLING
78+
return contents_->ShouldRender(*this, clip_coverage.value());
79+
#else
80+
return true;
81+
#endif // IMPELLER_CONTENT_CULLING
7582
}
7683

7784
void Entity::SetContents(std::shared_ptr<Contents> contents) {

0 commit comments

Comments
 (0)