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

Conversation

@heke123
Copy link
Contributor

@heke123 heke123 commented Apr 25, 2021

This is a bug-fix. (flutter/flutter#81145)
issue: #81145

The Skia 'SkMaskFilter::MakeBlur()' interface expects a 'blur_sigma'
value but currently we pass it a 'radius'.

The skt::TextShadow class also direcly passes its |fBlurRadius|
directly to SkMaskFilter::MakeBlur() without converting it to a
'blur_sigma', which makes the |fBlurRadius| member actually means
"blur_sigma" instead of "blur_radius".

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 Hixie said 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.
  • The reviewer has submitted any presubmit flakes in this PR using the engine presubmit flakes form before re-triggering the failure.

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

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@google-cla google-cla bot added the cla: yes label Apr 25, 2021
@chinmaygarde chinmaygarde requested a review from flar April 26, 2021 18:10
@flar
Copy link
Contributor

flar commented Apr 26, 2021

This PR is modifying some of the code in the imported third party libraries so I think @jason-simmons should be looking at this and considering the import status of the code in whether these changes will make tracking the third party code harder in the long run.

Also, at least one of the data members still uses the old "radius" naming even though it is holding a "sigma" value. Should it be changed to Sigma as well?

@flar flar requested a review from jason-simmons April 26, 2021 18:40
@jason-simmons
Copy link
Member

LGTM

The code in flutter/third_party originated from external sources, but it is effectively now a fork and is not actively kept in sync with the upstream.

However, the SkParagraph TextShadow.fBlurRadius field is defined in code that lives in Skia's repository. It looks like SkParagraph copied Libtxt's use of the "blur radius" name and is also passing that value to SkMaskFilter::MakeBlur which is expecting a sigma value.
(https://github.com/google/skia/blob/master/modules/skparagraph/src/TextLine.cpp#L368)

SkParagraph should be updated similarly to this PR. But that will need to happen separately in the Skia sources.

@flar
Copy link
Contributor

flar commented Apr 26, 2021

Would it make sense to file a Skia bug about that and then a "follow-on" Flutter bug to fix the naming in this code when that gets addressed?

@jason-simmons
Copy link
Member

Sent a PR to update SkParagraph: https://skia-review.googlesource.com/c/skia/+/401496

@jason-simmons
Copy link
Member

The change to update SkParagraph and the engine to use TextShadow.fBlurSigma instead of fBlurRadius has landed.

This PR will need to be rebased on top of the latest engine.

@heke123 heke123 force-pushed the radius2sigma branch 3 times, most recently from 5dfda33 to 9444b0a Compare April 28, 2021 11:39
if (!offset.isZero())
return true;
if (blur_radius != 0.0)
if (blur_sigma != 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.

We have an issue here. A 0 radius does not convert into a 0 sigma, so the test for 0 no longer works.

One thing I notice is that the dart conversion function used above says that it is based on the Skia version and provides a link to the Skia conversion code. If you take a look at the Skia equations, they make sure that a radius of 0 produces a sigma of 0 and that a sigma of less than 0.5 produces a radius of 0.

The net effect should be that we might want to update our Dart conversion function to match the 0 => 0 behavior of the Skia function and to change this test to blur_sigma <= 0.5?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

make sence, thanks! the test should be "blur_sigma > 0.5" which means it is a valid value. right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, > 0.5 means it will do something. I got that backwards.

@heke123
Copy link
Contributor Author

heke123 commented Apr 29, 2021

@flar I didn't figure out why the "Linux Android AOT Engine" failed. Seems I don't have the privilege to re-trigger it, could you please give a help? Thanks.

Copy link
Contributor

@flar flar left a comment

Choose a reason for hiding this comment

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

LGTM

@flar
Copy link
Contributor

flar commented Apr 29, 2021

The test failure can be resolve by rebasing the fix to the top of tree.

This is a bug-fix.

The Skia 'SkMaskFilter::MakeBlur()' interface expects a 'blur_sigma'
value but currently we pass it a 'radius'.
@flar flar added the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label Apr 30, 2021
@flar
Copy link
Contributor

flar commented Apr 30, 2021

This will merge when the tree goes green. Thanks!

@fluttergithubbot fluttergithubbot merged commit 43994ab into flutter:master Apr 30, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 1, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 1, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 1, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 1, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 1, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 1, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 1, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 1, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 2, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 2, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 3, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 3, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 3, 2021
zanderso pushed a commit to flutter/flutter that referenced this pull request May 3, 2021
* aac3658 Roll Skia from 14efdd3d50db to 3010f3d79193 (4 revisions) (flutter/engine#25857)

* f45f52f Move path part files to libraries (flutter/engine#25842)

* d96669f Roll Skia from 3010f3d79193 to 5276ba274b38 (1 revision) (flutter/engine#25859)

* 43994ab Use "blur_sigma" instead of "blur_radius" in Shadow. (flutter/engine#25760)

* 74ac010 Roll Dart SDK from 1e3e5efcd47e to 6397e8b91103 (18 revisions) (flutter/engine#25861)

* d462cfd Remove flake inducing timeouts (flutter/engine#25847)

* 258f63a Roll Skia from 5276ba274b38 to 31fddc376993 (14 revisions) (flutter/engine#25862)

* 1bf01a1 fuchsia: Reliably forward View insets (flutter/engine#25381)

* 2740062 Roll Skia from 31fddc376993 to 097263bb5089 (1 revision) (flutter/engine#25865)

* 4aae6b3 Roll Dart SDK from 6397e8b91103 to ee8eb0a65efa (1 revision) (flutter/engine#25869)

* d1f31c7 Roll Skia from 097263bb5089 to 5dfb3f40684b (1 revision) (flutter/engine#25870)

* 428ef10 deflake (flutter/engine#25864)

* 01b9db8 Roll Dart SDK from ee8eb0a65efa to 8c109a734bdc (1 revision) (flutter/engine#25872)

* e623c09 Roll Dart SDK from 8c109a734bdc to b98a1eec5eb5 (1 revision) (flutter/engine#25873)

* 7ce6226 Roll Dart SDK from b98a1eec5eb5 to 6ecae204598d (1 revision) (flutter/engine#25874)

* 554c24c Roll Skia from 5dfb3f40684b to 5c95bcb48b9b (1 revision) (flutter/engine#25876)

* 03bd2e3 Roll Dart SDK from 6ecae204598d to 3cc6cdab8eaf (2 revisions) (flutter/engine#25877)

* 53fdd89 Roll Skia from 5c95bcb48b9b to c779d432f336 (1 revision) (flutter/engine#25880)

* 98ee65b Roll Skia from c779d432f336 to ff8b52df55ff (2 revisions) (flutter/engine#25881)

* d84caa7 Roll Dart SDK from 3cc6cdab8eaf to b8f4018535fa (2 revisions) (flutter/engine#25885)

* 156760e Roll Skia from ff8b52df55ff to ec79349bad50 (1 revision) (flutter/engine#25886)

* 23cd8e5 Revert the Dart SDK to 1e3e5efcd47edeb7ae5a69e146c8ea0559305a98 (flutter/engine#25887)

* 578449f Fix crash when both FlutterFragmentActivity and FlutterFragment are destroyed and recreated (flutter/engine#25851)
gspencergoog pushed a commit to gspencergoog/engine that referenced this pull request May 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants