From 40718a59c343ca33c3540d839c2188566717f4b1 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Thu, 27 Apr 2017 10:13:28 -0700 Subject: [PATCH] Improved parameters for Skia shadows (#3635) --- flow/layers/physical_model_layer.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/flow/layers/physical_model_layer.cc b/flow/layers/physical_model_layer.cc index 61acba6b5..b77482ee7 100644 --- a/flow/layers/physical_model_layer.cc +++ b/flow/layers/physical_model_layer.cc @@ -25,7 +25,7 @@ void PhysicalModelLayer::Preroll(PrerollContext* context, const SkMatrix& matrix // The margin is hardcoded to an arbitrary maximum for now because Skia // doesn't provide a way to calculate it. SkRect bounds(rrect_.getBounds()); - bounds.outset(50.0, 50.0); + bounds.outset(20.0, 20.0); set_paint_bounds(bounds); context->child_paint_bounds = bounds; @@ -77,11 +77,14 @@ void PhysicalModelLayer::DrawShadow(SkCanvas* canvas, const SkPath& path, SkShadowFlags flags = transparentOccluder ? SkShadowFlags::kTransparentOccluder_ShadowFlag : SkShadowFlags::kNone_ShadowFlag; + const SkRect& bounds = path.getBounds(); + SkScalar shadow_x = (bounds.left() + bounds.right()) / 2; + SkScalar shadow_y = bounds.top() - 600.0f; SkShadowUtils::DrawShadow(canvas, path, - elevation * 2, - SkPoint3::Make(0.0f, 0.0f, 600.0f), + elevation, + SkPoint3::Make(shadow_x, shadow_y, 600.0f), 800.0f, - 0.2f, 0.2f, + 0.039f, 0.25f, color, flags); } -- GitLab