-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Impeller] Improve resolution of text scaling. #43533
Conversation
This patch does a few things: - Changes ownership of the LazyGlyphAtlas to ContentContext from Canvas. This means that drawings with multiple canvases (e.g. calls to DrawPicture) share the same lazy atlas. - Moves the scale property from Font::Metrics to FontGlyphPair. Font::Metrics contains properties related to the font, whereas scale has to do with the properties of the drawing at render time and is independent of the font. - Makes the lazy atlas manage FontGlyphPair::Set rather than vectors of TextFrames. - Makes the determination of font scaling at EntityPass::Render rather than Canvas::DrawTextFrame. The scaling may be altered by calls to Canvas::DrawPicture by render time and otherwise get missed. This is done via a new method: Contents::PopulateGlyphAtlas, which is only implemented by TextContents in this patch. This improves over prior attempts: LazyGlyphAtlas ownership is now unambiguous, and glyph scaling happens correctly for all rendered glyphs regardless of the order of canvas operations in Aiks. Fixes flutter/flutter#130142
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.
This approach LGTM, assuming there are no serious performance changes on apps with large numbers of entities.
auto label is removed for flutter/engine, pr: 43533, due to - The status or check suite Mac mac_host_engine has failed. Please fix the issues identified (or deflake) before re-applying this label. |
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.
LGTM
} | ||
|
||
auto type = frame_.GetAtlasType(); | ||
auto scale = entity.GetTransformation().GetMaxBasisLengthXY(); |
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.
Nit: Might make sense to have a static Scalar TextContents::DeriveTextScaleFromEntity(const Entity& entity) const
or maybe even Scalar Entity::DeriveTextScale() const
and use that in both spots. Our way of computing the scale has changed a few times.
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.
Done
@@ -376,23 +351,23 @@ std::shared_ptr<GlyphAtlas> TextRenderContextSkia::CreateGlyphAtlas( | |||
// added. | |||
|
|||
// --------------------------------------------------------------------------- | |||
// Step 4: Record the positions in the glyph atlas of the newly added | |||
// Step 3a: Record the positions in the glyph atlas of the newly added |
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.
Nit: Why the a
s and b
s?
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.
Because there are two branches that go down here that both were reusing the same step numbers.
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.
Ah yeah, makes sense.
auto label is removed for flutter/engine, pr: 43533, due to - The status or check suite Mac mac_host_engine has failed. Please fix the issues identified (or deflake) before re-applying this label.
|
auto label is removed for flutter/engine, pr: 43533, due to - The status or check suite Linux linux_arm_host_engine has failed. Please fix the issues identified (or deflake) before re-applying this label. |
auto label is removed for flutter/engine, pr: 43533, due to - The status or check suite Mac mac_host_engine has failed. Please fix the issues identified (or deflake) before re-applying this label. |
Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change). If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review. |
…130313) flutter/engine@153d9e1...767f2fb 2023-07-11 dnfield@google.com [Impeller] Improve resolution of text scaling. (flutter/engine#43533) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC aaclarke@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…130538) flutter/engine@0f0436b...8a42bfc 2023-07-13 skia-flutter-autoroll@skia.org Roll Skia from 52613fcc0780 to 9e4f5cc3aeb4 (1 revision) (flutter/engine#43659) 2023-07-13 jonahwilliams@google.com [Impeller] no-op fragment program on Android until it works. (flutter/engine#43657) 2023-07-13 31859944+LongCatIsLooong@users.noreply.github.com Reland #43118 "Add a flag to ParagraphBuilder for rounding hack migration" (flutter/engine#43647) 2023-07-13 ychris@google.com Unmerge threads if the current merger is the only one that's merged. (flutter/engine#43652) 2023-07-13 dnfield@google.com Revert flutter/engine#43533 (flutter/engine#43654) 2023-07-13 skia-flutter-autoroll@skia.org Roll Skia from 743ad92f5de2 to 52613fcc0780 (9 revisions) (flutter/engine#43655) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC rmistry@google.com,zra@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
This reverts commit 255ef6c.
This patch does a few things: - Changes ownership of the LazyGlyphAtlas to ContentContext from Canvas. This means that drawings with multiple canvases (e.g. calls to DrawPicture) share the same lazy atlas. - Moves the scale property from Font::Metrics to FontGlyphPair. Font::Metrics contains properties related to the font, whereas scale has to do with the properties of the drawing at render time and is independent of the font. - Makes the lazy atlas manage FontGlyphPair::Set rather than vectors of TextFrames. - Makes the determination of font scaling at EntityPass::Render rather than Canvas::DrawTextFrame. The scaling may be altered by calls to Canvas::DrawPicture by render time and otherwise get missed. This is done via a new method: Contents::PopulateGlyphAtlas, which is only implemented by TextContents in this patch. - Fixes up some miscelleaneous bugs in Font::Metrics hashing and unused/dead code. This improves over prior attempts: LazyGlyphAtlas ownership is now unambiguous, and glyph scaling happens correctly for all rendered glyphs regardless of the order of canvas operations in Aiks. Fixes flutter/flutter#130142
Reverts flutter#43533 Cause of flutter/flutter#130476 I was trying to add a test for this but it's taking me a while to get a working test so here's the revert.
This reverts commit 255ef6c.
Reverts flutter#43533 Cause of flutter/flutter#130476 I was trying to add a test for this but it's taking me a while to get a working test so here's the revert.
…lutter#130538) flutter/engine@0f0436b...8a42bfc 2023-07-13 skia-flutter-autoroll@skia.org Roll Skia from 52613fcc0780 to 9e4f5cc3aeb4 (1 revision) (flutter/engine#43659) 2023-07-13 jonahwilliams@google.com [Impeller] no-op fragment program on Android until it works. (flutter/engine#43657) 2023-07-13 31859944+LongCatIsLooong@users.noreply.github.com Reland flutter#43118 "Add a flag to ParagraphBuilder for rounding hack migration" (flutter/engine#43647) 2023-07-13 ychris@google.com Unmerge threads if the current merger is the only one that's merged. (flutter/engine#43652) 2023-07-13 dnfield@google.com Revert flutter/engine#43533 (flutter/engine#43654) 2023-07-13 skia-flutter-autoroll@skia.org Roll Skia from 743ad92f5de2 to 52613fcc0780 (9 revisions) (flutter/engine#43655) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC rmistry@google.com,zra@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…lutter#130313) flutter/engine@153d9e1...767f2fb 2023-07-11 dnfield@google.com [Impeller] Improve resolution of text scaling. (flutter/engine#43533) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC aaclarke@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
This patch does a few things:
This improves over prior attempts: LazyGlyphAtlas ownership is now unambiguous, and glyph scaling happens correctly for all rendered glyphs regardless of the order of canvas operations in Aiks.
Fixes flutter/flutter#130142