| 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 |
| 11 #include "GrGLPrimitiveProcessor.h" | 11 #include "GrGLPrimitiveProcessor.h" |
| 12 | 12 |
| 13 class GrGLVertexBuilder; | 13 class GrGLGPBuilder; |
| 14 | 14 |
| 15 /** | 15 /** |
| 16 * If a GL effect needs a GrGLFullShaderBuilder* object to emit vertex code, the
n it must inherit | 16 * If a GL effect needs a GrGLFullShaderBuilder* object to emit vertex code, the
n it must inherit |
| 17 * from this class. Since paths don't have vertices, this class is only meant to
be used internally | 17 * from this class. Since paths don't have vertices, this class is only meant to
be used internally |
| 18 * by skia, for special cases. | 18 * by skia, for special cases. |
| 19 */ | 19 */ |
| 20 class GrGLGeometryProcessor : public GrGLPrimitiveProcessor { | 20 class GrGLGeometryProcessor : public GrGLPrimitiveProcessor { |
| 21 public: | 21 public: |
| 22 /* Any general emit code goes in the base class emitCode. Subclasses overri
de onEmitCode */ | 22 /* Any general emit code goes in the base class emitCode. Subclasses overri
de onEmitCode */ |
| 23 void emitCode(EmitArgs&) SK_OVERRIDE; | 23 void emitCode(EmitArgs&) SK_OVERRIDE; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 44 const TransformsIn&, | 44 const TransformsIn&, |
| 45 TransformsOut*); | 45 TransformsOut*); |
| 46 | 46 |
| 47 struct GrGPArgs { | 47 struct GrGPArgs { |
| 48 // The variable used by a GP to store its position. It can be | 48 // The variable used by a GP to store its position. It can be |
| 49 // either a vec2 or a vec3 depending on the presence of perspective. | 49 // either a vec2 or a vec3 depending on the presence of perspective. |
| 50 GrShaderVar fPositionVar; | 50 GrShaderVar fPositionVar; |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 // Create the correct type of position variable given the CTM | 53 // Create the correct type of position variable given the CTM |
| 54 static void SetupPosition(GrGLVertexBuilder* vsBuilder, | 54 void setupPosition(GrGLGPBuilder* pb, |
| 55 GrGPArgs* gpArgs, | 55 GrGPArgs* gpArgs, |
| 56 const char* posName, | 56 const char* posName, |
| 57 const SkMatrix& mat, | 57 const SkMatrix& mat); |
| 58 const char* matName); | |
| 59 | 58 |
| 60 static uint32_t ComputePosKey(const SkMatrix& mat) { | 59 static uint32_t ComputePosKey(const SkMatrix& mat) { |
| 61 if (mat.isIdentity()) { | 60 if (mat.isIdentity()) { |
| 62 return 0x0; | 61 return 0x0; |
| 63 } else if (!mat.hasPerspective()) { | 62 } else if (!mat.hasPerspective()) { |
| 64 return 0x01; | 63 return 0x01; |
| 65 } else { | 64 } else { |
| 66 return 0x02; | 65 return 0x02; |
| 67 } | 66 } |
| 68 } | 67 } |
| 69 | 68 |
| 70 private: | 69 private: |
| 71 virtual void onEmitCode(EmitArgs&, GrGPArgs*) = 0; | 70 virtual void onEmitCode(EmitArgs&, GrGPArgs*) = 0; |
| 72 | 71 |
| 73 typedef GrGLPrimitiveProcessor INHERITED; | 72 typedef GrGLPrimitiveProcessor INHERITED; |
| 74 }; | 73 }; |
| 75 | 74 |
| 76 #endif | 75 #endif |
| OLD | NEW |