Fixed solid blur style math (flutter/engine#55194)

fixes https://github.com/flutter/flutter/issues/155075

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
gaaclarke
2024-09-17 15:24:05 -07:00
committed by GitHub
parent 5336d5d435
commit c62d331944
2 changed files with 20 additions and 21 deletions

View File

@@ -291,6 +291,7 @@ static sk_sp<DisplayList> MaskBlurVariantTest(
builder.Scale(test_context.GetContentScale().x,
test_context.GetContentScale().y);
builder.Scale(0.8f, 0.8f);
builder.Translate(50.f, 50.f);
DlPaint draw_paint;
draw_paint.setColor(

View File

@@ -565,28 +565,26 @@ Entity ApplyBlurStyle(FilterContents::BlurStyle blur_style,
Entity::FromSnapshot(input_snapshot, entity.GetBlendMode());
Entity result;
Matrix blurred_transform = blur_entity.GetTransform();
Matrix snapshot_transform =
entity.GetTransform() * snapshot_entity.GetTransform();
Matrix snapshot_transform = entity.GetTransform() * //
Matrix::MakeScale(1.f / source_space_scalar) *
input_snapshot.transform;
result.SetContents(Contents::MakeAnonymous(
fml::MakeCopyable(
[blur_entity = blur_entity.Clone(), blurred_transform,
source_space_scalar, snapshot_transform,
snapshot_entity = std::move(snapshot_entity)](
const ContentContext& renderer, const Entity& entity,
RenderPass& pass) mutable {
bool result = true;
snapshot_entity.SetTransform(
entity.GetTransform() *
Matrix::MakeScale(1.f / source_space_scalar) *
snapshot_transform);
snapshot_entity.SetClipDepth(entity.GetClipDepth());
result = result && snapshot_entity.Render(renderer, pass);
blur_entity.SetClipDepth(entity.GetClipDepth());
blur_entity.SetTransform(entity.GetTransform() *
blurred_transform);
result = result && blur_entity.Render(renderer, pass);
return result;
}),
fml::MakeCopyable([blur_entity = blur_entity.Clone(),
blurred_transform, snapshot_transform,
snapshot_entity = std::move(snapshot_entity)](
const ContentContext& renderer,
const Entity& entity,
RenderPass& pass) mutable {
bool result = true;
snapshot_entity.SetTransform(entity.GetTransform() *
snapshot_transform);
snapshot_entity.SetClipDepth(entity.GetClipDepth());
result = result && snapshot_entity.Render(renderer, pass);
blur_entity.SetClipDepth(entity.GetClipDepth());
blur_entity.SetTransform(entity.GetTransform() * blurred_transform);
result = result && blur_entity.Render(renderer, pass);
return result;
}),
fml::MakeCopyable([blur_entity = blur_entity.Clone(),
blurred_transform](const Entity& entity) mutable {
blur_entity.SetTransform(entity.GetTransform() * blurred_transform);