@@ -4003,6 +4003,30 @@ TEST_P(AiksTest, GaussianBlurRotatedAndClipped) {
40034003 ASSERT_TRUE (OpenPlaygroundHere (canvas.EndRecordingAsPicture ()));
40044004}
40054005
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+
40064030TEST_P (AiksTest, GaussianBlurRotatedAndClippedInteractive) {
40074031 std::shared_ptr<Texture> boston = CreateTextureForFixture (" boston.jpg" );
40084032
@@ -4013,11 +4037,13 @@ TEST_P(AiksTest, GaussianBlurRotatedAndClippedInteractive) {
40134037 Entity::TileMode::kMirror , Entity::TileMode::kDecal };
40144038
40154039 static float rotation = 0 ;
4040+ static float scale = 0.6 ;
40164041 static int selected_tile_mode = 3 ;
40174042
40184043 ImGui::Begin (" Controls" , nullptr , ImGuiWindowFlags_AlwaysAutoResize);
40194044 {
40204045 ImGui::SliderFloat (" Rotation (degrees)" , &rotation, -180 , 180 );
4046+ ImGui::SliderFloat (" Scale" , &scale, 0 , 2.0 );
40214047 ImGui::Combo (" Tile mode" , &selected_tile_mode, tile_mode_names,
40224048 sizeof (tile_mode_names) / sizeof (char *));
40234049 }
@@ -4038,7 +4064,7 @@ TEST_P(AiksTest, GaussianBlurRotatedAndClippedInteractive) {
40384064 canvas.ClipRect (
40394065 Rect::MakeLTRB (handle_a.x , handle_a.y , handle_b.x , handle_b.y ));
40404066 canvas.Translate ({center.x , center.y , 0 });
4041- canvas.Scale ({0.6 , 0.6 , 1 });
4067+ canvas.Scale ({scale, scale , 1 });
40424068 canvas.Rotate (Degrees (rotation));
40434069
40444070 canvas.DrawImageRect (std::make_shared<Image>(boston), /* source=*/ bounds,
0 commit comments