OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 GrTypesPriv_DEFINED | 8 #ifndef GrTypesPriv_DEFINED |
9 #define GrTypesPriv_DEFINED | 9 #define GrTypesPriv_DEFINED |
10 | 10 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
108 | 108 |
109 GR_STATIC_ASSERT(0 == kFloat_GrVertexAttribType); | 109 GR_STATIC_ASSERT(0 == kFloat_GrVertexAttribType); |
110 GR_STATIC_ASSERT(1 == kVec2f_GrVertexAttribType); | 110 GR_STATIC_ASSERT(1 == kVec2f_GrVertexAttribType); |
111 GR_STATIC_ASSERT(2 == kVec3f_GrVertexAttribType); | 111 GR_STATIC_ASSERT(2 == kVec3f_GrVertexAttribType); |
112 GR_STATIC_ASSERT(3 == kVec4f_GrVertexAttribType); | 112 GR_STATIC_ASSERT(3 == kVec4f_GrVertexAttribType); |
113 GR_STATIC_ASSERT(4 == kVec4ub_GrVertexAttribType); | 113 GR_STATIC_ASSERT(4 == kVec4ub_GrVertexAttribType); |
114 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kSizes) == kGrVertexAttribTypeCount); | 114 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kSizes) == kGrVertexAttribTypeCount); |
115 } | 115 } |
116 | 116 |
117 /** | 117 /** |
118 * Semantic bindings for vertex attributes. kEffect means that the attribute is input to a GrEffect. | 118 * Semantic bindings for vertex attributes. kEffect means that the attribute is input to a |
119 * Each binding other than kEffect may not appear more than once in the current set of attributes. | 119 * GrProcessor. Each binding other than kEffect may not appear more than once in the current set of |
120 * kPosition must be appear for exactly one attribute. | 120 * attributes. kPosition must be appear for exactly one attribute. |
121 */ | 121 */ |
122 enum GrVertexAttribBinding { | 122 enum GrVertexAttribBinding { |
123 kPosition_GrVertexAttribBinding, // required, must have vector count of 2 | 123 kPosition_GrVertexAttribBinding, // required, must have vector count of 2 |
124 kLocalCoord_GrVertexAttribBinding, // must have vector count of 2 | 124 kLocalCoord_GrVertexAttribBinding, // must have vector count of 2 |
125 kColor_GrVertexAttribBinding, // must have vector count of 4 | 125 kColor_GrVertexAttribBinding, // must have vector count of 4 |
126 kCoverage_GrVertexAttribBinding, // must have vector count of 4 | 126 kCoverage_GrVertexAttribBinding, // must have vector count of 4 |
127 | 127 |
128 kLastFixedFunction_GrVertexAttribBinding = kCoverage_GrVertexAttribBinding, | 128 kLastFixedFunction_GrVertexAttribBinding = kCoverage_GrVertexAttribBinding, |
129 | 129 |
130 kEffect_GrVertexAttribBinding, // vector length must agree with | 130 kGeometryProcessor_GrVertexAttribBinding, // vector length must agree w ith |
131 // GrEffect::vertexAttribType() for each effect input to | 131 // GrProcessor::vertexAttribType() for e ach effect input to |
132 // which the attribute is mapped by GrDr awState::setEffect() | 132 // which the attribute is mapped by GrDr awState::setEffect() |
133 kLast_GrVertexAttribBinding = kEffect_GrVertexAttribBinding | 133 kLast_GrVertexAttribBinding = kGeometryProcessor_GrVertexAttribBinding |
134 }; | 134 }; |
135 | 135 |
136 static const int kGrVertexAttribBindingCnt = kLast_GrVertexAttribBinding + 1; | 136 static const int kGrVertexAttribBindingCnt = kLast_GrVertexAttribBinding + 1; |
137 static const int kGrFixedFunctionVertexAttribBindingCnt = | 137 static const int kGrFixedFunctionVertexAttribBindingCnt = |
138 kLastFixedFunction_GrVertexAttribBinding + 1; | 138 kLastFixedFunction_GrVertexAttribBinding + 1; |
139 | 139 |
140 static inline int GrFixedFunctionVertexAttribVectorCount(GrVertexAttribBinding b inding) { | 140 static inline int GrFixedFunctionVertexAttribVectorCount(GrVertexAttribBinding b inding) { |
141 SkASSERT(binding >= 0 && binding < kGrFixedFunctionVertexAttribBindingCnt); | 141 SkASSERT(binding >= 0 && binding < kGrFixedFunctionVertexAttribBindingCnt); |
142 static const int kVecCounts[] = { 2, 2, 4, 4 }; | 142 static const int kVecCounts[] = { 2, 2, 4, 4 }; |
143 | 143 |
(...skipping 22 matching lines...) Expand all Loading... | |
166 GrVertexAttribBinding fBinding; | 166 GrVertexAttribBinding fBinding; |
167 }; | 167 }; |
168 | 168 |
169 template <int N> class GrVertexAttribArray : public SkSTArray<N, GrVertexAttrib, true> {}; | 169 template <int N> class GrVertexAttribArray : public SkSTArray<N, GrVertexAttrib, true> {}; |
170 | 170 |
171 ////////////////////////////////////////////////////////////////////////////// | 171 ////////////////////////////////////////////////////////////////////////////// |
172 | 172 |
173 /** | 173 /** |
174 * We have coverage effects that clip rendering to the edge of some geometric pri mitive. | 174 * We have coverage effects that clip rendering to the edge of some geometric pri mitive. |
175 * This enum specifies how that clipping is performed. Not all factories that tak e a | 175 * This enum specifies how that clipping is performed. Not all factories that tak e a |
176 * GrEffectEdgeType will succeed with all values and it is up to the caller to ch eck for | 176 * GrProcessorEdgeType will succeed with all values and it is up to the caller to check for |
177 * a NULL return. | 177 * a NULL return. |
178 */ | 178 */ |
179 enum GrEffectEdgeType { | 179 enum GrProcessorEdgeType { |
bsalomon
2014/09/22 14:56:38
I think we need a better name.
GrPrimitiveEdgeTyp
| |
180 kFillBW_GrEffectEdgeType, | 180 kFillBW_GrProcessorEdgeType, |
181 kFillAA_GrEffectEdgeType, | 181 kFillAA_GrProcessorEdgeType, |
182 kInverseFillBW_GrEffectEdgeType, | 182 kInverseFillBW_GrProcessorEdgeType, |
183 kInverseFillAA_GrEffectEdgeType, | 183 kInverseFillAA_GrProcessorEdgeType, |
184 kHairlineAA_GrEffectEdgeType, | 184 kHairlineAA_GrProcessorEdgeType, |
185 | 185 |
186 kLast_GrEffectEdgeType = kHairlineAA_GrEffectEdgeType | 186 kLast_GrProcessorEdgeType = kHairlineAA_GrProcessorEdgeType |
187 }; | 187 }; |
188 | 188 |
189 static const int kGrEffectEdgeTypeCnt = kLast_GrEffectEdgeType + 1; | 189 static const int kGrProcessorEdgeTypeCnt = kLast_GrProcessorEdgeType + 1; |
190 | 190 |
191 static inline bool GrEffectEdgeTypeIsFill(const GrEffectEdgeType edgeType) { | 191 static inline bool GrProcessorEdgeTypeIsFill(const GrProcessorEdgeType edgeType) { |
192 return (kFillAA_GrEffectEdgeType == edgeType || kFillBW_GrEffectEdgeType == edgeType); | 192 return (kFillAA_GrProcessorEdgeType == edgeType || kFillBW_GrProcessorEdgeTy pe == edgeType); |
193 } | 193 } |
194 | 194 |
195 static inline bool GrEffectEdgeTypeIsInverseFill(const GrEffectEdgeType edgeType ) { | 195 static inline bool GrProcessorEdgeTypeIsInverseFill(const GrProcessorEdgeType ed geType) { |
196 return (kInverseFillAA_GrEffectEdgeType == edgeType || | 196 return (kInverseFillAA_GrProcessorEdgeType == edgeType || |
197 kInverseFillBW_GrEffectEdgeType == edgeType); | 197 kInverseFillBW_GrProcessorEdgeType == edgeType); |
198 } | 198 } |
199 | 199 |
200 static inline bool GrEffectEdgeTypeIsAA(const GrEffectEdgeType edgeType) { | 200 static inline bool GrProcessorEdgeTypeIsAA(const GrProcessorEdgeType edgeType) { |
201 return (kFillBW_GrEffectEdgeType != edgeType && kInverseFillBW_GrEffectEdgeT ype != edgeType); | 201 return (kFillBW_GrProcessorEdgeType != edgeType && kInverseFillBW_GrProcesso rEdgeType != edgeType); |
202 } | 202 } |
203 | 203 |
204 static inline GrEffectEdgeType GrInvertEffectEdgeType(const GrEffectEdgeType edg eType) { | 204 static inline GrProcessorEdgeType GrInvertProcessorEdgeType(const GrProcessorEdg eType edgeType) { |
205 switch (edgeType) { | 205 switch (edgeType) { |
206 case kFillBW_GrEffectEdgeType: | 206 case kFillBW_GrProcessorEdgeType: |
207 return kInverseFillBW_GrEffectEdgeType; | 207 return kInverseFillBW_GrProcessorEdgeType; |
208 case kFillAA_GrEffectEdgeType: | 208 case kFillAA_GrProcessorEdgeType: |
209 return kInverseFillAA_GrEffectEdgeType; | 209 return kInverseFillAA_GrProcessorEdgeType; |
210 case kInverseFillBW_GrEffectEdgeType: | 210 case kInverseFillBW_GrProcessorEdgeType: |
211 return kFillBW_GrEffectEdgeType; | 211 return kFillBW_GrProcessorEdgeType; |
212 case kInverseFillAA_GrEffectEdgeType: | 212 case kInverseFillAA_GrProcessorEdgeType: |
213 return kFillAA_GrEffectEdgeType; | 213 return kFillAA_GrProcessorEdgeType; |
214 case kHairlineAA_GrEffectEdgeType: | 214 case kHairlineAA_GrProcessorEdgeType: |
215 SkFAIL("Hairline fill isn't invertible."); | 215 SkFAIL("Hairline fill isn't invertible."); |
216 } | 216 } |
217 return kFillAA_GrEffectEdgeType; // suppress warning. | 217 return kFillAA_GrProcessorEdgeType; // suppress warning. |
218 } | 218 } |
219 | 219 |
220 #endif | 220 #endif |
OLD | NEW |