react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Outset box shadow impl

Open joevilches opened this issue 1 year ago • 2 comments

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

joevilches avatar Jul 01 '24 20:07 joevilches

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

facebook-github-bot avatar Jul 01 '24 20:07 facebook-github-bot

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: f473a2f8f48ed8ce94a1f8a3181a5dabb4c6ad8d Branch: main

analysis-bot avatar Jul 01 '24 21:07 analysis-bot