Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 GrDefaultGeoProcFactory_DEFINED | 8 #ifndef GrDefaultGeoProcFactory_DEFINED |
| 9 #define GrDefaultGeoProcFactory_DEFINED | 9 #define GrDefaultGeoProcFactory_DEFINED |
| 10 | 10 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 enum GPType { | 68 enum GPType { |
| 69 kPosition_GPType = 0x0, // we ALWAYS have position | 69 kPosition_GPType = 0x0, // we ALWAYS have position |
| 70 kColor_GPType = 0x01, | 70 kColor_GPType = 0x01, |
| 71 kLocalCoord_GPType = 0x02, | 71 kLocalCoord_GPType = 0x02, |
| 72 kCoverage_GPType= 0x04, | 72 kCoverage_GPType= 0x04, |
| 73 kLastGPType = kCoverage_GPType | 73 kLastGPType = kCoverage_GPType |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 struct Color { | |
| 77 enum Type { | |
| 78 kNone_Type, | |
| 79 kUniform_Type, | |
| 80 kAttribute_Type, | |
| 81 }; | |
| 82 Color(GrColor color) : fType(kUniform_Type), fColor(color) {} | |
| 83 Color(Type type) : fType(type), fColor(GrColor_ILLEGAL) { | |
| 84 SkASSERT(type != kUniform_Type); | |
| 85 | |
| 86 // TODO This is temporary | |
| 87 if (kAttribute_Type == type) { | |
|
bsalomon
2015/07/27 16:19:24
??
joshualitt
2015/07/27 17:21:51
This really is just temporary. I have to do this
| |
| 88 fColor = GrColor_WHITE; | |
| 89 } | |
| 90 } | |
| 91 | |
| 92 Type fType; | |
| 93 GrColor fColor; | |
| 94 }; | |
| 95 | |
| 96 struct Coverage { | |
| 97 enum Type { | |
| 98 kNone_Type, | |
| 99 kSolid_Type, | |
| 100 kUniform_Type, | |
| 101 kAttribute_Type, | |
| 102 }; | |
| 103 Coverage(uint8_t coverage) : fType(kUniform_Type), fCoverage(coverage) { } | |
| 104 Coverage(Type type) : fType(type), fCoverage(0xff) { | |
| 105 SkASSERT(type != kUniform_Type); | |
| 106 } | |
| 107 | |
| 108 Type fType; | |
| 109 uint8_t fCoverage; | |
| 110 }; | |
| 111 | |
| 112 struct LocalCoords { | |
|
bsalomon
2015/07/27 16:19:24
Why a struct?
joshualitt
2015/07/27 17:21:51
For one, just to have consistency with Color and C
| |
| 113 enum Type { | |
| 114 kNone_Type, | |
| 115 kUsePosition_Type, | |
| 116 kHasExplicit_Type, | |
|
bsalomon
2015/07/27 16:19:24
Is this where we'd add another option, something l
joshualitt
2015/07/27 17:21:51
Yea, exactly. I think we could either do a count
| |
| 117 }; | |
| 118 }; | |
| 119 | |
| 120 static const GrGeometryProcessor* Create(const Color&, | |
| 121 const Coverage&, | |
| 122 LocalCoords::Type, | |
| 123 const SkMatrix& viewMatrix = SkMatr ix::I(), | |
| 124 const SkMatrix& localMatrix = SkMat rix::I()); | |
| 125 | |
| 76 /* | 126 /* |
| 77 * The following functions are used to create default GPs. If you just need to create | 127 * The following functions are used to create default GPs. If you just need to create |
| 78 * attributes separately from creating the default GP, use the SetAttribs fu nction followed | 128 * attributes separately from creating the default GP, use the SetAttribs fu nction followed |
| 79 * by the Create function. Otherwise use CreateAndSetAttribs to do both at o nce. | 129 * by the Create function. Otherwise use CreateAndSetAttribs to do both at o nce. |
| 80 * | 130 * |
| 81 * You must unref the return from Create. | 131 * You must unref the return from Create. |
| 82 */ | 132 */ |
| 83 // TODO clean this up | 133 // TODO clean this up |
| 84 static const GrGeometryProcessor* Create(uint32_t gpTypeFlags, | 134 static const GrGeometryProcessor* Create(uint32_t gpTypeFlags, |
| 85 GrColor, | 135 GrColor, |
| 86 bool localCoordsWillBeRead, | 136 bool localCoordsWillBeRead, |
| 87 bool coverageWillBeIgnored, | 137 bool coverageWillBeIgnored, |
| 88 const SkMatrix& viewMatrix = SkMatr ix::I(), | 138 const SkMatrix& viewMatrix = SkMatr ix::I(), |
| 89 const SkMatrix& localMatrix = SkMat rix::I(), | 139 const SkMatrix& localMatrix = SkMat rix::I(), |
| 90 uint8_t coverage = 0xff); | 140 uint8_t coverage = 0xff); |
| 91 | 141 |
| 92 static size_t DefaultVertexStride() { return sizeof(PositionAttr); } | 142 static size_t DefaultVertexStride() { return sizeof(PositionAttr); } |
| 93 }; | 143 }; |
| 94 | 144 |
| 95 #endif | 145 #endif |
| OLD | NEW |