Skip to content
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

[macOS] Clean up PlatformView mutator scaling #42110

Merged
merged 1 commit into from May 18, 2023

Conversation

cbracken
Copy link
Member

@cbracken cbracken commented May 17, 2023

When applying platform view mutators, the mutations array includes a transform from logical to physical coordinates. Since Cocoa deals only in logical points, we inject a physical to logical coordinate transform to counteract this.

Rather than applying this multiple times throughout the [FlutterMutatorView applyFlutterLayer] method we gather a list of transforms that includes the additional physical to logical scale transform.

This change is a cleanup change for readability and makes no semantic changes to how mutator views are applied. Existing unit tests in FlutterMutatorViewTest.mm are expected to pass without changes.

This is refactoring prior to applying a fix for rotation handling.

Issue: flutter/flutter#124490

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.

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 (don't just cc him here, he won't see it! He's on Discord!).

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.

@cbracken cbracken changed the title [macOS] Cleanup PlatformView mutator scaling logic [macOS] Clean up PlatformView mutator scaling May 17, 2023
@Hixie
Copy link
Contributor

Hixie commented May 17, 2023

test-exempt: code refactor with no semantic change

@cbracken cbracken requested a review from cyanglaz May 17, 2023 23:20
Copy link
Contributor

@gspencergoog gspencergoog left a comment

Choose a reason for hiding this comment

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

Still needs tests, of course.

Copy link
Contributor

@gspencergoog gspencergoog left a comment

Choose a reason for hiding this comment

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

32384589-a60f0e74-c078-11e7-9bc1-e5b5287aea9d

When applying platform view mutators, the mutations array includes a
transform from logical to physical coordinates. Since Cocoa deals only
in logical points, we inject a physical to logical coordinate transform
to counteract this.

Rather than applying this multiple times throughout the
`[FlutterMutatorView applyFlutterLayer]` method we gather a list of
transforms that includes the additional physical to logical scale
transform.

This change is a cleanup change for readability and makes no semantic
changes to how mutator views are applied. Existing unit tests in
FlutterMutatorViewTest.mm are expected to pass without changes.
@cbracken cbracken added the autosubmit Merge PR when tree becomes green via auto submit App label May 17, 2023
@cbracken cbracken merged commit d366f3b into flutter:main May 18, 2023
26 checks passed
@cbracken cbracken deleted the mutator-cleanup branch May 18, 2023 00:11
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 18, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request May 18, 2023
…127116)

flutter/engine@a22dd64...843ce0b

2023-05-18 skia-flutter-autoroll@skia.org Roll Skia from a3a9fb5f4a31 to ad8fa4a38668 (1 revision) (flutter/engine#42121)
2023-05-18 skia-flutter-autoroll@skia.org Roll Dart SDK from 7f6fabbe9fba to 1991015ad460 (4 revisions) (flutter/engine#42120)
2023-05-18 skia-flutter-autoroll@skia.org Roll Fuchsia Mac SDK from wNfsef5we4l8hxEII... to jNFpQ1gTCMNbzSZCw... (flutter/engine#42118)
2023-05-18 skia-flutter-autoroll@skia.org Roll Skia from caff30d16ae7 to a3a9fb5f4a31 (1 revision) (flutter/engine#42117)
2023-05-18 skia-flutter-autoroll@skia.org Roll Skia from ffa425bacfc4 to caff30d16ae7 (29 revisions) (flutter/engine#42116)
2023-05-18 chris@bracken.jp [macOS] Clean up PlatformView mutator scaling (flutter/engine#42110)

Also rolling transitive DEPS:
  fuchsia/sdk/core/mac-amd64 from wNfsef5we4l8 to jNFpQ1gTCMNb

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
CaseyHillers pushed a commit to CaseyHillers/flutter that referenced this pull request May 24, 2023
…lutter#127116)

flutter/engine@a22dd64...843ce0b

2023-05-18 skia-flutter-autoroll@skia.org Roll Skia from a3a9fb5f4a31 to ad8fa4a38668 (1 revision) (flutter/engine#42121)
2023-05-18 skia-flutter-autoroll@skia.org Roll Dart SDK from 7f6fabbe9fba to 1991015ad460 (4 revisions) (flutter/engine#42120)
2023-05-18 skia-flutter-autoroll@skia.org Roll Fuchsia Mac SDK from wNfsef5we4l8hxEII... to jNFpQ1gTCMNbzSZCw... (flutter/engine#42118)
2023-05-18 skia-flutter-autoroll@skia.org Roll Skia from caff30d16ae7 to a3a9fb5f4a31 (1 revision) (flutter/engine#42117)
2023-05-18 skia-flutter-autoroll@skia.org Roll Skia from ffa425bacfc4 to caff30d16ae7 (29 revisions) (flutter/engine#42116)
2023-05-18 chris@bracken.jp [macOS] Clean up PlatformView mutator scaling (flutter/engine#42110)

Also rolling transitive DEPS:
  fuchsia/sdk/core/mac-amd64 from wNfsef5we4l8 to jNFpQ1gTCMNb

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App needs tests platform-macos
Projects
None yet
3 participants