OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 #include "GrRectBatch.h" | 8 #include "GrRectBatch.h" |
9 | 9 |
10 #include "GrBatch.h" | 10 #include "GrBatch.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 coords and just duplicate the positions when the caller hasn't provided
a local coord rect, | 168 coords and just duplicate the positions when the caller hasn't provided
a local coord rect, |
169 but we haven't seen a use case which frequently switches between local r
ect and no local | 169 but we haven't seen a use case which frequently switches between local r
ect and no local |
170 rect draws. | 170 rect draws. |
171 | 171 |
172 The color param is used to determine whether the opaque hint can be set
on the draw state. | 172 The color param is used to determine whether the opaque hint can be set
on the draw state. |
173 The caller must populate the vertex colors itself. | 173 The caller must populate the vertex colors itself. |
174 | 174 |
175 The vertex attrib order is always pos, color, [local coords]. | 175 The vertex attrib order is always pos, color, [local coords]. |
176 */ | 176 */ |
177 const GrGeometryProcessor* createRectGP() { | 177 const GrGeometryProcessor* createRectGP() { |
178 typedef GrDefaultGeoProcFactory::Color Color; | 178 using namespace GrDefaultGeoProcFactory; |
179 typedef GrDefaultGeoProcFactory::Coverage Coverage; | |
180 typedef GrDefaultGeoProcFactory::LocalCoords LocalCoords; | |
181 Color color(Color::kAttribute_Type); | 179 Color color(Color::kAttribute_Type); |
182 Coverage coverage(this->coverageIgnored() ? Coverage::kNone_Type : Cover
age::kSolid_Type); | 180 Coverage coverage(this->coverageIgnored() ? Coverage::kNone_Type : Cover
age::kSolid_Type); |
183 | 181 |
184 // if we have a local rect, then we apply the localMatrix directly to th
e localRect to | 182 // if we have a local rect, then we apply the localMatrix directly to th
e localRect to |
185 // generate vertex local coords | 183 // generate vertex local coords |
186 if (this->hasLocalRect()) { | 184 if (this->hasLocalRect()) { |
187 LocalCoords localCoords(LocalCoords::kHasExplicit_Type); | 185 LocalCoords localCoords(LocalCoords::kHasExplicit_Type); |
188 return GrDefaultGeoProcFactory::Create(color, coverage, localCoords)
; | 186 return GrDefaultGeoProcFactory::Create(color, coverage, localCoords)
; |
189 } else { | 187 } else { |
190 LocalCoords localCoords(LocalCoords::kUsePosition_Type, | 188 LocalCoords localCoords(LocalCoords::kUsePosition_Type, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 if (hasLocalMatrix) { | 259 if (hasLocalMatrix) { |
262 localMatrix = GrTest::TestMatrix(random); | 260 localMatrix = GrTest::TestMatrix(random); |
263 } | 261 } |
264 | 262 |
265 return GrRectBatch::Create(color, viewMatrix, rect, | 263 return GrRectBatch::Create(color, viewMatrix, rect, |
266 hasLocalRect ? &localRect : NULL, | 264 hasLocalRect ? &localRect : NULL, |
267 hasLocalMatrix ? &localMatrix : NULL); | 265 hasLocalMatrix ? &localMatrix : NULL); |
268 } | 266 } |
269 | 267 |
270 #endif | 268 #endif |
OLD | NEW |