Reverts "[display_list] allow applying opacity peephole to single glyph. (#53160)" (flutter/engine#53189)

Reverts: flutter/engine#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.
This commit is contained in:
auto-submit[bot] 2024-06-04 03:52:26 +00:00 committed by GitHub
parent 0874df9398
commit 2608c55ad6
5 changed files with 1 additions and 41 deletions

View File

@ -131,7 +131,6 @@ if (enable_unittests) {
":display_list",
":display_list_fixtures",
"//flutter/display_list/testing:display_list_testing",
"//flutter/impeller/typographer/backends/skia:typographer_skia_backend",
"//flutter/testing",
"//flutter/testing:skia",
]

View File

@ -22,7 +22,6 @@
#include "flutter/testing/display_list_testing.h"
#include "flutter/testing/testing.h"
#include "impeller/typographer/backends/skia/text_frame_skia.h"
#include "third_party/skia/include/core/SkBBHFactory.h"
#include "third_party/skia/include/core/SkColorFilter.h"
#include "third_party/skia/include/core/SkPictureRecorder.h"
@ -4332,30 +4331,5 @@ TEST_F(DisplayListTest, DrawDisplayListForwardsBackdropFlag) {
EXPECT_TRUE(parent_dl->root_has_backdrop_filter());
}
TEST_F(DisplayListTest, TextFrameOpacityPeephole) {
// Single character can have opacity peephole applied.
{
std::string message = "A";
sk_sp<SkTextBlob> blob = CreateTextBlob(message);
auto frame = impeller::MakeTextFrameFromTextBlobSkia(blob);
DisplayListBuilder builder;
builder.DrawTextFrame(frame, 0, 0, {});
auto dl = builder.Build();
EXPECT_TRUE(dl->can_apply_group_opacity());
}
// Multiple characters cannot have opacity peephole applied.
{
std::string message = "ABC";
sk_sp<SkTextBlob> blob = CreateTextBlob(message);
auto frame = impeller::MakeTextFrameFromTextBlobSkia(blob);
DisplayListBuilder builder;
builder.DrawTextFrame(frame, 0, 0, {});
auto dl = builder.Build();
EXPECT_FALSE(dl->can_apply_group_opacity());
}
}
} // namespace testing
} // namespace flutter

View File

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

View File

@ -980,12 +980,5 @@ sk_sp<SkTextBlob> GetTestTextBlob(int index) {
return blob;
}
sk_sp<SkTextBlob> CreateTextBlob(std::string& message) {
sk_sp<SkTextBlob> blob =
SkTextBlob::MakeFromText(message.c_str(), message.size(),
CreateTestFontOfSize(20), SkTextEncoding::kUTF8);
return blob;
}
} // namespace testing
} // namespace flutter

View File

@ -227,8 +227,6 @@ SkFont CreateTestFontOfSize(SkScalar scalar);
sk_sp<SkTextBlob> GetTestTextBlob(int index);
sk_sp<SkTextBlob> CreateTextBlob(std::string& message);
struct DisplayListInvocation {
// ----------------------------------
// Required fields for initialization