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 #include "GrDefaultGeoProcFactory.h" | 8 #include "GrDefaultGeoProcFactory.h" |
9 | 9 |
10 #include "GrInvariantOutput.h" | 10 #include "GrInvariantOutput.h" |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 color, | 271 color, |
272 viewMatrix, | 272 viewMatrix, |
273 localMatrix, | 273 localMatrix, |
274 localCoordsWillBeRead, | 274 localCoordsWillBeRead, |
275 coverageWillBeIgnored, | 275 coverageWillBeIgnored, |
276 coverage); | 276 coverage); |
277 } | 277 } |
278 | 278 |
279 const GrGeometryProcessor* GrDefaultGeoProcFactory::Create(const Color& color, | 279 const GrGeometryProcessor* GrDefaultGeoProcFactory::Create(const Color& color, |
280 const Coverage& cover
age, | 280 const Coverage& cover
age, |
281 LocalCoords::Type loc
alCoords, | 281 const LocalCoords& lo
calCoords, |
282 const SkMatrix& viewM
atrix, | 282 const SkMatrix& viewM
atrix) { |
283 const SkMatrix& local
Matrix) { | |
284 uint32_t flags = 0; | 283 uint32_t flags = 0; |
285 flags |= color.fType == Color::kAttribute_Type ? kColor_GPType : 0; | 284 flags |= color.fType == Color::kAttribute_Type ? kColor_GPType : 0; |
286 flags |= coverage.fType == Coverage::kAttribute_Type ? kCoverage_GPType : 0; | 285 flags |= coverage.fType == Coverage::kAttribute_Type ? kCoverage_GPType : 0; |
287 flags |= localCoords == LocalCoords::kHasExplicit_Type ? kLocalCoord_GPType
: 0; | 286 flags |= localCoords.fType == LocalCoords::kHasExplicit_Type ? kLocalCoord_G
PType : 0; |
288 | 287 |
289 uint8_t inCoverage = coverage.fCoverage; | 288 uint8_t inCoverage = coverage.fCoverage; |
290 bool coverageWillBeIgnored = coverage.fType == Coverage::kNone_Type; | 289 bool coverageWillBeIgnored = coverage.fType == Coverage::kNone_Type; |
291 bool localCoordsWillBeRead = localCoords != LocalCoords::kNone_Type; | 290 bool localCoordsWillBeRead = localCoords.fType != LocalCoords::kUnused_Type; |
292 | 291 |
293 GrColor inColor = color.fColor; | 292 GrColor inColor = color.fColor; |
294 return DefaultGeoProc::Create(flags, | 293 return DefaultGeoProc::Create(flags, |
295 inColor, | 294 inColor, |
296 viewMatrix, | 295 viewMatrix, |
297 localMatrix, | 296 localCoords.fMatrix ? *localCoords.fMatrix : S
kMatrix::I(), |
298 localCoordsWillBeRead, | 297 localCoordsWillBeRead, |
299 coverageWillBeIgnored, | 298 coverageWillBeIgnored, |
300 inCoverage); | 299 inCoverage); |
301 } | 300 } |
| 301 |
| 302 const GrGeometryProcessor* GrDefaultGeoProcFactory::CreateForDeviceSpace( |
| 303 const Color
& color, |
| 304 const Cover
age& coverage, |
| 305 const Local
Coords& localCoords, |
| 306 const SkMat
rix& viewMatrix) { |
| 307 SkASSERT(LocalCoords::kUsePosition_Type == localCoords.fType); |
| 308 SkMatrix invert = SkMatrix::I(); |
| 309 if (!viewMatrix.isIdentity() && !viewMatrix.invert(&invert)) { |
| 310 SkDebugf("Could not invert\n"); |
| 311 return NULL; |
| 312 } |
| 313 |
| 314 if (localCoords.hasLocalMatrix()) { |
| 315 invert.preConcat(*localCoords.fMatrix); |
| 316 } |
| 317 |
| 318 LocalCoords inverted(LocalCoords::kUsePosition_Type, &invert); |
| 319 return Create(color, coverage, inverted); |
| 320 } |
OLD | NEW |