From b32ab5e9a0cc5b567938698d2262392e3bf0bb7e Mon Sep 17 00:00:00 2001 From: Dan Field Date: Tue, 25 Jul 2023 16:05:03 -0700 Subject: [PATCH 1/2] Remove duplicated code --- impeller/entity/contents/color_source_contents.cc | 9 --------- impeller/entity/contents/color_source_contents.h | 6 +----- impeller/entity/contents/solid_color_contents.cc | 9 --------- impeller/entity/contents/solid_color_contents.h | 4 ---- 4 files changed, 1 insertion(+), 27 deletions(-) diff --git a/impeller/entity/contents/color_source_contents.cc b/impeller/entity/contents/color_source_contents.cc index 6737702dfc276..24b19566fccc0 100644 --- a/impeller/entity/contents/color_source_contents.cc +++ b/impeller/entity/contents/color_source_contents.cc @@ -51,13 +51,4 @@ void ColorSourceContents::SetInheritedOpacity(Scalar opacity) { inherited_opacity_ = opacity; } -bool ColorSourceContents::ShouldRender( - const Entity& entity, - const std::optional& stencil_coverage) const { - if (!stencil_coverage.has_value()) { - return false; - } - return Contents::ShouldRender(entity, stencil_coverage); -} - } // namespace impeller diff --git a/impeller/entity/contents/color_source_contents.h b/impeller/entity/contents/color_source_contents.h index d6a580d2126ce..b26efddadb279 100644 --- a/impeller/entity/contents/color_source_contents.h +++ b/impeller/entity/contents/color_source_contents.h @@ -92,11 +92,7 @@ class ColorSourceContents : public Contents { // |Contents| std::optional GetCoverage(const Entity& entity) const override; - - // |Contents| - bool ShouldRender(const Entity& entity, - const std::optional& stencil_coverage) const override; - + // |Contents| bool CanInheritOpacity(const Entity& entity) const override; diff --git a/impeller/entity/contents/solid_color_contents.cc b/impeller/entity/contents/solid_color_contents.cc index 8a2ceadacfa25..b90f3ffbe263f 100644 --- a/impeller/entity/contents/solid_color_contents.cc +++ b/impeller/entity/contents/solid_color_contents.cc @@ -41,15 +41,6 @@ std::optional SolidColorContents::GetCoverage( return geometry->GetCoverage(entity.GetTransformation()); }; -bool SolidColorContents::ShouldRender( - const Entity& entity, - const std::optional& stencil_coverage) const { - if (!stencil_coverage.has_value()) { - return false; - } - return Contents::ShouldRender(entity, stencil_coverage); -} - bool SolidColorContents::Render(const ContentContext& renderer, const Entity& entity, RenderPass& pass) const { diff --git a/impeller/entity/contents/solid_color_contents.h b/impeller/entity/contents/solid_color_contents.h index 6af6489c13902..3d704b4ee7898 100644 --- a/impeller/entity/contents/solid_color_contents.h +++ b/impeller/entity/contents/solid_color_contents.h @@ -40,10 +40,6 @@ class SolidColorContents final : public ColorSourceContents { // |Contents| std::optional GetCoverage(const Entity& entity) const override; - // |Contents| - bool ShouldRender(const Entity& entity, - const std::optional& stencil_coverage) const override; - // |Contents| bool Render(const ContentContext& renderer, const Entity& entity, From 49626d7cfee7fac5389812f1db2df9b53329091b Mon Sep 17 00:00:00 2001 From: Dan Field Date: Tue, 25 Jul 2023 16:06:37 -0700 Subject: [PATCH 2/2] Update color_source_contents.h --- impeller/entity/contents/color_source_contents.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/impeller/entity/contents/color_source_contents.h b/impeller/entity/contents/color_source_contents.h index b26efddadb279..5ae6f15499bff 100644 --- a/impeller/entity/contents/color_source_contents.h +++ b/impeller/entity/contents/color_source_contents.h @@ -92,7 +92,7 @@ class ColorSourceContents : public Contents { // |Contents| std::optional GetCoverage(const Entity& entity) const override; - + // |Contents| bool CanInheritOpacity(const Entity& entity) const override;