Skip to content

Commit 24d7a96

Browse files
Reverts "[display_list] allow applying opacity peephole to single glyph. (flutter#53160)" (flutter#53189)
Reverts: flutter#53160 Initiated by: jonahwilliams Reason for reverting: unexpected framework goldens https://flutter-gold.skia.org/search?issue=149634&crs=github&patchsets=4&corpus=flutter Original PR Author: jonahwilliams Reviewed By: {flar} This change reverts the following previous change: A single glyph can be opacity peepholed, this is common in the case of Icons.
1 parent 8392f0e commit 24d7a96

File tree

5 files changed

+1
-41
lines changed

5 files changed

+1
-41
lines changed

display_list/BUILD.gn

-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ if (enable_unittests) {
131131
":display_list",
132132
":display_list_fixtures",
133133
"//flutter/display_list/testing:display_list_testing",
134-
"//flutter/impeller/typographer/backends/skia:typographer_skia_backend",
135134
"//flutter/testing",
136135
"//flutter/testing:skia",
137136
]

display_list/display_list_unittests.cc

-26
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include "flutter/testing/display_list_testing.h"
2323
#include "flutter/testing/testing.h"
2424

25-
#include "impeller/typographer/backends/skia/text_frame_skia.h"
2625
#include "third_party/skia/include/core/SkBBHFactory.h"
2726
#include "third_party/skia/include/core/SkColorFilter.h"
2827
#include "third_party/skia/include/core/SkPictureRecorder.h"
@@ -4332,30 +4331,5 @@ TEST_F(DisplayListTest, DrawDisplayListForwardsBackdropFlag) {
43324331
EXPECT_TRUE(parent_dl->root_has_backdrop_filter());
43334332
}
43344333

4335-
TEST_F(DisplayListTest, TextFrameOpacityPeephole) {
4336-
// Single character can have opacity peephole applied.
4337-
{
4338-
std::string message = "A";
4339-
sk_sp<SkTextBlob> blob = CreateTextBlob(message);
4340-
auto frame = impeller::MakeTextFrameFromTextBlobSkia(blob);
4341-
DisplayListBuilder builder;
4342-
builder.DrawTextFrame(frame, 0, 0, {});
4343-
auto dl = builder.Build();
4344-
EXPECT_TRUE(dl->can_apply_group_opacity());
4345-
}
4346-
4347-
// Multiple characters cannot have opacity peephole applied.
4348-
{
4349-
std::string message = "ABC";
4350-
sk_sp<SkTextBlob> blob = CreateTextBlob(message);
4351-
4352-
auto frame = impeller::MakeTextFrameFromTextBlobSkia(blob);
4353-
DisplayListBuilder builder;
4354-
builder.DrawTextFrame(frame, 0, 0, {});
4355-
auto dl = builder.Build();
4356-
EXPECT_FALSE(dl->can_apply_group_opacity());
4357-
}
4358-
}
4359-
43604334
} // namespace testing
43614335
} // namespace flutter

display_list/dl_builder.cc

+1-5
Original file line numberDiff line numberDiff line change
@@ -1698,11 +1698,7 @@ void DisplayListBuilder::drawTextFrame(
16981698
// they will protect overlapping glyphs from the effects of overdraw
16991699
// so we must make the conservative assessment that this DL layer is
17001700
// not compatible with group opacity inheritance.
1701-
// A single glyph can still have the opacity peephole applied (this is
1702-
// likely a glyph used as an Icon)
1703-
const bool is_single_glyph = text_frame->GetRunCount() == 1u &&
1704-
text_frame->GetRuns()[0].GetGlyphCount() == 1u;
1705-
UpdateLayerOpacityCompatibility(is_single_glyph);
1701+
UpdateLayerOpacityCompatibility(false);
17061702
UpdateLayerResult(result);
17071703
}
17081704
}

display_list/testing/dl_test_snippets.cc

-7
Original file line numberDiff line numberDiff line change
@@ -980,12 +980,5 @@ sk_sp<SkTextBlob> GetTestTextBlob(int index) {
980980
return blob;
981981
}
982982

983-
sk_sp<SkTextBlob> CreateTextBlob(std::string& message) {
984-
sk_sp<SkTextBlob> blob =
985-
SkTextBlob::MakeFromText(message.c_str(), message.size(),
986-
CreateTestFontOfSize(20), SkTextEncoding::kUTF8);
987-
return blob;
988-
}
989-
990983
} // namespace testing
991984
} // namespace flutter

display_list/testing/dl_test_snippets.h

-2
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,6 @@ SkFont CreateTestFontOfSize(SkScalar scalar);
227227

228228
sk_sp<SkTextBlob> GetTestTextBlob(int index);
229229

230-
sk_sp<SkTextBlob> CreateTextBlob(std::string& message);
231-
232230
struct DisplayListInvocation {
233231
// ----------------------------------
234232
// Required fields for initialization

0 commit comments

Comments
 (0)