@@ -766,12 +766,12 @@ TEST_P(EntityTest, GaussianBlurFilter) {
766
766
// Renders a red "cover" rectangle that shows the original position of the
767
767
// unfiltered input.
768
768
Entity cover_entity;
769
- cover_entity.SetContents (
770
- SolidColorContents::Make ( PathBuilder{}
771
- .AddRect (Rect (- Point (bridge-> GetSize ()) / 2 ,
772
- Size (bridge->GetSize ())))
773
- .TakePath (),
774
- cover_color));
769
+ cover_entity.SetContents (SolidColorContents::Make (
770
+ PathBuilder{}
771
+ .AddRect (
772
+ Rect (- Point (bridge-> GetSize ()) / 2 , Size (bridge->GetSize ())))
773
+ .TakePath (),
774
+ cover_color));
775
775
cover_entity.SetTransformation (ctm);
776
776
777
777
cover_entity.Render (context, pass);
@@ -853,5 +853,33 @@ TEST_P(EntityTest, SolidStrokeCoverageIsCorrect) {
853
853
}
854
854
}
855
855
856
+ TEST_P (EntityTest, BorderMaskBlurCoverageIsCorrect) {
857
+ auto fill = std::make_shared<SolidColorContents>();
858
+ fill->SetPath (
859
+ PathBuilder{}.AddRect (Rect::MakeXYWH (0 , 0 , 300 , 400 )).TakePath ());
860
+ fill->SetColor (Color::CornflowerBlue ());
861
+ auto border_mask_blur = FilterContents::MakeBorderMaskBlur (
862
+ FilterInput::Make (fill), FilterContents::Radius{3 },
863
+ FilterContents::Radius{4 });
864
+
865
+ {
866
+ Entity e;
867
+ e.SetTransformation (Matrix ());
868
+ auto actual = border_mask_blur->GetCoverage (e);
869
+ auto expected = Rect::MakeXYWH (-3 , -4 , 306 , 408 );
870
+ ASSERT_TRUE (actual.has_value ());
871
+ ASSERT_RECT_NEAR (actual.value (), expected);
872
+ }
873
+
874
+ {
875
+ Entity e;
876
+ e.SetTransformation (Matrix::MakeRotationZ (Radians{kPi / 4 }));
877
+ auto actual = border_mask_blur->GetCoverage (e);
878
+ auto expected = Rect::MakeXYWH (-287.792 , -4.94975 , 504.874 , 504.874 );
879
+ ASSERT_TRUE (actual.has_value ());
880
+ ASSERT_RECT_NEAR (actual.value (), expected);
881
+ }
882
+ }
883
+
856
884
} // namespace testing
857
885
} // namespace impeller
0 commit comments