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 GrGLSLGeometryProcessor_DEFINED | 8 #ifndef GrGLSLGeometryProcessor_DEFINED |
9 #define GrGLSLGeometryProcessor_DEFINED | 9 #define GrGLSLGeometryProcessor_DEFINED |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 void emitCode(EmitArgs&) override; | 23 void emitCode(EmitArgs&) override; |
24 | 24 |
25 // By default we use the identity matrix | 25 // By default we use the identity matrix |
26 void setTransformData(const GrPrimitiveProcessor&, | 26 void setTransformData(const GrPrimitiveProcessor&, |
27 const GrGLSLProgramDataManager& pdman, | 27 const GrGLSLProgramDataManager& pdman, |
28 int index, | 28 int index, |
29 const SkTArray<const GrCoordTransform*, true>& transfo
rms) override { | 29 const SkTArray<const GrCoordTransform*, true>& transfo
rms) override { |
30 this->setTransformDataMatrix(SkMatrix::I(), pdman, index, transforms); | 30 this->setTransformDataMatrix(SkMatrix::I(), pdman, index, transforms); |
31 } | 31 } |
32 | 32 |
| 33 protected: |
33 // A helper which subclasses can use if needed | 34 // A helper which subclasses can use if needed |
34 template <class GeometryProcessor> | 35 template <class GeometryProcessor> |
35 void setTransformDataHelper(const GrPrimitiveProcessor& primProc, | 36 void setTransformDataHelper(const GrPrimitiveProcessor& primProc, |
36 const GrGLSLProgramDataManager& pdman, | 37 const GrGLSLProgramDataManager& pdman, |
37 int index, | 38 int index, |
38 const SkTArray<const GrCoordTransform*, true>& t
ransforms) { | 39 const SkTArray<const GrCoordTransform*, true>& t
ransforms) { |
39 const GeometryProcessor& gp = primProc.cast<GeometryProcessor>(); | 40 const GeometryProcessor& gp = primProc.cast<GeometryProcessor>(); |
40 this->setTransformDataMatrix(gp.localMatrix(), pdman, index, transforms)
; | 41 this->setTransformDataMatrix(gp.localMatrix(), pdman, index, transforms)
; |
41 } | 42 } |
42 | 43 |
43 protected: | |
44 // Emit a uniform matrix for each coord transform. | 44 // Emit a uniform matrix for each coord transform. |
45 void emitTransforms(GrGLSLVertexBuilder* vb, | 45 void emitTransforms(GrGLSLVertexBuilder* vb, |
46 GrGLSLVaryingHandler* varyingHandler, | 46 GrGLSLVaryingHandler* varyingHandler, |
47 GrGLSLUniformHandler* uniformHandler, | 47 GrGLSLUniformHandler* uniformHandler, |
48 const GrShaderVar& posVar, | 48 const GrShaderVar& posVar, |
49 const char* localCoords, | 49 const char* localCoords, |
50 const TransformsIn& tin, | 50 const TransformsIn& tin, |
51 TransformsOut* tout) { | 51 TransformsOut* tout) { |
52 this->emitTransforms(vb, varyingHandler, uniformHandler, | 52 this->emitTransforms(vb, varyingHandler, uniformHandler, |
53 posVar, localCoords, SkMatrix::I(), tin, tout); | 53 posVar, localCoords, SkMatrix::I(), tin, tout); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 } | 111 } |
112 } | 112 } |
113 } | 113 } |
114 | 114 |
115 virtual void onEmitCode(EmitArgs&, GrGPArgs*) = 0; | 115 virtual void onEmitCode(EmitArgs&, GrGPArgs*) = 0; |
116 | 116 |
117 typedef GrGLSLPrimitiveProcessor INHERITED; | 117 typedef GrGLSLPrimitiveProcessor INHERITED; |
118 }; | 118 }; |
119 | 119 |
120 #endif | 120 #endif |
OLD | NEW |