| 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 26 matching lines...) Expand all Loading... |
| 37 int index, | 37 int index, |
| 38 const SkTArray<const GrCoordTransform*, true>& t
ransforms) { | 38 const SkTArray<const GrCoordTransform*, true>& t
ransforms) { |
| 39 const GeometryProcessor& gp = primProc.cast<GeometryProcessor>(); | 39 const GeometryProcessor& gp = primProc.cast<GeometryProcessor>(); |
| 40 this->setTransformDataMatrix(gp.localMatrix(), pdman, index, transforms)
; | 40 this->setTransformDataMatrix(gp.localMatrix(), pdman, index, transforms)
; |
| 41 } | 41 } |
| 42 | 42 |
| 43 protected: | 43 protected: |
| 44 // Emit a uniform matrix for each coord transform. | 44 // Emit a uniform matrix for each coord transform. |
| 45 void emitTransforms(GrGLSLGPBuilder* gp, | 45 void emitTransforms(GrGLSLGPBuilder* gp, |
| 46 GrGLSLVertexBuilder* vb, | 46 GrGLSLVertexBuilder* vb, |
| 47 GrGLSLVaryingHandler* varyingHandler, |
| 47 const GrShaderVar& posVar, | 48 const GrShaderVar& posVar, |
| 48 const char* localCoords, | 49 const char* localCoords, |
| 49 const TransformsIn& tin, | 50 const TransformsIn& tin, |
| 50 TransformsOut* tout) { | 51 TransformsOut* tout) { |
| 51 this->emitTransforms(gp, vb, posVar, localCoords, SkMatrix::I(), tin, to
ut); | 52 this->emitTransforms(gp, vb, varyingHandler, posVar, localCoords, SkMatr
ix::I(), tin, tout); |
| 52 } | 53 } |
| 53 | 54 |
| 54 // Emit pre-transformed coords as a vertex attribute per coord-transform. | 55 // Emit pre-transformed coords as a vertex attribute per coord-transform. |
| 55 void emitTransforms(GrGLSLGPBuilder*, | 56 void emitTransforms(GrGLSLGPBuilder*, |
| 56 GrGLSLVertexBuilder*, | 57 GrGLSLVertexBuilder*, |
| 58 GrGLSLVaryingHandler*, |
| 57 const GrShaderVar& posVar, | 59 const GrShaderVar& posVar, |
| 58 const char* localCoords, | 60 const char* localCoords, |
| 59 const SkMatrix& localMatrix, | 61 const SkMatrix& localMatrix, |
| 60 const TransformsIn&, | 62 const TransformsIn&, |
| 61 TransformsOut*); | 63 TransformsOut*); |
| 62 | 64 |
| 63 // caller has emitted transforms via attributes | 65 // caller has emitted transforms via attributes |
| 64 void emitTransforms(GrGLSLGPBuilder*, | 66 void emitTransforms(GrGLSLGPBuilder*, |
| 65 GrGLSLVertexBuilder*, | 67 GrGLSLVertexBuilder*, |
| 68 GrGLSLVaryingHandler*, |
| 66 const char* localCoords, | 69 const char* localCoords, |
| 67 const TransformsIn& tin, | 70 const TransformsIn& tin, |
| 68 TransformsOut* tout); | 71 TransformsOut* tout); |
| 69 | 72 |
| 70 struct GrGPArgs { | 73 struct GrGPArgs { |
| 71 // The variable used by a GP to store its position. It can be | 74 // The variable used by a GP to store its position. It can be |
| 72 // either a vec2 or a vec3 depending on the presence of perspective. | 75 // either a vec2 or a vec3 depending on the presence of perspective. |
| 73 GrShaderVar fPositionVar; | 76 GrShaderVar fPositionVar; |
| 74 }; | 77 }; |
| 75 | 78 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 } | 111 } |
| 109 } | 112 } |
| 110 } | 113 } |
| 111 | 114 |
| 112 virtual void onEmitCode(EmitArgs&, GrGPArgs*) = 0; | 115 virtual void onEmitCode(EmitArgs&, GrGPArgs*) = 0; |
| 113 | 116 |
| 114 typedef GrGLSLPrimitiveProcessor INHERITED; | 117 typedef GrGLSLPrimitiveProcessor INHERITED; |
| 115 }; | 118 }; |
| 116 | 119 |
| 117 #endif | 120 #endif |
| OLD | NEW |