OLD | NEW |
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 GrDrawState_DEFINED | 8 #ifndef GrDrawState_DEFINED |
9 #define GrDrawState_DEFINED | 9 #define GrDrawState_DEFINED |
10 | 10 |
11 #include "GrBackendEffectFactory.h" | 11 #include "GrBackendEffectFactory.h" |
12 #include "GrColor.h" | 12 #include "GrColor.h" |
13 #include "GrEffectStage.h" | 13 #include "GrEffectStage.h" |
14 #include "GrRefCnt.h" | 14 #include "GrRefCnt.h" |
15 #include "GrRenderTarget.h" | 15 #include "GrRenderTarget.h" |
16 #include "GrStencil.h" | 16 #include "GrStencil.h" |
17 #include "GrTemplates.h" | 17 #include "GrTemplates.h" |
18 #include "GrTexture.h" | 18 #include "GrTexture.h" |
| 19 #include "GrTypesPriv.h" |
19 #include "effects/GrSimpleTextureEffect.h" | 20 #include "effects/GrSimpleTextureEffect.h" |
20 | 21 |
21 #include "SkMatrix.h" | 22 #include "SkMatrix.h" |
22 #include "SkXfermode.h" | 23 #include "SkXfermode.h" |
23 | 24 |
24 class GrPaint; | 25 class GrPaint; |
25 | 26 |
26 /** | 27 /** |
27 * Types used to describe format of vertices in arrays | |
28 */ | |
29 enum GrVertexAttribType { | |
30 kFloat_GrVertexAttribType = 0, | |
31 kVec2f_GrVertexAttribType, | |
32 kVec3f_GrVertexAttribType, | |
33 kVec4f_GrVertexAttribType, | |
34 kVec4ub_GrVertexAttribType, // vector of 4 unsigned bytes, e.g. colors | |
35 | |
36 kLast_GrVertexAttribType = kVec4ub_GrVertexAttribType | |
37 }; | |
38 static const int kGrVertexAttribTypeCount = kLast_GrVertexAttribType + 1; | |
39 | |
40 struct GrVertexAttrib { | |
41 inline void set(GrVertexAttribType type, size_t offset) { | |
42 fType = type; fOffset = offset; | |
43 } | |
44 bool operator==(const GrVertexAttrib& other) const { | |
45 return fType == other.fType && fOffset == other.fOffset; | |
46 }; | |
47 bool operator!=(const GrVertexAttrib& other) const { return !(*this == other
); } | |
48 | |
49 GrVertexAttribType fType; | |
50 size_t fOffset; | |
51 }; | |
52 | |
53 template <int N> | |
54 class GrVertexAttribArray : public SkSTArray<N, GrVertexAttrib, true> {}; | |
55 | |
56 /** | |
57 * Type used to describe how attributes bind to program usage | 28 * Type used to describe how attributes bind to program usage |
58 */ | 29 */ |
59 typedef int GrAttribBindings; | 30 typedef int GrAttribBindings; |
60 | 31 |
61 class GrDrawState : public GrRefCnt { | 32 class GrDrawState : public GrRefCnt { |
62 public: | 33 public: |
63 SK_DECLARE_INST_COUNT(GrDrawState) | 34 SK_DECLARE_INST_COUNT(GrDrawState) |
64 | 35 |
65 /** | 36 /** |
66 * Total number of effect stages. Each stage can host a GrEffect. A stage is
enabled if it has a | 37 * Total number of effect stages. Each stage can host a GrEffect. A stage is
enabled if it has a |
(...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1254 int fAttribIndices[kAttribIndexCount]; | 1225 int fAttribIndices[kAttribIndexCount]; |
1255 GrVertexAttribArray<kVertexAttribCnt> fVertexAttribs; | 1226 GrVertexAttribArray<kVertexAttribCnt> fVertexAttribs; |
1256 GrEffectStage fStages[kNumStages]; | 1227 GrEffectStage fStages[kNumStages]; |
1257 | 1228 |
1258 typedef GrRefCnt INHERITED; | 1229 typedef GrRefCnt INHERITED; |
1259 }; | 1230 }; |
1260 | 1231 |
1261 GR_MAKE_BITFIELD_OPS(GrDrawState::BlendOptFlags); | 1232 GR_MAKE_BITFIELD_OPS(GrDrawState::BlendOptFlags); |
1262 | 1233 |
1263 #endif | 1234 #endif |
OLD | NEW |