OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 GrGLGeometryProcessor_DEFINED | 8 #ifndef GrGLGeometryProcessor_DEFINED |
9 #define GrGLGeometryProcessor_DEFINED | 9 #define GrGLGeometryProcessor_DEFINED |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 const TransformsIn&, | 57 const TransformsIn&, |
58 TransformsOut*); | 58 TransformsOut*); |
59 | 59 |
60 struct GrGPArgs { | 60 struct GrGPArgs { |
61 // The variable used by a GP to store its position. It can be | 61 // The variable used by a GP to store its position. It can be |
62 // either a vec2 or a vec3 depending on the presence of perspective. | 62 // either a vec2 or a vec3 depending on the presence of perspective. |
63 GrShaderVar fPositionVar; | 63 GrShaderVar fPositionVar; |
64 }; | 64 }; |
65 | 65 |
66 // Create the correct type of position variable given the CTM | 66 // Create the correct type of position variable given the CTM |
67 void setupPosition(GrGLGPBuilder* pb, | 67 void setupPosition(GrGLGPBuilder*, GrGPArgs*, const char* posName); |
68 GrGPArgs* gpArgs, | 68 void setupPosition(GrGLGPBuilder*, GrGPArgs*, const char* posName, const SkM
atrix& mat, |
69 const char* posName, | 69 UniformHandle* viewMatrixUniform); |
70 const SkMatrix& mat = SkMatrix::I()); | |
71 | 70 |
72 static uint32_t ComputePosKey(const SkMatrix& mat) { | 71 static uint32_t ComputePosKey(const SkMatrix& mat) { |
73 if (mat.isIdentity()) { | 72 if (mat.isIdentity()) { |
74 return 0x0; | 73 return 0x0; |
75 } else if (!mat.hasPerspective()) { | 74 } else if (!mat.hasPerspective()) { |
76 return 0x01; | 75 return 0x01; |
77 } else { | 76 } else { |
78 return 0x02; | 77 return 0x02; |
79 } | 78 } |
80 } | 79 } |
(...skipping 14 matching lines...) Expand all Loading... |
95 } | 94 } |
96 } | 95 } |
97 } | 96 } |
98 | 97 |
99 virtual void onEmitCode(EmitArgs&, GrGPArgs*) = 0; | 98 virtual void onEmitCode(EmitArgs&, GrGPArgs*) = 0; |
100 | 99 |
101 typedef GrGLPrimitiveProcessor INHERITED; | 100 typedef GrGLPrimitiveProcessor INHERITED; |
102 }; | 101 }; |
103 | 102 |
104 #endif | 103 #endif |
OLD | NEW |