Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions lib/web_ui/lib/src/engine/canvaskit/util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ class SkiaShadowFlags {
// material spec.
const double ckShadowAmbientAlpha = 0.039;
const double ckShadowSpotAlpha = 0.25;
const double ckShadowLightRadius = 1.1;
const double ckShadowLightHeight = 600.0;
const double ckShadowLightXOffset = 0;
const double ckShadowLightYOffset = -450;
const double ckShadowLightHeight = 600;
const double ckShadowLightRadius = 800;
const double ckShadowLightXTangent = ckShadowLightXOffset / ckShadowLightHeight;
const double ckShadowLightYTangent = ckShadowLightYOffset / ckShadowLightHeight;

Expand Down Expand Up @@ -161,13 +161,15 @@ void drawSkShadow(
bool transparentOccluder,
double devicePixelRatio,
) {
final int flags = transparentOccluder
int flags = transparentOccluder
? SkiaShadowFlags.kTransparentOccluderShadowFlags
: SkiaShadowFlags.kDefaultShadowFlags;
flags |= SkiaShadowFlags.kDirectionalLight_ShadowFlag;

final ui.Color inAmbient =
color.withAlpha((color.alpha * ckShadowAmbientAlpha).round());
final ui.Color inSpot = color.withAlpha((color.alpha * ckShadowSpotAlpha).round());
final ui.Color inSpot =
color.withAlpha((color.alpha * ckShadowSpotAlpha).round());

final SkTonalColors inTonalColors = SkTonalColors(
ambient: makeFreshSkColor(inAmbient),
Expand All @@ -180,10 +182,10 @@ void drawSkShadow(
path.skiaObject,
Float32List(3)..[2] = devicePixelRatio * elevation,
Float32List(3)
..[0] = ckShadowLightXOffset
..[1] = ckShadowLightYOffset
..[2] = devicePixelRatio * ckShadowLightHeight,
devicePixelRatio * ckShadowLightRadius,
..[0] = 0
..[1] = -1
..[2] = 1,
ckShadowLightRadius / ckShadowLightHeight,
tonalColors.ambient,
tonalColors.spot,
flags.toDouble(),
Expand Down