| 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 /* | 13 /* |
| 14 * A factory for creating default Geometry Processors which simply multiply posi
tion by the uniform | 14 * A factory for creating default Geometry Processors which simply multiply posi
tion by the uniform |
| 15 * view matrix and wire through color, coverage, UV coords if requested. Right
now this is only | 15 * view matrix and wire through color, coverage, UV coords if requested. Right
now this is only |
| 16 * used in the creation of optimized draw states because adding default GPs to t
he drawstate can | 16 * used in the creation of optimized draw states because adding default GPs to t
he drawstate can |
| 17 * interfere with batching due to updating the drawstate. | 17 * interfere with batching due to updating the drawstate. |
| 18 */ | 18 */ |
| 19 namespace GrDefaultGeoProcFactory { | 19 namespace GrDefaultGeoProcFactory { |
| 20 // Structs for adding vertex attributes | 20 // Structs for adding vertex attributes |
| 21 struct PositionAttr { | 21 struct PositionAttr { |
| 22 SkPoint fPosition; | 22 SkPoint fPosition; |
| 23 }; | 23 }; |
| 24 | 24 |
| 25 struct PositionCoverageAttr { | 25 struct PositionCoverageAttr { |
| 26 SkPoint fPosition; | 26 SkPoint fPosition; |
| 27 GrColor fCoverage; | 27 float fCoverage; |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 struct PositionColorAttr { | 30 struct PositionColorAttr { |
| 31 SkPoint fPosition; | 31 SkPoint fPosition; |
| 32 SkColor fColor; | 32 SkColor fColor; |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 struct PositionColorCoverageAttr { | 35 struct PositionColorCoverageAttr { |
| 36 SkPoint fPosition; | 36 SkPoint fPosition; |
| 37 SkColor fColor; | 37 SkColor fColor; |
| 38 GrColor fCoverage; | 38 float fCoverage; |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 struct PositionLocalCoordAttr { | 41 struct PositionLocalCoordAttr { |
| 42 SkPoint fPosition; | 42 SkPoint fPosition; |
| 43 SkPoint fLocalCoord; | 43 SkPoint fLocalCoord; |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 struct PositionLocalCoordCoverageAttr { | 46 struct PositionLocalCoordCoverageAttr { |
| 47 SkPoint fPosition; | 47 SkPoint fPosition; |
| 48 SkPoint fLocalCoord; | 48 SkPoint fLocalCoord; |
| 49 GrColor fCoverage; | 49 float fCoverage; |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 struct PositionColorLocalCoordAttr { | 52 struct PositionColorLocalCoordAttr { |
| 53 SkPoint fPosition; | 53 SkPoint fPosition; |
| 54 GrColor fColor; | 54 GrColor fColor; |
| 55 SkPoint fLocalCoord; | 55 SkPoint fLocalCoord; |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 struct PositionColorLocalCoordCoverage { | 58 struct PositionColorLocalCoordCoverage { |
| 59 SkPoint fPosition; | 59 SkPoint fPosition; |
| 60 GrColor fColor; | 60 GrColor fColor; |
| 61 SkPoint fLocalCoord; | 61 SkPoint fLocalCoord; |
| 62 GrColor fCoverage; | 62 float fCoverage; |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 struct Color { | 65 struct Color { |
| 66 enum Type { | 66 enum Type { |
| 67 kNone_Type, | 67 kNone_Type, |
| 68 kUniform_Type, | 68 kUniform_Type, |
| 69 kAttribute_Type, | 69 kAttribute_Type, |
| 70 }; | 70 }; |
| 71 Color(GrColor color) : fType(kUniform_Type), fColor(color) {} | 71 Color(GrColor color) : fType(kUniform_Type), fColor(color) {} |
| 72 Color(Type type) : fType(type), fColor(GrColor_ILLEGAL) { | 72 Color(Type type) : fType(type), fColor(GrColor_ILLEGAL) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 */ | 127 */ |
| 128 sk_sp<GrGeometryProcessor> MakeForDeviceSpace(const Color&, | 128 sk_sp<GrGeometryProcessor> MakeForDeviceSpace(const Color&, |
| 129 const Coverage&, | 129 const Coverage&, |
| 130 const LocalCoords&, | 130 const LocalCoords&, |
| 131 const SkMatrix& viewMatrix); | 131 const SkMatrix& viewMatrix); |
| 132 | 132 |
| 133 inline size_t DefaultVertexStride() { return sizeof(PositionAttr); } | 133 inline size_t DefaultVertexStride() { return sizeof(PositionAttr); } |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 #endif | 136 #endif |
| OLD | NEW |