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
4 changes: 4 additions & 0 deletions impeller/display_list/dl_dispatcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,10 @@ void DlDispatcher::drawDisplayList(
Matrix saved_initial_matrix = initial_matrix_;
int restore_count = canvas_.GetSaveCount();

// The display list may alter the clip, which must be restored to the current
// clip at the end of playback.
canvas_.Save();

// Establish a new baseline for interpreting the new DL.
// Matrix and clip are left untouched, the current
// transform is saved as the new base matrix, and paint
Expand Down
13 changes: 13 additions & 0 deletions impeller/display_list/dl_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@ flutter::DlColor toColor(const float* components) {
using DisplayListTest = DlPlayground;
INSTANTIATE_PLAYGROUND_SUITE(DisplayListTest);

TEST_P(DisplayListTest, DrawPictureWithAClip) {
flutter::DisplayListBuilder sub_builder;
sub_builder.ClipRect(SkRect::MakeXYWH(0, 0, 24, 24));
sub_builder.DrawPaint(flutter::DlPaint(flutter::DlColor::kBlue()));

auto display_list = sub_builder.Build();
flutter::DisplayListBuilder builder;
builder.DrawDisplayList(display_list);
builder.DrawRect(SkRect::MakeXYWH(30, 30, 24, 24),
flutter::DlPaint(flutter::DlColor::kRed()));
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
}

TEST_P(DisplayListTest, CanDrawRect) {
flutter::DisplayListBuilder builder;
builder.DrawRect(SkRect::MakeXYWH(10, 10, 100, 100),
Expand Down