@@ -163,7 +163,7 @@ TEST_P(AiksTest, CanRenderTiledTexture) {
163163 contents->SetTexture (texture);
164164 contents->SetTileModes (x_tile_mode, y_tile_mode);
165165 contents->SetSamplerDescriptor (descriptor);
166- contents->SetMatrix (matrix);
166+ contents->SetEffectTransform (matrix);
167167 return contents;
168168 };
169169 paint.color = Color (1 , 1 , 1 , alpha);
@@ -347,7 +347,7 @@ TEST_P(AiksTest, CanRenderLinearGradient) {
347347 contents->SetColors (std::move (colors));
348348 contents->SetStops (std::move (stops));
349349 contents->SetTileMode (tile_mode);
350- contents->SetMatrix (matrix);
350+ contents->SetEffectTransform (matrix);
351351 return contents;
352352 };
353353 paint.color = Color (1.0 , 1.0 , 1.0 , alpha);
@@ -412,7 +412,7 @@ TEST_P(AiksTest, CanRenderLinearGradientManyColors) {
412412 contents->SetColors (std::move (colors));
413413 contents->SetStops (std::move (stops));
414414 contents->SetTileMode (tile_mode);
415- contents->SetMatrix (matrix);
415+ contents->SetEffectTransform (matrix);
416416 return contents;
417417 };
418418 paint.color = Color (1.0 , 1.0 , 1.0 , alpha);
@@ -468,7 +468,7 @@ TEST_P(AiksTest, CanRenderLinearGradientWayManyColors) {
468468 contents->SetColors (colors);
469469 contents->SetStops (stops);
470470 contents->SetTileMode (tile_mode);
471- contents->SetMatrix (matrix);
471+ contents->SetEffectTransform (matrix);
472472 return contents;
473473 };
474474 canvas.DrawRect ({0 , 0 , 600 , 600 }, paint);
@@ -525,7 +525,7 @@ TEST_P(AiksTest, CanRenderLinearGradientManyColorsUnevenStops) {
525525 contents->SetColors (std::move (colors));
526526 contents->SetStops (std::move (stops));
527527 contents->SetTileMode (tile_mode);
528- contents->SetMatrix (matrix);
528+ contents->SetEffectTransform (matrix);
529529 return contents;
530530 };
531531 canvas.DrawRect ({0 , 0 , 600 , 600 }, paint);
@@ -573,7 +573,7 @@ TEST_P(AiksTest, CanRenderRadialGradient) {
573573 contents->SetColors (std::move (colors));
574574 contents->SetStops (std::move (stops));
575575 contents->SetTileMode (tile_mode);
576- contents->SetMatrix (matrix);
576+ contents->SetEffectTransform (matrix);
577577 return contents;
578578 };
579579 canvas.DrawRect ({0 , 0 , 600 , 600 }, paint);
@@ -635,7 +635,7 @@ TEST_P(AiksTest, CanRenderRadialGradientManyColors) {
635635 contents->SetColors (std::move (colors));
636636 contents->SetStops (std::move (stops));
637637 contents->SetTileMode (tile_mode);
638- contents->SetMatrix (matrix);
638+ contents->SetEffectTransform (matrix);
639639 return contents;
640640 };
641641 canvas.DrawRect ({0 , 0 , 600 , 600 }, paint);
@@ -682,7 +682,7 @@ TEST_P(AiksTest, CanRenderSweepGradient) {
682682 contents->SetColors (std::move (colors));
683683 contents->SetStops (std::move (stops));
684684 contents->SetTileMode (tile_mode);
685- contents->SetMatrix (matrix);
685+ contents->SetEffectTransform (matrix);
686686 return contents;
687687 };
688688 canvas.DrawRect ({0 , 0 , 600 , 600 }, paint);
@@ -744,7 +744,7 @@ TEST_P(AiksTest, CanRenderSweepGradientManyColors) {
744744 contents->SetStops (std::move (stops));
745745 contents->SetColors (std::move (colors));
746746 contents->SetTileMode (tile_mode);
747- contents->SetMatrix (matrix);
747+ contents->SetEffectTransform (matrix);
748748 return contents;
749749 };
750750 canvas.DrawRect ({0 , 0 , 600 , 600 }, paint);
@@ -1509,7 +1509,7 @@ TEST_P(AiksTest, GradientStrokesRenderCorrectly) {
15091509 contents->SetColors (std::move (colors));
15101510 contents->SetStops (std::move (stops));
15111511 contents->SetTileMode (tile_mode);
1512- contents->SetMatrix (matrix);
1512+ contents->SetEffectTransform (matrix);
15131513 return contents;
15141514 };
15151515
@@ -1718,21 +1718,30 @@ TEST_P(AiksTest, SceneColorSource) {
17181718 auto callback = [&](AiksContext& renderer, RenderTarget& render_target) {
17191719 Paint paint;
17201720
1721+ ImGui::Begin (" Controls" , nullptr , ImGuiWindowFlags_AlwaysAutoResize);
1722+ static Scalar distance = 2 ;
1723+ ImGui::SliderFloat (" Distance" , &distance, 0 , 4 );
1724+ static Scalar y_pos = 0 ;
1725+ ImGui::SliderFloat (" Y" , &y_pos, -3 , 3 );
1726+ static Scalar fov = 45 ;
1727+ ImGui::SliderFloat (" FOV" , &fov, 1 , 180 );
1728+ ImGui::End ();
1729+
17211730 paint.color_source_type = Paint::ColorSourceType::kScene ;
1722- paint.color_source = [this , gltf_scene ]() {
1731+ paint.color_source = [& ]() {
17231732 Scalar angle = GetSecondsElapsed ();
1724- Scalar distance = 2 ;
1725- auto camera_position =
1726- Vector3 (distance * std::sin (angle), 2 , -distance * std::cos (angle));
1733+ auto camera_position = Vector3 (distance * std::sin (angle), y_pos,
1734+ -distance * std::cos (angle));
17271735 auto contents = std::make_shared<SceneContents>();
17281736 contents->SetNode (gltf_scene);
17291737 contents->SetCameraTransform (
1730- Matrix::MakePerspective (Degrees (45 ), GetWindowSize (), 0.1 , 1000 ) *
1738+ Matrix::MakePerspective (Degrees (fov ), GetWindowSize (), 0.1 , 1000 ) *
17311739 Matrix::MakeLookAt (camera_position, {0 , 0 , 0 }, {0 , 1 , 0 }));
17321740 return contents;
17331741 };
17341742
17351743 Canvas canvas;
1744+ canvas.DrawPaint (Paint{.color = Color::MakeRGBA8 (0xf9 , 0xf9 , 0xf9 , 0xff )});
17361745 canvas.Scale (GetContentScale ());
17371746 canvas.DrawPaint (paint);
17381747 return renderer.Render (canvas.EndRecordingAsPicture (), render_target);
0 commit comments