[Impeller] Don't cull cover fills (flutter/engine#34750)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user