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 18 matching lines...) Expand all Loading... |
29 const SkTArray<const GrCoordTransform*, true>& transfo
rms) override { | 29 const SkTArray<const GrCoordTransform*, true>& transfo
rms) override { |
30 this->setTransformDataHelper(SkMatrix::I(), pdman, index, transforms); | 30 this->setTransformDataHelper(SkMatrix::I(), pdman, index, transforms); |
31 } | 31 } |
32 | 32 |
33 protected: | 33 protected: |
34 // A helper which subclasses can use if needed and used above in the default
setTransformData(). | 34 // A helper which subclasses can use if needed and used above in the default
setTransformData(). |
35 void setTransformDataHelper(const SkMatrix& localMatrix, | 35 void setTransformDataHelper(const SkMatrix& localMatrix, |
36 const GrGLSLProgramDataManager& pdman, | 36 const GrGLSLProgramDataManager& pdman, |
37 int index, | 37 int index, |
38 const SkTArray<const GrCoordTransform*, true>& t
ransforms) { | 38 const SkTArray<const GrCoordTransform*, true>& t
ransforms) { |
39 SkSTArray<2, UniformTransform, true>& procTransforms = fInstalledTransfo
rms[index]; | 39 SkTArray<TransformUniform, true>& procTransforms = fInstalledTransforms[
index]; |
40 int numTransforms = transforms.count(); | 40 int numTransforms = transforms.count(); |
41 for (int t = 0; t < numTransforms; ++t) { | 41 for (int t = 0; t < numTransforms; ++t) { |
42 SkASSERT(procTransforms[t].fHandle.isValid()); | 42 SkASSERT(procTransforms[t].fHandle.isValid()); |
43 const SkMatrix& transform = GetTransformMatrix(localMatrix, *transfo
rms[t]); | 43 const SkMatrix& transform = GetTransformMatrix(localMatrix, *transfo
rms[t]); |
44 if (!procTransforms[t].fCurrentValue.cheapEqualTo(transform)) { | 44 if (!procTransforms[t].fCurrentValue.cheapEqualTo(transform)) { |
45 pdman.setSkMatrix(procTransforms[t].fHandle.toIndex(), transform
); | 45 pdman.setSkMatrix(procTransforms[t].fHandle.toIndex(), transform
); |
46 procTransforms[t].fCurrentValue = transform; | 46 procTransforms[t].fCurrentValue = transform; |
47 } | 47 } |
48 } | 48 } |
49 } | 49 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 } else if (!mat.hasPerspective()) { | 98 } else if (!mat.hasPerspective()) { |
99 return 0x01; | 99 return 0x01; |
100 } else { | 100 } else { |
101 return 0x02; | 101 return 0x02; |
102 } | 102 } |
103 } | 103 } |
104 | 104 |
105 private: | 105 private: |
106 virtual void onEmitCode(EmitArgs&, GrGPArgs*) = 0; | 106 virtual void onEmitCode(EmitArgs&, GrGPArgs*) = 0; |
107 | 107 |
108 struct UniformTransform : public Transform { | 108 struct TransformUniform { |
109 UniformTransform() : Transform() {} | |
110 UniformHandle fHandle; | 109 UniformHandle fHandle; |
| 110 SkMatrix fCurrentValue = SkMatrix::InvalidMatrix(); |
111 }; | 111 }; |
112 | 112 |
113 SkSTArray<8, SkSTArray<2, UniformTransform, true> > fInstalledTransforms; | 113 SkSTArray<8, SkSTArray<2, TransformUniform, true> > fInstalledTransforms; |
114 | 114 |
115 typedef GrGLSLPrimitiveProcessor INHERITED; | 115 typedef GrGLSLPrimitiveProcessor INHERITED; |
116 }; | 116 }; |
117 | 117 |
118 #endif | 118 #endif |
OLD | NEW |