@@ -4003,6 +4003,30 @@ TEST_P(AiksTest, GaussianBlurRotatedAndClipped) {
4003
4003
ASSERT_TRUE (OpenPlaygroundHere (canvas.EndRecordingAsPicture ()));
4004
4004
}
4005
4005
4006
+ TEST_P (AiksTest, GaussianBlurScaledAndClipped) {
4007
+ Canvas canvas;
4008
+ std::shared_ptr<Texture> boston = CreateTextureForFixture (" boston.jpg" );
4009
+ Rect bounds =
4010
+ Rect::MakeXYWH (0 , 0 , boston->GetSize ().width , boston->GetSize ().height );
4011
+ Vector2 image_center = Vector2 (bounds.GetSize () / 2 );
4012
+ Paint paint = {.image_filter =
4013
+ ImageFilter::MakeBlur (Sigma (20.0 ), Sigma (20.0 ),
4014
+ FilterContents::BlurStyle::kNormal ,
4015
+ Entity::TileMode::kDecal )};
4016
+ Vector2 clip_size = {150 , 75 };
4017
+ Vector2 center = Vector2 (1024 , 768 ) / 2 ;
4018
+ canvas.Scale (GetContentScale ());
4019
+ canvas.ClipRect (
4020
+ Rect::MakeLTRB (center.x , center.y , center.x , center.y ).Expand (clip_size));
4021
+ canvas.Translate ({center.x , center.y , 0 });
4022
+ canvas.Scale ({0.6 , 0.6 , 1 });
4023
+
4024
+ canvas.DrawImageRect (std::make_shared<Image>(boston), /* source=*/ bounds,
4025
+ /* dest=*/ bounds.Shift (-image_center), paint);
4026
+
4027
+ ASSERT_TRUE (OpenPlaygroundHere (canvas.EndRecordingAsPicture ()));
4028
+ }
4029
+
4006
4030
TEST_P (AiksTest, GaussianBlurRotatedAndClippedInteractive) {
4007
4031
std::shared_ptr<Texture> boston = CreateTextureForFixture (" boston.jpg" );
4008
4032
@@ -4013,11 +4037,13 @@ TEST_P(AiksTest, GaussianBlurRotatedAndClippedInteractive) {
4013
4037
Entity::TileMode::kMirror , Entity::TileMode::kDecal };
4014
4038
4015
4039
static float rotation = 0 ;
4040
+ static float scale = 0.6 ;
4016
4041
static int selected_tile_mode = 3 ;
4017
4042
4018
4043
ImGui::Begin (" Controls" , nullptr , ImGuiWindowFlags_AlwaysAutoResize);
4019
4044
{
4020
4045
ImGui::SliderFloat (" Rotation (degrees)" , &rotation, -180 , 180 );
4046
+ ImGui::SliderFloat (" Scale" , &scale, 0 , 2.0 );
4021
4047
ImGui::Combo (" Tile mode" , &selected_tile_mode, tile_mode_names,
4022
4048
sizeof (tile_mode_names) / sizeof (char *));
4023
4049
}
@@ -4038,7 +4064,7 @@ TEST_P(AiksTest, GaussianBlurRotatedAndClippedInteractive) {
4038
4064
canvas.ClipRect (
4039
4065
Rect::MakeLTRB (handle_a.x , handle_a.y , handle_b.x , handle_b.y ));
4040
4066
canvas.Translate ({center.x , center.y , 0 });
4041
- canvas.Scale ({0.6 , 0.6 , 1 });
4067
+ canvas.Scale ({scale, scale , 1 });
4042
4068
canvas.Rotate (Degrees (rotation));
4043
4069
4044
4070
canvas.DrawImageRect (std::make_shared<Image>(boston), /* source=*/ bounds,
0 commit comments