@@ -354,5 +354,95 @@ TEST_P(AiksTest, DrawVerticesPremultipliesColors) {
354354 ASSERT_TRUE (OpenPlaygroundHere (builder.Build ()));
355355}
356356
357+ // All four vertices should form a solid red rectangle with no gaps.
358+ // The blur rectangle drawn under them should not be visible.
359+ TEST_P (AiksTest, DrawVerticesTextureCoordinatesWithFragmentShader) {
360+ std::vector<SkPoint> positions_lt = {
361+ SkPoint::Make (0 , 0 ), //
362+ SkPoint::Make (50 , 0 ), //
363+ SkPoint::Make (0 , 50 ), //
364+ SkPoint::Make (50 , 50 ), //
365+ };
366+
367+ auto vertices_lt = flutter::DlVertices::Make (
368+ flutter::DlVertexMode::kTriangleStrip , positions_lt.size (),
369+ positions_lt.data (),
370+ /* texture_coordinates=*/ positions_lt.data (), /* colors=*/ nullptr ,
371+ /* index_count=*/ 0 ,
372+ /* indices=*/ nullptr );
373+
374+ std::vector<SkPoint> positions_rt = {
375+ SkPoint::Make (50 , 0 ), //
376+ SkPoint::Make (100 , 0 ), //
377+ SkPoint::Make (50 , 50 ), //
378+ SkPoint::Make (100 , 50 ), //
379+ };
380+
381+ auto vertices_rt = flutter::DlVertices::Make (
382+ flutter::DlVertexMode::kTriangleStrip , positions_rt.size (),
383+ positions_rt.data (),
384+ /* texture_coordinates=*/ positions_rt.data (), /* colors=*/ nullptr ,
385+ /* index_count=*/ 0 ,
386+ /* indices=*/ nullptr );
387+
388+ std::vector<SkPoint> positions_lb = {
389+ SkPoint::Make (0 , 50 ), //
390+ SkPoint::Make (50 , 50 ), //
391+ SkPoint::Make (0 , 100 ), //
392+ SkPoint::Make (50 , 100 ), //
393+ };
394+
395+ auto vertices_lb = flutter::DlVertices::Make (
396+ flutter::DlVertexMode::kTriangleStrip , positions_lb.size (),
397+ positions_lb.data (),
398+ /* texture_coordinates=*/ positions_lb.data (), /* colors=*/ nullptr ,
399+ /* index_count=*/ 0 ,
400+ /* indices=*/ nullptr );
401+
402+ std::vector<SkPoint> positions_rb = {
403+ SkPoint::Make (50 , 50 ), //
404+ SkPoint::Make (100 , 50 ), //
405+ SkPoint::Make (50 , 100 ), //
406+ SkPoint::Make (100 , 100 ), //
407+ };
408+
409+ auto vertices_rb = flutter::DlVertices::Make (
410+ flutter::DlVertexMode::kTriangleStrip , positions_rb.size (),
411+ positions_rb.data (),
412+ /* texture_coordinates=*/ positions_rb.data (), /* colors=*/ nullptr ,
413+ /* index_count=*/ 0 ,
414+ /* indices=*/ nullptr );
415+
416+ flutter::DisplayListBuilder builder;
417+ flutter::DlPaint paint;
418+ flutter::DlPaint rect_paint;
419+ rect_paint.setColor (DlColor::kBlue ());
420+
421+ auto runtime_stages =
422+ OpenAssetAsRuntimeStage (" runtime_stage_simple.frag.iplr" );
423+
424+ auto runtime_stage =
425+ runtime_stages[PlaygroundBackendToRuntimeStageBackend (GetBackend ())];
426+ ASSERT_TRUE (runtime_stage);
427+
428+ auto runtime_effect = DlRuntimeEffect::MakeImpeller (runtime_stage);
429+ auto uniform_data = std::make_shared<std::vector<uint8_t >>();
430+ auto color_source = flutter::DlColorSource::MakeRuntimeEffect (
431+ runtime_effect, {}, uniform_data);
432+
433+ paint.setColorSource (color_source);
434+
435+ builder.Scale (GetContentScale ().x , GetContentScale ().y );
436+ builder.Save ();
437+ builder.DrawRect (SkRect::MakeLTRB (0 , 0 , 100 , 100 ), rect_paint);
438+ builder.DrawVertices (vertices_lt, flutter::DlBlendMode::kSrcOver , paint);
439+ builder.DrawVertices (vertices_rt, flutter::DlBlendMode::kSrcOver , paint);
440+ builder.DrawVertices (vertices_lb, flutter::DlBlendMode::kSrcOver , paint);
441+ builder.DrawVertices (vertices_rb, flutter::DlBlendMode::kSrcOver , paint);
442+ builder.Restore ();
443+
444+ ASSERT_TRUE (OpenPlaygroundHere (builder.Build ()));
445+ }
446+
357447} // namespace testing
358448} // namespace impeller
0 commit comments