diff --git a/engine/src/flutter/impeller/entity/contents/solid_color_contents.cc b/engine/src/flutter/impeller/entity/contents/solid_color_contents.cc index 2af3815158..c7895518e4 100644 --- a/engine/src/flutter/impeller/entity/contents/solid_color_contents.cc +++ b/engine/src/flutter/impeller/entity/contents/solid_color_contents.cc @@ -41,6 +41,11 @@ std::optional SolidColorContents::GetCoverage( return path_.GetTransformedBoundingBox(entity.GetTransformation()); }; +bool SolidColorContents::ShouldRender(const Entity& entity, + const ISize& target_size) const { + return cover_ || Contents::ShouldRender(entity, target_size); +} + VertexBuffer SolidColorContents::CreateSolidFillVertices(const Path& path, HostBuffer& buffer) { using VS = SolidFillPipeline::VertexShader; diff --git a/engine/src/flutter/impeller/entity/contents/solid_color_contents.h b/engine/src/flutter/impeller/entity/contents/solid_color_contents.h index 470b018051..b3f65a1f5e 100644 --- a/engine/src/flutter/impeller/entity/contents/solid_color_contents.h +++ b/engine/src/flutter/impeller/entity/contents/solid_color_contents.h @@ -41,6 +41,10 @@ class SolidColorContents final : public Contents { // |Contents| std::optional GetCoverage(const Entity& entity) const override; + // |Contents| + bool ShouldRender(const Entity& entity, + const ISize& target_size) const override; + // |Contents| bool Render(const ContentContext& renderer, const Entity& entity, diff --git a/engine/src/flutter/impeller/entity/entity_unittests.cc b/engine/src/flutter/impeller/entity/entity_unittests.cc index 6c682ba769..fe3a442ef4 100644 --- a/engine/src/flutter/impeller/entity/entity_unittests.cc +++ b/engine/src/flutter/impeller/entity/entity_unittests.cc @@ -1132,6 +1132,14 @@ TEST_P(EntityTest, SolidFillShouldRenderIsCorrect) { PathBuilder{}.AddRect(Rect::MakeLTRB(0, 0, 100, 100)).TakePath()); ASSERT_TRUE(fill->ShouldRender(Entity{}, {100, 100})); } + + // With paint cover. + { + auto fill = std::make_shared(); + fill->SetColor(Color::CornflowerBlue()); + fill->SetCover(true); + ASSERT_TRUE(fill->ShouldRender(Entity{}, {100, 100})); + } } TEST_P(EntityTest, ClipContentsShouldRenderIsCorrect) {