This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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,
Original file line number Diff line number Diff line change @@ -131,19 +131,15 @@ bool Contents::ApplyColorFilter(
131131}
132132
133133bool 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
149145void Contents::SetCoverageHint (std::optional<Rect> coverage_hint) {
Original file line number Diff line number Diff 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.
Original file line number Diff line number Diff line change @@ -71,7 +71,14 @@ Contents::ClipCoverage Entity::GetClipCoverage(
7171}
7272
7373bool 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
7784void Entity::SetContents (std::shared_ptr<Contents> contents) {
You can’t perform that action at this time.
0 commit comments