diff --git a/impeller/display_list/aiks_dl_text_unittests.cc b/impeller/display_list/aiks_dl_text_unittests.cc index ec25f64e358b2..03c79971b2b12 100644 --- a/impeller/display_list/aiks_dl_text_unittests.cc +++ b/impeller/display_list/aiks_dl_text_unittests.cc @@ -452,6 +452,30 @@ TEST_P(AiksTest, CanRenderTextWithLargePerspectiveTransform) { ASSERT_TRUE(OpenPlaygroundHere(builder.Build())); } +TEST_P(AiksTest, CanRenderTextWithPerspectiveTransformInSublist) { + DisplayListBuilder text_builder; + ASSERT_TRUE(RenderTextInCanvasSkia(GetContext(), text_builder, "Hello world", + "Roboto-Regular.ttf")); + auto text_display_list = text_builder.Build(); + + DisplayListBuilder builder; + + Matrix matrix = Matrix::MakeRow(2.0, 0.0, 0.0, 0.0, // + 0.0, 2.0, 0.0, 0.0, // + 0.0, 0.0, 1.0, 0.0, // + 0.0, 0.002, 0.0, 1.0); + + DlPaint save_paint; + SkRect window_bounds = + SkRect::MakeXYWH(0, 0, GetWindowSize().width, GetWindowSize().height); + builder.SaveLayer(&window_bounds, &save_paint); + builder.Transform(SkM44::ColMajor(matrix.m)); + builder.DrawDisplayList(text_display_list, 1.0f); + builder.Restore(); + + ASSERT_TRUE(OpenPlaygroundHere(builder.Build())); +} + // This currently renders solid blue, as the support for text color sources was // moved into DLDispatching. Path data requires the SkTextBlobs which are not // used in impeller::TextFrames. diff --git a/impeller/display_list/dl_dispatcher.cc b/impeller/display_list/dl_dispatcher.cc index 633e4d1ed735b..9e7bb06df236c 100644 --- a/impeller/display_list/dl_dispatcher.cc +++ b/impeller/display_list/dl_dispatcher.cc @@ -1484,16 +1484,20 @@ void TextFrameDispatcher::drawDisplayList( bool old_has_image_filter = has_image_filter_; has_image_filter_ = false; - Rect local_cull_bounds = GetCurrentLocalCullingBounds(); - if (local_cull_bounds.IsMaximum()) { + if (matrix_.HasPerspective()) { display_list->Dispatch(*this); - } else if (!local_cull_bounds.IsEmpty()) { - IRect cull_rect = IRect::RoundOut(local_cull_bounds); - display_list->Dispatch(*this, SkIRect::MakeLTRB(cull_rect.GetLeft(), // - cull_rect.GetTop(), // - cull_rect.GetRight(), // - cull_rect.GetBottom() // - )); + } else { + Rect local_cull_bounds = GetCurrentLocalCullingBounds(); + if (local_cull_bounds.IsMaximum()) { + display_list->Dispatch(*this); + } else if (!local_cull_bounds.IsEmpty()) { + IRect cull_rect = IRect::RoundOut(local_cull_bounds); + display_list->Dispatch(*this, SkIRect::MakeLTRB(cull_rect.GetLeft(), // + cull_rect.GetTop(), // + cull_rect.GetRight(), // + cull_rect.GetBottom() // + )); + } } restore(); diff --git a/testing/impeller_golden_tests_output.txt b/testing/impeller_golden_tests_output.txt index e8f2276cdc9a4..2adba7ed1f254 100644 --- a/testing/impeller_golden_tests_output.txt +++ b/testing/impeller_golden_tests_output.txt @@ -469,6 +469,9 @@ impeller_Play_AiksTest_CanRenderTextOutsideBoundaries_Vulkan.png impeller_Play_AiksTest_CanRenderTextWithLargePerspectiveTransform_Metal.png impeller_Play_AiksTest_CanRenderTextWithLargePerspectiveTransform_OpenGLES.png impeller_Play_AiksTest_CanRenderTextWithLargePerspectiveTransform_Vulkan.png +impeller_Play_AiksTest_CanRenderTextWithPerspectiveTransformInSublist_Metal.png +impeller_Play_AiksTest_CanRenderTextWithPerspectiveTransformInSublist_OpenGLES.png +impeller_Play_AiksTest_CanRenderTextWithPerspectiveTransformInSublist_Vulkan.png impeller_Play_AiksTest_CanRenderThickCurvedStrokes_Metal.png impeller_Play_AiksTest_CanRenderThickCurvedStrokes_OpenGLES.png impeller_Play_AiksTest_CanRenderThickCurvedStrokes_Vulkan.png