Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@gaaclarke
Copy link
Member

@gaaclarke gaaclarke commented Jun 13, 2024

Resolves flutter/flutter#142014
Resolves flutter/flutter#150114

A previous patch made the blur operate in source space. This doesn't work for text since it jumbles up the characters. We probably want the text crisp when scaled anyways so it would make sense not to render those is source space. Instead I moved the blur to "scaled source space" or "unrotated local space", if you will.

This is more closely what we had previously but it handles rotation correctly.

Also, brandon fixed a problem where we weren't minding a flag on how the ctm should be used when rendering mask blurs. That was important to this fix too.

new golden results before patch

Screenshot 2024-06-13 at 3 32 29 PM Screenshot 2024-06-13 at 3 32 36 PM

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.


namespace {
Vector2 ExtractScale(const Matrix& matrix) {
Vector2 entity_scale_x = matrix * Vector2(1.0, 0.0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Matrix::Decompose here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at that and it was way more calculations for things we just throw away. It's doing things like calculating the determinant. It returns an optional result probably for this reason. This one is guaranteed to have a result too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These matrix mults are just recomputing the basis vectors, which could just be pulled out of the matrix instead: return Vector2(matrix.GetBasisX().Length(), matrix.GetBasisY().Length())

Matrix::GetScale does the same thing, but includes the Z basis and returns a Vector3. Adding a Matrix::GetScaleXY seems like a good idea since we're doing this in a few places now.

@gaaclarke
Copy link
Member Author

Notes from the goldens:

  1. Disrespecting and respecting the ctm look the same to me in the golden tests. That isn't what we see with playgrounds locally. The difference being high dpi versus not. It still looks more correct than above and looks fine in the linked issue.
  2. Blur style solid is wrong again and needs to be fixed.

Revert "license"

This reverts commit 1099da1.
@gaaclarke
Copy link
Member Author

Here's what the tests look like in playgrounds:
Screenshot 2024-06-14 at 9 17 17 AM
Screenshot 2024-06-14 at 9 17 24 AM

@gaaclarke gaaclarke marked this pull request as ready for review June 14, 2024 16:45
Copy link
Contributor

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@flutter-dashboard
Copy link

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.

Changes reported for pull request #53377 at sha a3a03f2

@gaaclarke
Copy link
Member Author

Disprespecting the CTM makes things draw differently depending on the dpi of the device. I'll file a separate issue for that:
Screenshot 2024-06-14 at 10 40 10 AM

I had a discussion with brandon about this a couple days ago, but here is a clear case where we need to know the dpi to render the right thing.

@gaaclarke
Copy link
Member Author

All the goldens look good. I just approved them. I'll tag brandon on this PR in case he wants to take a look before I merge. Everything is looking good from my end though. This may change benchmarks again, but the will be in line with what we had before the "source space" pr.

Copy link
Member

@bdero bdero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Belated LGTM. :)

@gaaclarke confirmed that the behavior of this patch matches Skia's in flutter/flutter#150272.

Neither Impeller nor Skia are aware of the device pixel ratio, and the remaining problem with text shadows changing with different DPRs is due to DisplayListParagraphPainter::drawTextShadow using respect_ctm=false without accounting for DPR.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 15, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jun 15, 2024
…150290)

flutter/engine@8167dff...9779c27

2024-06-15 [email protected] Manual roll of Dart SDK from e90b0a53e058 to dca20ab646c5 (flutter/engine#53410)
2024-06-15 [email protected] Update "Vulnerability scanning" to add the actions: read permission. (flutter/engine#53409)
2024-06-14 [email protected] Roll Skia from 136c7cc18d1e to 6f6b45e1faea (3 revisions) (flutter/engine#53408)
2024-06-14 [email protected] [Impeller] moved blur to unrotated local space, started respecting `respect_ctm` flag (flutter/engine#53377)
2024-06-14 [email protected] Roll Skia from 5560041fcfc0 to 136c7cc18d1e (4 revisions) (flutter/engine#53406)
2024-06-14 [email protected] Roll web_ui dependencies to enable the next roll of the Dart SDK (flutter/engine#53399)
2024-06-14 [email protected] Hack to prevent Safari from being backgrounded during unit tests. (flutter/engine#53402)
2024-06-14 [email protected] Manual roll Dart SDK from cabe65966815 to e90b0a53e058 (1 revision) (flutter/engine#53404)
2024-06-14 [email protected] Roll Skia from de1a50046289 to 5560041fcfc0 (1 revision) (flutter/engine#53393)
2024-06-14 [email protected] Manual roll Dart SDK from 115a9a2b26cd to cabe65966815 (1 revision) (flutter/engine#53390)
2024-06-14 [email protected] Roll Skia from 3bebb0602780 to de1a50046289 (3 revisions) (flutter/engine#53388)
2024-06-14 [email protected] Roll Skia from d248a9f99ff5 to 3bebb0602780 (1 revision) (flutter/engine#53387)
2024-06-14 [email protected] Roll Fuchsia Linux SDK from pGxbL7JoNb3yAYFw4... to BkYg1UB1jdbAZv3gA... (flutter/engine#53386)
2024-06-14 [email protected] [Impeller] restore accidentally deleted Cap/Join benchmarks (flutter/engine#53385)
2024-06-13 [email protected] Add a `FlutterEngineRule` (JUnit `TestRule`) and use it in `FlutterRendererTest` (flutter/engine#53361)
2024-06-13 [email protected] Roll Skia from b21429b0ea78 to d248a9f99ff5 (2 revisions) (flutter/engine#53383)
2024-06-13 [email protected] Roll Skia from 40bdee9eedd6 to b21429b0ea78 (3 revisions) (flutter/engine#53382)
2024-06-13 [email protected] [DisplayList] cull clip operations that can be trivially and safely ignored (flutter/engine#53367)
2024-06-13 [email protected] Roll Skia from 0f47a9333edb to 40bdee9eedd6 (2 revisions) (flutter/engine#53381)
2024-06-13 [email protected] Roll Dart SDK from aa2265e5a192 to 115a9a2b26cd (5 revisions) (flutter/engine#53380)
2024-06-13 [email protected] Roll Skia from bf5a0e0dbf41 to 0f47a9333edb (2 revisions) (flutter/engine#53378)

Also rolling transitive DEPS:
  fuchsia/sdk/core/linux-amd64 from pGxbL7JoNb3y to BkYg1UB1jdbA

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 [email protected],[email protected],[email protected] 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://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Text shadows now appear broken on iOS [Impeller] MaskBlur does not honor setting the "respect_ctm" flag to false

3 participants