This repository has been archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] construct text frames on UI thread. #45418
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
83a7f9c
[Impeller] construct text frames on UI thread.
jonahwilliams cf17b4d
revert optional changes to color font checking.
jonahwilliams e8ee793
make stroked/gradient text work and add unit tests.
jonahwilliams a0cf7ee
++
jonahwilliams d1bc27e
++
jonahwilliams 09ea39a
Merge branch 'main' of github.com:flutter/engine into text_frame_skia_2
jonahwilliams 8e91ad1
fix perf overlay text.
jonahwilliams a2f9ad8
fix fuchsia compilation
jonahwilliams 42da42a
update build file
jonahwilliams 95c7f23
++
jonahwilliams 9454209
++
jonahwilliams bea2189
++
jonahwilliams bb4452f
add comment and use IMPELLER_SUPPORTS_RENDERING.
jonahwilliams 91e4d3e
++
jonahwilliams File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1302,6 +1302,48 @@ void DisplayListBuilder::DrawTextBlob(const sk_sp<SkTextBlob>& blob, | |
SetAttributesFromPaint(paint, DisplayListOpFlags::kDrawTextBlobFlags); | ||
drawTextBlob(blob, x, y); | ||
} | ||
|
||
void DisplayListBuilder::drawTextFrame( | ||
const std::shared_ptr<impeller::TextFrame>& text_frame, | ||
SkScalar x, | ||
SkScalar y) { | ||
DisplayListAttributeFlags flags = kDrawTextBlobFlags; | ||
OpResult result = PaintResult(current_, flags); | ||
if (result == OpResult::kNoEffect) { | ||
return; | ||
} | ||
impeller::Rect bounds = text_frame->GetBounds(); | ||
SkRect sk_bounds = SkRect::MakeLTRB(bounds.GetLeft(), bounds.GetTop(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm surprised we don't have a conversion for this? If we don't, feel free to resolve. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We do, its just all over the place. |
||
bounds.GetRight(), bounds.GetBottom()); | ||
bool unclipped = AccumulateOpBounds(sk_bounds.makeOffset(x, y), flags); | ||
// TODO(https://github.com/flutter/flutter/issues/82202): Remove once the | ||
// unit tests can use Fuchsia's font manager instead of the empty default. | ||
// Until then we might encounter empty bounds for otherwise valid text and | ||
// thus we ignore the results from AccumulateOpBounds. | ||
#if defined(OS_FUCHSIA) | ||
unclipped = true; | ||
#endif // OS_FUCHSIA | ||
if (unclipped) { | ||
Push<DrawTextFrameOp>(0, 1, text_frame, x, y); | ||
// 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); | ||
UpdateLayerResult(result); | ||
} | ||
} | ||
|
||
void DisplayListBuilder::DrawTextFrame( | ||
const std::shared_ptr<impeller::TextFrame>& text_frame, | ||
SkScalar x, | ||
SkScalar y, | ||
const DlPaint& paint) { | ||
SetAttributesFromPaint(paint, DisplayListOpFlags::kDrawTextBlobFlags); | ||
drawTextFrame(text_frame, x, y); | ||
} | ||
|
||
void DisplayListBuilder::DrawShadow(const SkPath& path, | ||
const DlColor color, | ||
const SkScalar elevation, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean that
drawTextBlob
will go unused in the Impeller backend?If so, would you want to (ifdef'd?) make sure it's not used, i.e.
UNIMPLEMENTED
, similar to the dispatcher?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if we use DisplayListBuilder on Skia ever. FYI @flar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we do. That was its original purpose and is iteratively becoming its only purpose.