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

Outset box shadow impl #45239

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

joevilches
Copy link
Contributor

Summary:
tisa. Algo is

  • Draw offscreen rect the size of the outset shadow (so accounting for spread)
  • Set g state to cast shadow in proper place ON screen
  • Clear out region in view

The rects need to be offscreen for the following reasons

  • We need to account for spread radius, and CGContext shadows do not have support for this. So the only way to create a bigger shadow is the create a path that is the same size as the shadow we want
  • We cannot just position this rect onscreen with no offset (so the shadow is casting directly under it) since the blur will look unnatural
  • Offscreen means we do not see filled shadow rect but we do see the shadow it casts by offsetting it in the proper location

Reviewed By: lenaic

Differential Revision: D58881588

Joe Vilches and others added 2 commits June 28, 2024 15:00
Differential Revision: D57617028
Summary:
tisa. Algo is

* Draw offscreen rect the size of the outset shadow (so accounting for spread)
* Set g state to cast shadow in proper place ON screen
* Clear out region in view

The rects need to be offscreen for the following reasons
* We need to account for spread radius, and CGContext shadows do not have support for this. So the only way to create a bigger shadow is the create a path that is the same size as the shadow we want
* We cannot just position this rect onscreen with no offset (so the shadow is casting directly under it) since the blur will look unnatural
* Offscreen means we do not see filled shadow rect but we do see the shadow it casts by offsetting it in the proper location

Reviewed By: lenaic

Differential Revision: D58881588
@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner labels Jul 1, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D58881588

@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 20,300,550 +98,475
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 23,497,363 +98,482
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: f473a2f
Branch: main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported p: Facebook Partner: Facebook Partner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants