| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 Coverage(Type type) : fType(type), fCoverage(0xff) { | 104 Coverage(Type type) : fType(type), fCoverage(0xff) { |
| 105 SkASSERT(type != kUniform_Type); | 105 SkASSERT(type != kUniform_Type); |
| 106 } | 106 } |
| 107 | 107 |
| 108 Type fType; | 108 Type fType; |
| 109 uint8_t fCoverage; | 109 uint8_t fCoverage; |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 struct LocalCoords { | 112 struct LocalCoords { |
| 113 enum Type { | 113 enum Type { |
| 114 kNone_Type, | 114 kUnused_Type, |
| 115 kUsePosition_Type, | 115 kUsePosition_Type, |
| 116 kHasExplicit_Type, | 116 kHasExplicit_Type, |
| 117 }; | 117 }; |
| 118 LocalCoords(Type type) : fType(type), fMatrix(NULL) {} |
| 119 LocalCoords(Type type, const SkMatrix* matrix) : fType(type), fMatrix(ma
trix) { |
| 120 SkASSERT(kUnused_Type != type); |
| 121 } |
| 122 bool hasLocalMatrix() const { return NULL != fMatrix; } |
| 123 |
| 124 Type fType; |
| 125 const SkMatrix* fMatrix; |
| 118 }; | 126 }; |
| 119 | 127 |
| 120 static const GrGeometryProcessor* Create(const Color&, | 128 static const GrGeometryProcessor* Create(const Color&, |
| 121 const Coverage&, | 129 const Coverage&, |
| 122 LocalCoords::Type, | 130 const LocalCoords&, |
| 123 const SkMatrix& viewMatrix = SkMatr
ix::I(), | 131 const SkMatrix& viewMatrix = SkMatr
ix::I()); |
| 124 const SkMatrix& localMatrix = SkMat
rix::I()); | |
| 125 | 132 |
| 126 /* | 133 /* |
| 127 * The following functions are used to create default GPs. If you just need
to create | 134 * Use this factory to create a GrGeometryProcessor that expects a device sp
ace vertex position |
| 128 * attributes separately from creating the default GP, use the SetAttribs fu
nction followed | 135 * attribute. The view matrix must still be provided to compute correctly tr
ansformed |
| 129 * by the Create function. Otherwise use CreateAndSetAttribs to do both at o
nce. | 136 * coordinates for GrFragmentProcessors. It may fail if the view matrix is n
ot invertible. |
| 130 * | |
| 131 * You must unref the return from Create. | |
| 132 */ | 137 */ |
| 133 // TODO clean this up | 138 static const GrGeometryProcessor* CreateForDeviceSpace(const Color&, |
| 139 const Coverage&, |
| 140 const LocalCoords&, |
| 141 const SkMatrix& viewM
atrix); |
| 142 |
| 143 // TODO deprecate this |
| 134 static const GrGeometryProcessor* Create(uint32_t gpTypeFlags, | 144 static const GrGeometryProcessor* Create(uint32_t gpTypeFlags, |
| 135 GrColor, | 145 GrColor, |
| 136 bool localCoordsWillBeRead, | 146 bool localCoordsWillBeRead, |
| 137 bool coverageWillBeIgnored, | 147 bool coverageWillBeIgnored, |
| 138 const SkMatrix& viewMatrix = SkMatr
ix::I(), | 148 const SkMatrix& viewMatrix = SkMatr
ix::I(), |
| 139 const SkMatrix& localMatrix = SkMat
rix::I(), | 149 const SkMatrix& localMatrix = SkMat
rix::I(), |
| 140 uint8_t coverage = 0xff); | 150 uint8_t coverage = 0xff); |
| 141 | 151 |
| 142 static size_t DefaultVertexStride() { return sizeof(PositionAttr); } | 152 static size_t DefaultVertexStride() { return sizeof(PositionAttr); } |
| 143 }; | 153 }; |
| 144 | 154 |
| 145 #endif | 155 #endif |
| OLD | NEW |