OLD | NEW |
| (Empty) |
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 | |
8 #ifndef GrPathStencilSettings_DEFINED | |
9 #define GrPathStencilSettings_DEFINED | |
10 | |
11 ////// Even/Odd | |
12 | |
13 GR_STATIC_CONST_SAME_STENCIL(gEOStencilPass, | |
14 kInvert_StencilOp, | |
15 kKeep_StencilOp, | |
16 kAlwaysIfInClip_StencilFunc, | |
17 0xffff, | |
18 0xffff, | |
19 0xffff); | |
20 | |
21 // ok not to check clip b/c stencil pass only wrote inside clip | |
22 GR_STATIC_CONST_SAME_STENCIL(gEOColorPass, | |
23 kZero_StencilOp, | |
24 kZero_StencilOp, | |
25 kNotEqual_StencilFunc, | |
26 0xffff, | |
27 0x0000, | |
28 0xffff); | |
29 | |
30 // have to check clip b/c outside clip will always be zero. | |
31 GR_STATIC_CONST_SAME_STENCIL(gInvEOColorPass, | |
32 kZero_StencilOp, | |
33 kZero_StencilOp, | |
34 kEqualIfInClip_StencilFunc, | |
35 0xffff, | |
36 0x0000, | |
37 0xffff); | |
38 | |
39 ////// Winding | |
40 | |
41 // when we have separate stencil we increment front faces / decrement back faces | |
42 // when we don't have wrap incr and decr we use the stencil test to simulate | |
43 // them. | |
44 | |
45 GR_STATIC_CONST_STENCIL(gWindStencilSeparateWithWrap, | |
46 kIncWrap_StencilOp, kDecWrap_StencilOp, | |
47 kKeep_StencilOp, kKeep_StencilOp, | |
48 kAlwaysIfInClip_StencilFunc, kAlwaysIfInClip_StencilFunc, | |
49 0xffff, 0xffff, | |
50 0xffff, 0xffff, | |
51 0xffff, 0xffff); | |
52 | |
53 // if inc'ing the max value, invert to make 0 | |
54 // if dec'ing zero invert to make all ones. | |
55 // we can't avoid touching the stencil on both passing and | |
56 // failing, so we can't resctrict ourselves to the clip. | |
57 GR_STATIC_CONST_STENCIL(gWindStencilSeparateNoWrap, | |
58 kInvert_StencilOp, kInvert_StencilOp, | |
59 kIncClamp_StencilOp, kDecClamp_StencilOp, | |
60 kEqual_StencilFunc, kEqual_StencilFunc, | |
61 0xffff, 0xffff, | |
62 0xffff, 0x0000, | |
63 0xffff, 0xffff); | |
64 | |
65 // When there are no separate faces we do two passes to setup the winding rule | |
66 // stencil. First we draw the front faces and inc, then we draw the back faces | |
67 // and dec. These are same as the above two split into the incrementing and | |
68 // decrementing passes. | |
69 GR_STATIC_CONST_SAME_STENCIL(gWindSingleStencilWithWrapInc, | |
70 kIncWrap_StencilOp, | |
71 kKeep_StencilOp, | |
72 kAlwaysIfInClip_StencilFunc, | |
73 0xffff, | |
74 0xffff, | |
75 0xffff); | |
76 | |
77 GR_STATIC_CONST_SAME_STENCIL(gWindSingleStencilWithWrapDec, | |
78 kDecWrap_StencilOp, | |
79 kKeep_StencilOp, | |
80 kAlwaysIfInClip_StencilFunc, | |
81 0xffff, | |
82 0xffff, | |
83 0xffff); | |
84 | |
85 GR_STATIC_CONST_SAME_STENCIL(gWindSingleStencilNoWrapInc, | |
86 kInvert_StencilOp, | |
87 kIncClamp_StencilOp, | |
88 kEqual_StencilFunc, | |
89 0xffff, | |
90 0xffff, | |
91 0xffff); | |
92 | |
93 GR_STATIC_CONST_SAME_STENCIL(gWindSingleStencilNoWrapDec, | |
94 kInvert_StencilOp, | |
95 kDecClamp_StencilOp, | |
96 kEqual_StencilFunc, | |
97 0xffff, | |
98 0x0000, | |
99 0xffff); | |
100 | |
101 // Color passes are the same whether we use the two-sided stencil or two passes | |
102 | |
103 GR_STATIC_CONST_SAME_STENCIL(gWindColorPass, | |
104 kZero_StencilOp, | |
105 kZero_StencilOp, | |
106 kNonZeroIfInClip_StencilFunc, | |
107 0xffff, | |
108 0x0000, | |
109 0xffff); | |
110 | |
111 GR_STATIC_CONST_SAME_STENCIL(gInvWindColorPass, | |
112 kZero_StencilOp, | |
113 kZero_StencilOp, | |
114 kEqualIfInClip_StencilFunc, | |
115 0xffff, | |
116 0x0000, | |
117 0xffff); | |
118 | |
119 ////// Normal render to stencil | |
120 | |
121 // Sometimes the default path renderer can draw a path directly to the stencil | |
122 // buffer without having to first resolve the interior / exterior. | |
123 GR_STATIC_CONST_SAME_STENCIL(gDirectToStencil, | |
124 kZero_StencilOp, | |
125 kIncClamp_StencilOp, | |
126 kAlwaysIfInClip_StencilFunc, | |
127 0xffff, | |
128 0x0000, | |
129 0xffff); | |
130 | |
131 #endif | |
OLD | NEW |