Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: src/gpu/batches/GrDefaultPathRenderer.h

Issue 1834133003: added GrMSAAPathRenderer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: improved batching, cut out some useless code Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrDefaultPathRenderer_DEFINED 8 #ifndef GrDefaultPathRenderer_DEFINED
9 #define GrDefaultPathRenderer_DEFINED 9 #define GrDefaultPathRenderer_DEFINED
10 10
11 #include "GrPathRenderer.h" 11 #include "GrPathRenderer.h"
12 #include "SkTypes.h" 12 #include "SkTypes.h"
13 13
14 ////////////////////////////////////////////////////////////////////////////////
15 // Stencil rules for paths
bsalomon 2016/04/04 13:09:21 Maybe put these in a separate shared header? GrPat
16
17 ////// Even/Odd
18
19 GR_STATIC_CONST_SAME_STENCIL(gEOStencilPass,
20 kInvert_StencilOp,
21 kKeep_StencilOp,
22 kAlwaysIfInClip_StencilFunc,
23 0xffff,
24 0xffff,
25 0xffff);
26
27 // ok not to check clip b/c stencil pass only wrote inside clip
28 GR_STATIC_CONST_SAME_STENCIL(gEOColorPass,
29 kZero_StencilOp,
30 kZero_StencilOp,
31 kNotEqual_StencilFunc,
32 0xffff,
33 0x0000,
34 0xffff);
35
36 // have to check clip b/c outside clip will always be zero.
37 GR_STATIC_CONST_SAME_STENCIL(gInvEOColorPass,
38 kZero_StencilOp,
39 kZero_StencilOp,
40 kEqualIfInClip_StencilFunc,
41 0xffff,
42 0x0000,
43 0xffff);
44
45 ////// Winding
46
47 // when we have separate stencil we increment front faces / decrement back faces
48 // when we don't have wrap incr and decr we use the stencil test to simulate
49 // them.
50
51 GR_STATIC_CONST_STENCIL(gWindStencilSeparateWithWrap,
52 kIncWrap_StencilOp, kDecWrap_StencilOp,
53 kKeep_StencilOp, kKeep_StencilOp,
54 kAlwaysIfInClip_StencilFunc, kAlwaysIfInClip_StencilFunc,
55 0xffff, 0xffff,
56 0xffff, 0xffff,
57 0xffff, 0xffff);
58
59 // if inc'ing the max value, invert to make 0
60 // if dec'ing zero invert to make all ones.
61 // we can't avoid touching the stencil on both passing and
62 // failing, so we can't resctrict ourselves to the clip.
63 GR_STATIC_CONST_STENCIL(gWindStencilSeparateNoWrap,
64 kInvert_StencilOp, kInvert_StencilOp,
65 kIncClamp_StencilOp, kDecClamp_StencilOp,
66 kEqual_StencilFunc, kEqual_StencilFunc,
67 0xffff, 0xffff,
68 0xffff, 0x0000,
69 0xffff, 0xffff);
70
71 // When there are no separate faces we do two passes to setup the winding rule
72 // stencil. First we draw the front faces and inc, then we draw the back faces
73 // and dec. These are same as the above two split into the incrementing and
74 // decrementing passes.
75 GR_STATIC_CONST_SAME_STENCIL(gWindSingleStencilWithWrapInc,
76 kIncWrap_StencilOp,
77 kKeep_StencilOp,
78 kAlwaysIfInClip_StencilFunc,
79 0xffff,
80 0xffff,
81 0xffff);
82
83 GR_STATIC_CONST_SAME_STENCIL(gWindSingleStencilWithWrapDec,
84 kDecWrap_StencilOp,
85 kKeep_StencilOp,
86 kAlwaysIfInClip_StencilFunc,
87 0xffff,
88 0xffff,
89 0xffff);
90
91 GR_STATIC_CONST_SAME_STENCIL(gWindSingleStencilNoWrapInc,
92 kInvert_StencilOp,
93 kIncClamp_StencilOp,
94 kEqual_StencilFunc,
95 0xffff,
96 0xffff,
97 0xffff);
98
99 GR_STATIC_CONST_SAME_STENCIL(gWindSingleStencilNoWrapDec,
100 kInvert_StencilOp,
101 kDecClamp_StencilOp,
102 kEqual_StencilFunc,
103 0xffff,
104 0x0000,
105 0xffff);
106
107 // Color passes are the same whether we use the two-sided stencil or two passes
108
109 GR_STATIC_CONST_SAME_STENCIL(gWindColorPass,
110 kZero_StencilOp,
111 kZero_StencilOp,
112 kNonZeroIfInClip_StencilFunc,
113 0xffff,
114 0x0000,
115 0xffff);
116
117 GR_STATIC_CONST_SAME_STENCIL(gInvWindColorPass,
118 kZero_StencilOp,
119 kZero_StencilOp,
120 kEqualIfInClip_StencilFunc,
121 0xffff,
122 0x0000,
123 0xffff);
124
125 ////// Normal render to stencil
126
127 // Sometimes the default path renderer can draw a path directly to the stencil
128 // buffer without having to first resolve the interior / exterior.
129 GR_STATIC_CONST_SAME_STENCIL(gDirectToStencil,
130 kZero_StencilOp,
131 kIncClamp_StencilOp,
132 kAlwaysIfInClip_StencilFunc,
133 0xffff,
134 0x0000,
135 0xffff);
136
14 /** 137 /**
15 * Subclass that renders the path using the stencil buffer to resolve fill rule s 138 * Subclass that renders the path using the stencil buffer to resolve fill rule s
16 * (e.g. winding, even-odd) 139 * (e.g. winding, even-odd)
17 */ 140 */
18 class SK_API GrDefaultPathRenderer : public GrPathRenderer { 141 class SK_API GrDefaultPathRenderer : public GrPathRenderer {
19 public: 142 public:
20 GrDefaultPathRenderer(bool separateStencilSupport, bool stencilWrapOpsSuppor t); 143 GrDefaultPathRenderer(bool separateStencilSupport, bool stencilWrapOpsSuppor t);
21 144
22 private: 145 private:
23 146
(...skipping 13 matching lines...) Expand all
37 const GrStrokeInfo&, 160 const GrStrokeInfo&,
38 bool stencilOnly); 161 bool stencilOnly);
39 162
40 bool fSeparateStencil; 163 bool fSeparateStencil;
41 bool fStencilWrapOps; 164 bool fStencilWrapOps;
42 165
43 typedef GrPathRenderer INHERITED; 166 typedef GrPathRenderer INHERITED;
44 }; 167 };
45 168
46 #endif 169 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698