diff --git a/engine/src/flutter/impeller/entity/contents/contents.cc b/engine/src/flutter/impeller/entity/contents/contents.cc index df79c42307..0946775a59 100644 --- a/engine/src/flutter/impeller/entity/contents/contents.cc +++ b/engine/src/flutter/impeller/entity/contents/contents.cc @@ -138,10 +138,6 @@ std::optional Contents::AsBackgroundColor(const Entity& entity, return {}; } -const FilterContents* Contents::AsFilter() const { - return nullptr; -} - bool Contents::ApplyColorFilter( const Contents::ColorFilterProc& color_filter_proc) { return false; diff --git a/engine/src/flutter/impeller/entity/contents/contents.h b/engine/src/flutter/impeller/entity/contents/contents.h index 0de4926b31..1577f3054f 100644 --- a/engine/src/flutter/impeller/entity/contents/contents.h +++ b/engine/src/flutter/impeller/entity/contents/contents.h @@ -157,12 +157,6 @@ class Contents { virtual std::optional AsBackgroundColor(const Entity& entity, ISize target_size) const; - //---------------------------------------------------------------------------- - /// @brief Cast to a filter. Returns `nullptr` if this Contents is not a - /// filter. - /// - virtual const FilterContents* AsFilter() const; - //---------------------------------------------------------------------------- /// @brief If possible, applies a color filter to this contents inputs on /// the CPU. diff --git a/engine/src/flutter/impeller/entity/contents/filters/filter_contents.cc b/engine/src/flutter/impeller/entity/contents/filters/filter_contents.cc index 85bcabadc1..988d6638a0 100644 --- a/engine/src/flutter/impeller/entity/contents/filters/filter_contents.cc +++ b/engine/src/flutter/impeller/entity/contents/filters/filter_contents.cc @@ -257,10 +257,6 @@ std::optional FilterContents::RenderToSnapshot( return std::nullopt; } -const FilterContents* FilterContents::AsFilter() const { - return this; -} - Matrix FilterContents::GetLocalTransform(const Matrix& parent_transform) const { return Matrix(); } @@ -268,33 +264,6 @@ Matrix FilterContents::GetLocalTransform(const Matrix& parent_transform) const { Matrix FilterContents::GetTransform(const Matrix& parent_transform) const { return parent_transform * GetLocalTransform(parent_transform); } -bool FilterContents::IsTranslationOnly() const { - for (auto& input : inputs_) { - if (!input->IsTranslationOnly()) { - return false; - } - } - return true; -} - -bool FilterContents::IsLeaf() const { - for (auto& input : inputs_) { - if (!input->IsLeaf()) { - return false; - } - } - return true; -} - -void FilterContents::SetLeafInputs(const FilterInput::Vector& inputs) { - if (IsLeaf()) { - inputs_ = inputs; - return; - } - for (auto& input : inputs_) { - input->SetLeafInputs(inputs); - } -} void FilterContents::SetRenderingMode(Entity::RenderingMode rendering_mode) { for (auto& input : inputs_) { diff --git a/engine/src/flutter/impeller/entity/contents/filters/filter_contents.h b/engine/src/flutter/impeller/entity/contents/filters/filter_contents.h index 3c355bb249..9b5c019541 100644 --- a/engine/src/flutter/impeller/entity/contents/filters/filter_contents.h +++ b/engine/src/flutter/impeller/entity/contents/filters/filter_contents.h @@ -120,9 +120,6 @@ class FilterContents : public Contents { int32_t mip_count = 1, const std::string& label = "Filter Snapshot") const override; - // |Contents| - const FilterContents* AsFilter() const override; - /// @brief Determines the coverage of source pixels that will be needed /// to produce results for the specified |output_limit| under the /// specified |effect_transform|. This is essentially a reverse of @@ -160,25 +157,6 @@ class FilterContents : public Contents { Matrix GetTransform(const Matrix& parent_transform) const; - /// @brief Returns true if this filter graph doesn't perform any basis - /// transforms to the filtered content. For example: Rotating, - /// scaling, and skewing are all basis transforms, but - /// translating is not. - /// - /// This is useful for determining whether a filtered object's space - /// is compatible enough with the parent pass space to perform certain - /// subpass clipping optimizations. - virtual bool IsTranslationOnly() const; - - /// @brief Returns `true` if this filter does not have any `FilterInput` - /// children. - bool IsLeaf() const; - - /// @brief Replaces the set of all leaf `FilterContents` with a new set - /// of `FilterInput`s. - /// @see `FilterContents::IsLeaf` - void SetLeafInputs(const FilterInput::Vector& inputs); - /// @brief Marks this filter chain as applying in a subpass scenario. /// /// Subpasses render in screenspace, and this setting informs filters diff --git a/engine/src/flutter/impeller/entity/contents/filters/inputs/contents_filter_input.cc b/engine/src/flutter/impeller/entity/contents/filters/inputs/contents_filter_input.cc index c8755112e6..57a68747e9 100644 --- a/engine/src/flutter/impeller/entity/contents/filters/inputs/contents_filter_input.cc +++ b/engine/src/flutter/impeller/entity/contents/filters/inputs/contents_filter_input.cc @@ -17,10 +17,6 @@ ContentsFilterInput::ContentsFilterInput(std::shared_ptr contents, ContentsFilterInput::~ContentsFilterInput() = default; -FilterInput::Variant ContentsFilterInput::GetInput() const { - return contents_; -} - std::optional ContentsFilterInput::GetSnapshot( const std::string& label, const ContentContext& renderer, diff --git a/engine/src/flutter/impeller/entity/contents/filters/inputs/contents_filter_input.h b/engine/src/flutter/impeller/entity/contents/filters/inputs/contents_filter_input.h index af9eb2acd0..0a43968f9f 100644 --- a/engine/src/flutter/impeller/entity/contents/filters/inputs/contents_filter_input.h +++ b/engine/src/flutter/impeller/entity/contents/filters/inputs/contents_filter_input.h @@ -13,9 +13,6 @@ class ContentsFilterInput final : public FilterInput { public: ~ContentsFilterInput() override; - // |FilterInput| - Variant GetInput() const override; - // |FilterInput| std::optional GetSnapshot(const std::string& label, const ContentContext& renderer, diff --git a/engine/src/flutter/impeller/entity/contents/filters/inputs/filter_contents_filter_input.cc b/engine/src/flutter/impeller/entity/contents/filters/inputs/filter_contents_filter_input.cc index 00135b6c8c..9eb01a7437 100644 --- a/engine/src/flutter/impeller/entity/contents/filters/inputs/filter_contents_filter_input.cc +++ b/engine/src/flutter/impeller/entity/contents/filters/inputs/filter_contents_filter_input.cc @@ -17,10 +17,6 @@ FilterContentsFilterInput::FilterContentsFilterInput( FilterContentsFilterInput::~FilterContentsFilterInput() = default; -FilterInput::Variant FilterContentsFilterInput::GetInput() const { - return filter_; -} - std::optional FilterContentsFilterInput::GetSnapshot( const std::string& label, const ContentContext& renderer, @@ -60,19 +56,6 @@ Matrix FilterContentsFilterInput::GetTransform(const Entity& entity) const { return filter_->GetTransform(entity.GetTransform()); } -bool FilterContentsFilterInput::IsTranslationOnly() const { - return filter_->IsTranslationOnly(); -} - -bool FilterContentsFilterInput::IsLeaf() const { - return false; -} - -void FilterContentsFilterInput::SetLeafInputs( - const FilterInput::Vector& inputs) { - filter_->SetLeafInputs(inputs); -} - void FilterContentsFilterInput::SetEffectTransform(const Matrix& matrix) { filter_->SetEffectTransform(matrix); } diff --git a/engine/src/flutter/impeller/entity/contents/filters/inputs/filter_contents_filter_input.h b/engine/src/flutter/impeller/entity/contents/filters/inputs/filter_contents_filter_input.h index 7682647506..d1f42f32ea 100644 --- a/engine/src/flutter/impeller/entity/contents/filters/inputs/filter_contents_filter_input.h +++ b/engine/src/flutter/impeller/entity/contents/filters/inputs/filter_contents_filter_input.h @@ -13,9 +13,6 @@ class FilterContentsFilterInput final : public FilterInput { public: ~FilterContentsFilterInput() override; - // |FilterInput| - Variant GetInput() const override; - // |FilterInput| std::optional GetSnapshot(const std::string& label, const ContentContext& renderer, @@ -37,15 +34,6 @@ class FilterContentsFilterInput final : public FilterInput { // |FilterInput| Matrix GetTransform(const Entity& entity) const override; - // |FilterInput| - bool IsTranslationOnly() const override; - - // |FilterInput| - bool IsLeaf() const override; - - // |FilterInput| - void SetLeafInputs(const FilterInput::Vector& inputs) override; - // |FilterInput| virtual void SetEffectTransform(const Matrix& matrix) override; diff --git a/engine/src/flutter/impeller/entity/contents/filters/inputs/filter_input.cc b/engine/src/flutter/impeller/entity/contents/filters/inputs/filter_input.cc index d0280009ac..8963dbf872 100644 --- a/engine/src/flutter/impeller/entity/contents/filters/inputs/filter_input.cc +++ b/engine/src/flutter/impeller/entity/contents/filters/inputs/filter_input.cc @@ -78,16 +78,6 @@ Matrix FilterInput::GetTransform(const Entity& entity) const { FilterInput::~FilterInput() = default; -bool FilterInput::IsTranslationOnly() const { - return true; -} - -bool FilterInput::IsLeaf() const { - return true; -} - -void FilterInput::SetLeafInputs(const FilterInput::Vector& inputs) {} - void FilterInput::SetEffectTransform(const Matrix& matrix) {} void FilterInput::SetRenderingMode(Entity::RenderingMode rendering_mode) {} diff --git a/engine/src/flutter/impeller/entity/contents/filters/inputs/filter_input.h b/engine/src/flutter/impeller/entity/contents/filters/inputs/filter_input.h index d31927437a..e8edd041c7 100644 --- a/engine/src/flutter/impeller/entity/contents/filters/inputs/filter_input.h +++ b/engine/src/flutter/impeller/entity/contents/filters/inputs/filter_input.h @@ -45,8 +45,6 @@ class FilterInput { static FilterInput::Vector Make(std::initializer_list inputs); - virtual Variant GetInput() const = 0; - virtual std::optional GetSnapshot( const std::string& label, const ContentContext& renderer, @@ -69,18 +67,6 @@ class FilterInput { /// calling `entity.GetTransform() * GetLocalTransform()`. virtual Matrix GetTransform(const Entity& entity) const; - /// @see `FilterContents::HasBasisTransforms` - virtual bool IsTranslationOnly() const; - - /// @brief Returns `true` unless this input is a `FilterInput`, which may - /// take other inputs. - virtual bool IsLeaf() const; - - /// @brief Replaces the inputs of all leaf `FilterContents` with a new set - /// of `inputs`. - /// @see `FilterInput::IsLeaf` - virtual void SetLeafInputs(const FilterInput::Vector& inputs); - /// @brief Sets the effect transform of filter inputs. virtual void SetEffectTransform(const Matrix& matrix); diff --git a/engine/src/flutter/impeller/entity/contents/filters/inputs/filter_input_unittests.cc b/engine/src/flutter/impeller/entity/contents/filters/inputs/filter_input_unittests.cc index ab924a13c5..b52d4a399f 100644 --- a/engine/src/flutter/impeller/entity/contents/filters/inputs/filter_input_unittests.cc +++ b/engine/src/flutter/impeller/entity/contents/filters/inputs/filter_input_unittests.cc @@ -5,10 +5,8 @@ #include #include "flutter/testing/testing.h" #include "gtest/gtest.h" -#include "impeller/entity/contents/filters/color_filter_contents.h" #include "impeller/entity/contents/filters/inputs/filter_input.h" #include "impeller/entity/entity.h" -#include "impeller/geometry/color.h" #include "impeller/geometry/geometry_asserts.h" namespace impeller { @@ -27,41 +25,5 @@ TEST(FilterInputTest, CanSetLocalTransformForTexture) { Matrix::MakeTranslation({1.0, 2.0, 0.0})); } -TEST(FilterInputTest, IsLeaf) { - std::shared_ptr leaf = - ColorFilterContents::MakeBlend(BlendMode::kSource, {}); - ASSERT_TRUE(leaf->IsLeaf()); - - auto base = ColorFilterContents::MakeMatrixFilter(FilterInput::Make(leaf), - Matrix(), {}); - - ASSERT_TRUE(leaf->IsLeaf()); - ASSERT_FALSE(base->IsLeaf()); -} - -TEST(FilterInputTest, SetCoverageInputs) { - std::shared_ptr leaf = - ColorFilterContents::MakeBlend(BlendMode::kSource, {}); - ASSERT_TRUE(leaf->IsLeaf()); - - auto base = ColorFilterContents::MakeMatrixFilter(FilterInput::Make(leaf), - Matrix(), {}); - - { - auto result = base->GetCoverage({}); - ASSERT_FALSE(result.has_value()); - } - - auto coverage_rect = Rect::MakeLTRB(100, 100, 200, 200); - base->SetLeafInputs(FilterInput::Make({coverage_rect})); - - { - auto result = base->GetCoverage({}); - ASSERT_TRUE(result.has_value()); - // NOLINTNEXTLINE(bugprone-unchecked-optional-access) - ASSERT_RECT_NEAR(result.value(), coverage_rect); - } -} - } // namespace testing } // namespace impeller diff --git a/engine/src/flutter/impeller/entity/contents/filters/inputs/placeholder_filter_input.cc b/engine/src/flutter/impeller/entity/contents/filters/inputs/placeholder_filter_input.cc index d4daf6d951..2742340d40 100644 --- a/engine/src/flutter/impeller/entity/contents/filters/inputs/placeholder_filter_input.cc +++ b/engine/src/flutter/impeller/entity/contents/filters/inputs/placeholder_filter_input.cc @@ -5,9 +5,6 @@ #include "impeller/entity/contents/filters/inputs/placeholder_filter_input.h" #include -#include - -#include "impeller/base/strings.h" namespace impeller { @@ -16,10 +13,6 @@ PlaceholderFilterInput::PlaceholderFilterInput(Rect coverage_rect) PlaceholderFilterInput::~PlaceholderFilterInput() = default; -FilterInput::Variant PlaceholderFilterInput::GetInput() const { - return coverage_rect_; -} - std::optional PlaceholderFilterInput::GetSnapshot( const std::string& label, const ContentContext& renderer, diff --git a/engine/src/flutter/impeller/entity/contents/filters/inputs/placeholder_filter_input.h b/engine/src/flutter/impeller/entity/contents/filters/inputs/placeholder_filter_input.h index 321c164ce7..1096d57246 100644 --- a/engine/src/flutter/impeller/entity/contents/filters/inputs/placeholder_filter_input.h +++ b/engine/src/flutter/impeller/entity/contents/filters/inputs/placeholder_filter_input.h @@ -15,9 +15,6 @@ class PlaceholderFilterInput final : public FilterInput { ~PlaceholderFilterInput() override; - // |FilterInput| - Variant GetInput() const override; - // |FilterInput| std::optional GetSnapshot(const std::string& label, const ContentContext& renderer, diff --git a/engine/src/flutter/impeller/entity/contents/filters/inputs/texture_filter_input.cc b/engine/src/flutter/impeller/entity/contents/filters/inputs/texture_filter_input.cc index b18c90f135..0e84e74037 100644 --- a/engine/src/flutter/impeller/entity/contents/filters/inputs/texture_filter_input.cc +++ b/engine/src/flutter/impeller/entity/contents/filters/inputs/texture_filter_input.cc @@ -16,10 +16,6 @@ TextureFilterInput::TextureFilterInput(std::shared_ptr texture, TextureFilterInput::~TextureFilterInput() = default; -FilterInput::Variant TextureFilterInput::GetInput() const { - return texture_; -} - std::optional TextureFilterInput::GetSnapshot( const std::string& label, const ContentContext& renderer, diff --git a/engine/src/flutter/impeller/entity/contents/filters/inputs/texture_filter_input.h b/engine/src/flutter/impeller/entity/contents/filters/inputs/texture_filter_input.h index 5adbe4bb7b..218659b28e 100644 --- a/engine/src/flutter/impeller/entity/contents/filters/inputs/texture_filter_input.h +++ b/engine/src/flutter/impeller/entity/contents/filters/inputs/texture_filter_input.h @@ -15,9 +15,6 @@ class TextureFilterInput final : public FilterInput { public: ~TextureFilterInput() override; - // |FilterInput| - Variant GetInput() const override; - // |FilterInput| std::optional GetSnapshot(const std::string& label, const ContentContext& renderer, diff --git a/engine/src/flutter/impeller/entity/contents/filters/matrix_filter_contents.cc b/engine/src/flutter/impeller/entity/contents/filters/matrix_filter_contents.cc index 1ffaddb3db..289e67fc92 100644 --- a/engine/src/flutter/impeller/entity/contents/filters/matrix_filter_contents.cc +++ b/engine/src/flutter/impeller/entity/contents/filters/matrix_filter_contents.cc @@ -20,10 +20,6 @@ void MatrixFilterContents::SetRenderingMode( FilterContents::SetRenderingMode(rendering_mode); } -bool MatrixFilterContents::IsTranslationOnly() const { - return matrix_.Basis().IsIdentity() && FilterContents::IsTranslationOnly(); -} - void MatrixFilterContents::SetSamplerDescriptor(SamplerDescriptor desc) { sampler_descriptor_ = std::move(desc); } diff --git a/engine/src/flutter/impeller/entity/contents/filters/matrix_filter_contents.h b/engine/src/flutter/impeller/entity/contents/filters/matrix_filter_contents.h index dd6334e416..9083433a6e 100644 --- a/engine/src/flutter/impeller/entity/contents/filters/matrix_filter_contents.h +++ b/engine/src/flutter/impeller/entity/contents/filters/matrix_filter_contents.h @@ -21,9 +21,6 @@ class MatrixFilterContents final : public FilterContents { // |FilterContents| void SetRenderingMode(Entity::RenderingMode rendering_mode) override; - // |FilterContents| - bool IsTranslationOnly() const override; - void SetSamplerDescriptor(SamplerDescriptor desc); // |FilterContents| diff --git a/engine/src/flutter/impeller/entity/contents/filters/matrix_filter_contents_unittests.cc b/engine/src/flutter/impeller/entity/contents/filters/matrix_filter_contents_unittests.cc index 6079331d7f..c57ae258fc 100644 --- a/engine/src/flutter/impeller/entity/contents/filters/matrix_filter_contents_unittests.cc +++ b/engine/src/flutter/impeller/entity/contents/filters/matrix_filter_contents_unittests.cc @@ -42,11 +42,6 @@ class MatrixFilterContentsTest : public EntityPlayground { INSTANTIATE_PLAYGROUND_SUITE(MatrixFilterContentsTest); -TEST(MatrixFilterContentsTest, Create) { - MatrixFilterContents contents; - EXPECT_TRUE(contents.IsTranslationOnly()); -} - TEST(MatrixFilterContentsTest, CoverageEmpty) { MatrixFilterContents contents; FilterInput::Vector inputs = {};