Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit d855d78

Browse files
author
jonahwilliams
committed
++
1 parent df44ce2 commit d855d78

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

impeller/display_list/aiks_dl_unittests.cc

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,5 +765,40 @@ TEST_P(AiksTest, MatrixBackdropFilter) {
765765
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
766766
}
767767

768+
TEST_P(AiksTest, MatrixSaveLayerFilter) {
769+
DisplayListBuilder builder;
770+
771+
DlPaint paint;
772+
paint.setColor(DlColor::kBlack());
773+
builder.DrawPaint(paint);
774+
builder.SaveLayer({}, nullptr);
775+
{
776+
paint.setColor(DlColor::kGreen().withAlpha(255 * 0.5));
777+
paint.setBlendMode(DlBlendMode::kPlus);
778+
builder.DrawCircle({200, 200}, 100, paint);
779+
// Should render a second circle, centered on the bottom-right-most edge of
780+
// the circle.
781+
782+
SkMatrix matrix = SkMatrix::Translate((200 + 100 * k1OverSqrt2),
783+
(200 + 100 * k1OverSqrt2)) *
784+
SkMatrix::Scale(0.5, 0.5) *
785+
SkMatrix::Translate(-200, -200);
786+
DlPaint save_paint;
787+
save_paint.setImageFilter(
788+
DlMatrixImageFilter::Make(matrix, DlImageSampling::kLinear));
789+
790+
builder.SaveLayer(nullptr, &save_paint);
791+
792+
DlPaint circle_paint;
793+
circle_paint.setColor(DlColor::kGreen().withAlpha(255 * 0.5));
794+
circle_paint.setBlendMode(DlBlendMode::kPlus);
795+
builder.DrawCircle({200, 200}, 100, circle_paint);
796+
builder.Restore();
797+
}
798+
builder.Restore();
799+
800+
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
801+
}
802+
768803
} // namespace testing
769804
} // namespace impeller

testing/impeller_golden_tests_output.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,9 @@ impeller_Play_AiksTest_CanSaveLayerStandalone_Vulkan.png
493493
impeller_Play_AiksTest_ClearBlendWithBlur_Metal.png
494494
impeller_Play_AiksTest_ClearBlendWithBlur_OpenGLES.png
495495
impeller_Play_AiksTest_ClearBlendWithBlur_Vulkan.png
496+
impeller_Play_AiksTest_ClearBlend_Metal.png
497+
impeller_Play_AiksTest_ClearBlend_OpenGLES.png
498+
impeller_Play_AiksTest_ClearBlend_Vulkan.png
496499
impeller_Play_AiksTest_ClearColorOptimizationWhenSubpassIsBiggerThanParentPass_Metal.png
497500
impeller_Play_AiksTest_ClearColorOptimizationWhenSubpassIsBiggerThanParentPass_OpenGLES.png
498501
impeller_Play_AiksTest_ClearColorOptimizationWhenSubpassIsBiggerThanParentPass_Vulkan.png

0 commit comments

Comments
 (0)