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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 uint8_t fCoverage; | 100 uint8_t fCoverage; |
101 }; | 101 }; |
102 | 102 |
103 struct LocalCoords { | 103 struct LocalCoords { |
104 enum Type { | 104 enum Type { |
105 kUnused_Type, | 105 kUnused_Type, |
106 kUsePosition_Type, | 106 kUsePosition_Type, |
107 kHasExplicit_Type, | 107 kHasExplicit_Type, |
108 kHasTransformed_Type, | 108 kHasTransformed_Type, |
109 }; | 109 }; |
110 LocalCoords(Type type) : fType(type), fMatrix(NULL) {} | 110 LocalCoords(Type type) : fType(type), fMatrix(nullptr) {} |
111 LocalCoords(Type type, const SkMatrix* matrix) : fType(type), fMatrix(ma
trix) { | 111 LocalCoords(Type type, const SkMatrix* matrix) : fType(type), fMatrix(ma
trix) { |
112 SkASSERT(kUnused_Type != type); | 112 SkASSERT(kUnused_Type != type); |
113 } | 113 } |
114 bool hasLocalMatrix() const { return NULL != fMatrix; } | 114 bool hasLocalMatrix() const { return nullptr != fMatrix; } |
115 | 115 |
116 Type fType; | 116 Type fType; |
117 const SkMatrix* fMatrix; | 117 const SkMatrix* fMatrix; |
118 }; | 118 }; |
119 | 119 |
120 const GrGeometryProcessor* Create(const Color&, | 120 const GrGeometryProcessor* Create(const Color&, |
121 const Coverage&, | 121 const Coverage&, |
122 const LocalCoords&, | 122 const LocalCoords&, |
123 const SkMatrix& viewMatrix); | 123 const SkMatrix& viewMatrix); |
124 | 124 |
125 /* | 125 /* |
126 * Use this factory to create a GrGeometryProcessor that expects a device sp
ace vertex position | 126 * Use this factory to create a GrGeometryProcessor that expects a device sp
ace vertex position |
127 * attribute. The view matrix must still be provided to compute correctly tr
ansformed | 127 * attribute. The view matrix must still be provided to compute correctly tr
ansformed |
128 * coordinates for GrFragmentProcessors. It may fail if the view matrix is n
ot invertible. | 128 * coordinates for GrFragmentProcessors. It may fail if the view matrix is n
ot invertible. |
129 */ | 129 */ |
130 const GrGeometryProcessor* CreateForDeviceSpace(const Color&, | 130 const GrGeometryProcessor* CreateForDeviceSpace(const Color&, |
131 const Coverage&, | 131 const Coverage&, |
132 const LocalCoords&, | 132 const LocalCoords&, |
133 const SkMatrix& viewMatrix); | 133 const SkMatrix& viewMatrix); |
134 | 134 |
135 inline size_t DefaultVertexStride() { return sizeof(PositionAttr); } | 135 inline size_t DefaultVertexStride() { return sizeof(PositionAttr); } |
136 }; | 136 }; |
137 | 137 |
138 #endif | 138 #endif |
OLD | NEW |