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

Commit 61d3746

Browse files
committed
Address comments
1 parent 1a09663 commit 61d3746

File tree

9 files changed

+22
-22
lines changed

9 files changed

+22
-22
lines changed

impeller/entity/contents/filters/filter_contents.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,9 @@ Matrix FilterContents::GetLocalTransform(const Matrix& parent_transform) const {
270270
Matrix FilterContents::GetTransform(const Matrix& parent_transform) const {
271271
return parent_transform * GetLocalTransform(parent_transform);
272272
}
273-
bool FilterContents::HasBasisTransformations() const {
273+
bool FilterContents::IsTranslationOnly() const {
274274
for (auto& input : inputs_) {
275-
if (!input->HasBasisTransformations()) {
275+
if (!input->IsTranslationOnly()) {
276276
return false;
277277
}
278278
}

impeller/entity/contents/filters/filter_contents.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,15 @@ class FilterContents : public Contents {
132132

133133
Matrix GetTransform(const Matrix& parent_transform) const;
134134

135-
/// @brief Returns true of this filter graph performs basis transformations
136-
/// to the filtered content. For example: Rotating, scaling, and
137-
/// skewing are all basis transformations, but translating is not.
135+
/// @brief Returns true if this filter graph doesn't perform any basis
136+
/// transformations to the filtered content. For example: Rotating,
137+
/// scaling, and skewing are all basis transformations, but
138+
/// translating is not.
138139
///
139140
/// This is useful for determining whether a filtered object's space
140141
/// is compatible enough with the parent pass space to perform certain
141-
/// subpass optimizations.
142-
virtual bool HasBasisTransformations() const;
142+
/// subpass clipping optimizations.
143+
virtual bool IsTranslationOnly() const;
143144

144145
/// @brief Returns `true` if this filter does not have any `FilterInput`
145146
/// children.

impeller/entity/contents/filters/inputs/filter_contents_filter_input.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ void FilterContentsFilterInput::PopulateGlyphAtlas(
5858
filter_->PopulateGlyphAtlas(lazy_glyph_atlas, scale);
5959
}
6060

61-
bool FilterContentsFilterInput::HasBasisTransformations() const {
62-
return filter_->HasBasisTransformations();
61+
bool FilterContentsFilterInput::IsTranslationOnly() const {
62+
return filter_->IsTranslationOnly();
6363
}
6464

6565
bool FilterContentsFilterInput::IsLeaf() const {

impeller/entity/contents/filters/inputs/filter_contents_filter_input.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class FilterContentsFilterInput final : public FilterInput {
3737
Scalar scale) override;
3838

3939
// |FilterInput|
40-
bool HasBasisTransformations() const override;
40+
bool IsTranslationOnly() const override;
4141

4242
// |FilterInput|
4343
bool IsLeaf() const override;

impeller/entity/contents/filters/inputs/filter_input.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ void FilterInput::PopulateGlyphAtlas(
7676

7777
FilterInput::~FilterInput() = default;
7878

79-
bool FilterInput::HasBasisTransformations() const {
80-
return false;
79+
bool FilterInput::IsTranslationOnly() const {
80+
return true;
8181
}
8282

8383
bool FilterInput::IsLeaf() const {

impeller/entity/contents/filters/inputs/filter_input.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class FilterInput {
7070
Scalar scale);
7171

7272
/// @see `FilterContents::HasBasisTransformations`
73-
virtual bool HasBasisTransformations() const;
73+
virtual bool IsTranslationOnly() const;
7474

7575
/// @brief Returns `true` unless this input is a `FilterInput`, which may
7676
/// take other inputs.

impeller/entity/contents/filters/matrix_filter_contents.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ void MatrixFilterContents::SetIsForSubpass(bool is_subpass) {
1919
FilterContents::SetIsForSubpass(is_subpass);
2020
}
2121

22-
bool MatrixFilterContents::HasBasisTransformations() const {
23-
return !matrix_.Basis().IsIdentity() ||
24-
FilterContents::HasBasisTransformations();
22+
bool MatrixFilterContents::IsTranslationOnly() const {
23+
return matrix_.Basis().IsIdentity() && FilterContents::IsTranslationOnly();
2524
}
2625

2726
void MatrixFilterContents::SetSamplerDescriptor(SamplerDescriptor desc) {

impeller/entity/contents/filters/matrix_filter_contents.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class MatrixFilterContents final : public FilterContents {
2121
void SetIsForSubpass(bool is_for_subpass) override;
2222

2323
// |FilterContents|
24-
bool HasBasisTransformations() const override;
24+
bool IsTranslationOnly() const override;
2525

2626
void SetSamplerDescriptor(SamplerDescriptor desc);
2727

impeller/entity/entity_pass.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ std::optional<Rect> EntityPass::GetElementsCoverage(
114114
// as opposed to empty coverage.
115115
if (coverage.has_value() && coverage_limit.has_value()) {
116116
const auto* filter = entity->GetContents()->AsFilter();
117-
if (!filter || !filter->HasBasisTransformations()) {
117+
if (!filter || filter->IsTranslationOnly()) {
118118
coverage = coverage->Intersection(coverage_limit.value());
119119
}
120120
}
@@ -140,7 +140,7 @@ std::optional<Rect> EntityPass::GetElementsCoverage(
140140
}
141141

142142
if (coverage.has_value() && coverage_limit.has_value() &&
143-
(!image_filter || !image_filter->HasBasisTransformations())) {
143+
(!image_filter || image_filter->IsTranslationOnly())) {
144144
coverage = coverage->Intersection(coverage_limit.value());
145145
}
146146
} else {
@@ -168,9 +168,9 @@ std::optional<Rect> EntityPass::GetSubpassCoverage(
168168
// If the filter graph transforms the basis of the subpass, then its space
169169
// has deviated too much from the parent pass to safely intersect with the
170170
// pass coverage limit.
171-
coverage_limit = (image_filter && image_filter->HasBasisTransformations()
172-
? std::nullopt
173-
: coverage_limit);
171+
coverage_limit =
172+
(image_filter && image_filter->IsTranslationOnly() ? std::nullopt
173+
: coverage_limit);
174174

175175
auto entities_coverage = subpass.GetElementsCoverage(coverage_limit);
176176
// The entities don't cover anything. There is nothing to do.

0 commit comments

Comments
 (0)