[Impeller] Don't cull cover fills (flutter/engine#34750)

This commit is contained in:
Brandon DeRosier
2022-07-19 10:59:03 -07:00
committed by GitHub
parent 75181f6dad
commit 283ac2c434
3 changed files with 17 additions and 0 deletions

View File

@@ -41,6 +41,11 @@ std::optional<Rect> 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;

View File

@@ -41,6 +41,10 @@ class SolidColorContents final : public Contents {
// |Contents|
std::optional<Rect> 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,

View File

@@ -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<SolidColorContents>();
fill->SetColor(Color::CornflowerBlue());
fill->SetCover(true);
ASSERT_TRUE(fill->ShouldRender(Entity{}, {100, 100}));
}
}
TEST_P(EntityTest, ClipContentsShouldRenderIsCorrect) {