1 /*
2  * Copyright 2016 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 #ifndef SkShadowParams_DEFINED
8 #define SkShadowParams_DEFINED
9 
10 /** \struct SkShadowParams
11 
12     This struct holds information needed for drawing shadows.
13 
14     fShadowRadius - radius of the shadow blur
15 
16     fBiasingConstant - A constant used in variance shadow mapping to directly
17     0.0 - 1.0          reduce light bleeding. Essentially sets all shadows
18     ~.25               below a certain brightness equal to no light, and does
19                        a linear step on the rest. Essentially makes shadows
20                        darker and more rounded at higher values.
21 
22     fMinVariance - Too low of a variance (near the outer edges of blurry
23     ~512, 1024     shadows) will lead to ugly sharp shadow brightness
24                    distortions. This enforces a minimum amount of variance
25                    in the calculation to smooth out the outside edges of
26                    blurry shadows. However, too high of a value for this will
27                    cause all shadows to be lighter by visibly different
28                    amounts varying on depth.
29 
30     fType - Decides which algorithm to use to draw shadows.
31 */
32 struct SkShadowParams {
33     SkScalar fShadowRadius;
34     SkScalar fBiasingConstant;
35     SkScalar fMinVariance;
36 
37     enum ShadowType {
38         kNoBlur_ShadowType,
39         kVariance_ShadowType,
40 
41         kLast_ShadowType = kVariance_ShadowType
42     };
43     static const int kShadowTypeCount = kLast_ShadowType + 1;
44 
45     ShadowType fType;
46 };
47 
48 #endif
49