@@ -379,7 +379,7 @@ TEST_P(AiksTest, DrawVerticesWithInvalidIndices) {
379379}
380380
381381// All four vertices should form a solid red rectangle with no gaps.
382- // The blur rectangle drawn under them should not be visible.
382+ // The blue rectangle drawn under them should not be visible.
383383TEST_P (AiksTest, DrawVerticesTextureCoordinatesWithFragmentShader) {
384384 std::vector<SkPoint> positions_lt = {
385385 SkPoint::Make (0 , 0 ), //
@@ -468,5 +468,54 @@ TEST_P(AiksTest, DrawVerticesTextureCoordinatesWithFragmentShader) {
468468 ASSERT_TRUE (OpenPlaygroundHere (builder.Build ()));
469469}
470470
471+ // The vertices should form a solid red rectangle with no gaps.
472+ // The blue rectangle drawn under them should not be visible.
473+ TEST_P (AiksTest,
474+ DrawVerticesTextureCoordinatesWithFragmentShaderNonZeroOrigin) {
475+ std::vector<SkPoint> positions_lt = {
476+ SkPoint::Make (200 , 200 ), //
477+ SkPoint::Make (250 , 200 ), //
478+ SkPoint::Make (200 , 250 ), //
479+ SkPoint::Make (250 , 250 ), //
480+ };
481+
482+ auto vertices = flutter::DlVertices::Make (
483+ flutter::DlVertexMode::kTriangleStrip , positions_lt.size (),
484+ positions_lt.data (),
485+ /* texture_coordinates=*/ positions_lt.data (), /* colors=*/ nullptr ,
486+ /* index_count=*/ 0 ,
487+ /* indices=*/ nullptr );
488+
489+ flutter::DisplayListBuilder builder;
490+ flutter::DlPaint paint;
491+ flutter::DlPaint rect_paint;
492+ rect_paint.setColor (DlColor::kBlue ());
493+
494+ auto runtime_stages =
495+ OpenAssetAsRuntimeStage (" runtime_stage_position.frag.iplr" );
496+
497+ auto runtime_stage =
498+ runtime_stages[PlaygroundBackendToRuntimeStageBackend (GetBackend ())];
499+ ASSERT_TRUE (runtime_stage);
500+
501+ auto runtime_effect = DlRuntimeEffect::MakeImpeller (runtime_stage);
502+ auto rect_data = std::vector<Rect>{Rect::MakeLTRB (200 , 200 , 250 , 250 )};
503+
504+ auto uniform_data = std::make_shared<std::vector<uint8_t >>();
505+ uniform_data->resize (rect_data.size () * sizeof (Rect));
506+ memcpy (uniform_data->data (), rect_data.data (), uniform_data->size ());
507+
508+ auto color_source = flutter::DlColorSource::MakeRuntimeEffect (
509+ runtime_effect, {}, uniform_data);
510+
511+ paint.setColorSource (color_source);
512+
513+ builder.Scale (GetContentScale ().x , GetContentScale ().y );
514+ builder.DrawRect (SkRect::MakeLTRB (200 , 200 , 250 , 250 ), rect_paint);
515+ builder.DrawVertices (vertices, flutter::DlBlendMode::kSrcOver , paint);
516+
517+ ASSERT_TRUE (OpenPlaygroundHere (builder.Build ()));
518+ }
519+
471520} // namespace testing
472521} // namespace impeller
0 commit comments