| 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 |
| 11 #include "GrGeometryProcessor.h" | 11 #include "GrGeometryProcessor.h" |
| 12 | 12 |
| 13 class GrDrawState; | 13 class GrDrawState; |
| 14 | 14 |
| 15 /* | 15 /* |
| 16 * A factory for creating default Geometry Processors which simply multiply posi
tion by the uniform | 16 * A factory for creating default Geometry Processors which simply multiply posi
tion by the uniform |
| 17 * view matrix and wire through color, coverage, UV coords if requested. Right
now this is only | 17 * view matrix and wire through color, coverage, UV coords if requested. Right
now this is only |
| 18 * used in the creation of optimized draw states because adding default GPs to t
he drawstate can | 18 * used in the creation of optimized draw states because adding default GPs to t
he drawstate can |
| 19 * interfere with batching due to updating the drawstate. | 19 * interfere with batching due to updating the drawstate. |
| 20 * TODO When we track geometry state separately from the draw state, we should b
e able use a default | |
| 21 * GP with every draw call | |
| 22 */ | 20 */ |
| 23 class GrDefaultGeoProcFactory { | 21 class GrDefaultGeoProcFactory { |
| 24 public: | 22 public: |
| 25 // Structs for adding vertex attributes | 23 // Structs for adding vertex attributes |
| 26 struct PositionAttr { | 24 struct PositionAttr { |
| 27 SkPoint fPosition; | 25 SkPoint fPosition; |
| 28 }; | 26 }; |
| 29 | 27 |
| 30 struct PositionCoverageAttr { | 28 struct PositionCoverageAttr { |
| 31 SkPoint fPosition; | 29 SkPoint fPosition; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 kLastGPType = kCoverage_GPType | 73 kLastGPType = kCoverage_GPType |
| 76 }; | 74 }; |
| 77 | 75 |
| 78 /* | 76 /* |
| 79 * The following functions are used to create default GPs. If you just need
to create | 77 * The following functions are used to create default GPs. If you just need
to create |
| 80 * attributes seperately from creating the default GP, use the SetAttribs fu
nction followed | 78 * attributes seperately from creating the default GP, use the SetAttribs fu
nction followed |
| 81 * by the Create function. Otherwise use CreateAndSetAttribs to do both at
once. | 79 * by the Create function. Otherwise use CreateAndSetAttribs to do both at
once. |
| 82 * | 80 * |
| 83 * You must unref the return from Create. | 81 * You must unref the return from Create. |
| 84 */ | 82 */ |
| 85 static void SetAttribs(GrDrawState*, uint32_t GPTypeFlags = 0); | 83 static const GrGeometryProcessor* Create(uint32_t gpTypeFlags = 0); |
| 86 static const GrGeometryProcessor* CreateAndSetAttribs(GrDrawState*, uint32_t
GPTypeFlags = 0); | |
| 87 static const GrGeometryProcessor* Create(bool hasAttributeCoverage); | |
| 88 }; | 84 }; |
| 89 | 85 |
| 90 #endif | 86 #endif |
| OLD | NEW |