[Impeller] fix typo in setup for fast elliptical rrect blurs (flutter/engine#53673)

This typo was discovered while converting the AIKS tests to DisplayList - the new test executes correctly, but the old test generated bad goldens due to this typo. Fixing the typo to fix the golden prior to landing the test conversion.

The fix should be covered by existing tests - in fact the change is correcting an already bad golden test to correct behavior.
This commit is contained in:
Jim Graham
2024-07-02 13:44:16 -07:00
committed by GitHub
parent 257debbaf0
commit 702c6cec66
3 changed files with 30 additions and 1 deletions

View File

@@ -1246,6 +1246,32 @@ TEST_P(AiksTest, SolidColorCirclesOvalsRRectsMaskBlurCorrectly) {
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
}
TEST_P(AiksTest, FastEllipticalRRectMaskBlursRenderCorrectly) {
Canvas canvas;
canvas.Scale(GetContentScale());
Paint paint;
paint.mask_blur_descriptor = Paint::MaskBlurDescriptor{
.style = FilterContents::BlurStyle::kNormal,
.sigma = Sigma{1},
};
canvas.DrawPaint({.color = Color::White()});
paint.color = Color::Blue();
for (int i = 0; i < 5; i++) {
Scalar y = i * 125;
Scalar y_radius = i * 15;
for (int j = 0; j < 5; j++) {
Scalar x = j * 125;
Scalar x_radius = j * 15;
canvas.DrawRRect(Rect::MakeXYWH(x + 50, y + 50, 100.0f, 100.0f),
{x_radius, y_radius}, paint);
}
}
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
}
TEST_P(AiksTest, FilledRoundRectPathsRenderCorrectly) {
Canvas canvas;
canvas.Scale(GetContentScale());

View File

@@ -113,7 +113,7 @@ bool SolidRRectBlurContents::Render(const ContentContext& renderer,
frag_info.rect_size = Point(positive_rect.GetSize());
frag_info.corner_radii = {std::clamp(corner_radii_.width, kEhCloseEnough,
positive_rect.GetWidth() * 0.5f),
std::clamp(corner_radii_.width, kEhCloseEnough,
std::clamp(corner_radii_.height, kEhCloseEnough,
positive_rect.GetHeight() * 0.5f)};
pass.SetCommandLabel("RRect Shadow");

View File

@@ -596,6 +596,9 @@ impeller_Play_AiksTest_EmptySaveLayerIgnoresPaint_Vulkan.png
impeller_Play_AiksTest_EmptySaveLayerRendersWithClear_Metal.png
impeller_Play_AiksTest_EmptySaveLayerRendersWithClear_OpenGLES.png
impeller_Play_AiksTest_EmptySaveLayerRendersWithClear_Vulkan.png
impeller_Play_AiksTest_FastEllipticalRRectMaskBlursRenderCorrectly_Metal.png
impeller_Play_AiksTest_FastEllipticalRRectMaskBlursRenderCorrectly_OpenGLES.png
impeller_Play_AiksTest_FastEllipticalRRectMaskBlursRenderCorrectly_Vulkan.png
impeller_Play_AiksTest_FastGradientTestHorizontalReversed_Metal.png
impeller_Play_AiksTest_FastGradientTestHorizontalReversed_OpenGLES.png
impeller_Play_AiksTest_FastGradientTestHorizontalReversed_Vulkan.png