drawTextBlob should not be compatible with opacity inheritance (flutter/engine#40396)

drawTextBlob should not be compatible with opacity inheritance
This commit is contained in:
Jim Graham
2023-03-17 14:13:04 -07:00
committed by GitHub
parent ea522c65f7
commit 14ad19c87b
2 changed files with 7 additions and 2 deletions

View File

@@ -1124,7 +1124,12 @@ void DisplayListBuilder::drawTextBlob(const sk_sp<SkTextBlob> blob,
SkScalar y) {
Push<DrawTextBlobOp>(0, 1, blob, x, y);
AccumulateOpBounds(blob->bounds().makeOffset(x, y), kDrawTextBlobFlags);
CheckLayerOpacityCompatibility();
// There is no way to query if the glyphs of a text blob overlap and
// there are no current guarantees from either Skia or Impeller that
// 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.
UpdateLayerOpacityCompatibility(false);
}
void DisplayListBuilder::DrawTextBlob(const sk_sp<SkTextBlob>& blob,
SkScalar x,

View File

@@ -645,7 +645,7 @@ TEST(DisplayList, SingleOpsMightSupportGroupOpacityWithOrWithoutBlendMode) {
static auto display_list = builder.Build();
RUN_TESTS2(builder.drawDisplayList(display_list);, false);
}
RUN_TESTS(builder.drawTextBlob(TestBlob1, 0, 0););
RUN_TESTS2(builder.drawTextBlob(TestBlob1, 0, 0);, false);
RUN_TESTS2(builder.drawShadow(kTestPath1, SK_ColorBLACK, 1.0, false, 1.0);
, false);