Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions impeller/display_list/aiks_dl_text_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
22 changes: 13 additions & 9 deletions impeller/display_list/dl_dispatcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
3 changes: 3 additions & 0 deletions testing/impeller_golden_tests_output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down