@@ -58,42 +58,32 @@ void PhysicalShapeLayer::Preroll(PrerollContext* context,
5858 // join the child paint bounds.
5959 // The offset is calculated as follows:
6060
61- // .--- (kLightRadius)
62- // -------/ (light)
63- // | /
64- // | /
65- // |/
66- // |O
67- // /| (kLightHeight)
68- // / |
69- // / |
70- // / |
71- // / |
61+ // .-- (kLightRadius = 800)
62+ // ----- (light)
63+ // | (kLightHeight = 600)
7264 // ------------- (layer)
73- // /| |
74- // / | | (elevation)
75- // A / | |B
65+ // |
66+ // | (elevation)
67+ // |
7668 // ------------------------------------------------ (canvas)
77- // --- (extent of shadow)
69+ // -------- --- (extent of shadow)
7870 //
79- // E = lt } t = (r + w/2)/h
71+ // E = lx } x = (r + w/2)/h
8072 // } =>
81- // r + w/2 = ht } E = (l/h)(r + w/2)
73+ // r + w/2 = hx } E = (l/h)(r + w/2)
8274 //
8375 // Where: E = extent of shadow
8476 // l = elevation of layer
8577 // r = radius of the light source
8678 // w = width of the layer
8779 // h = light height
88- // t = tangent of AOB, i.e., multiplier for elevation to extent
80+ // x = multiplier for elevation to extent
8981 SkRect bounds (path_.getBounds ());
90- // tangent for x
91- double tx = (kLightRadius * device_pixel_ratio_ + bounds.width () * 0.5 ) /
82+ double ex = (kLightRadius * device_pixel_ratio_ + bounds.width () * 0.5 ) /
9283 kLightHeight ;
93- // tangent for y
94- double ty = (kLightRadius * device_pixel_ratio_ + bounds.height () * 0.5 ) /
84+ double ey = (kLightRadius * device_pixel_ratio_ + bounds.height () * 0.5 ) /
9585 kLightHeight ;
96- bounds.outset (elevation_ * tx , elevation_ * ty );
86+ bounds.outset (elevation_ * ex , elevation_ * ey );
9787 set_paint_bounds (bounds);
9888#endif // defined(OS_FUCHSIA)
9989 }
0 commit comments