OLD | NEW |
---|---|
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... | |
33 | 33 |
34 GrEffectStage& operator= (const GrEffectStage& other) { | 34 GrEffectStage& operator= (const GrEffectStage& other) { |
35 fCoordChangeMatrixSet = other.fCoordChangeMatrixSet; | 35 fCoordChangeMatrixSet = other.fCoordChangeMatrixSet; |
36 if (other.fCoordChangeMatrixSet) { | 36 if (other.fCoordChangeMatrixSet) { |
37 fCoordChangeMatrix = other.fCoordChangeMatrix; | 37 fCoordChangeMatrix = other.fCoordChangeMatrix; |
38 } | 38 } |
39 fEffect.reset(SkRef(other.fEffect.get())); | 39 fEffect.reset(SkRef(other.fEffect.get())); |
40 memcpy(fVertexAttribIndices, other.fVertexAttribIndices, sizeof(fVertexA ttribIndices)); | 40 memcpy(fVertexAttribIndices, other.fVertexAttribIndices, sizeof(fVertexA ttribIndices)); |
41 return *this; | 41 return *this; |
42 } | 42 } |
43 | |
44 static bool AreCompatible(const GrEffectStage& a, const GrEffectStage& b, | |
45 bool usingExplicitLocalCoords) { | |
46 SkASSERT(NULL != a.fEffect.get()); | |
47 SkASSERT(NULL != b.fEffect.get()); | |
43 | 48 |
44 bool operator== (const GrEffectStage& other) const { | 49 if (!a.getEffect()->isEqual(*b.getEffect())) { |
45 SkASSERT(NULL != fEffect.get()); | |
46 SkASSERT(NULL != other.fEffect.get()); | |
47 | |
48 if (!this->getEffect()->isEqual(*other.getEffect())) { | |
49 return false; | 50 return false; |
50 } | 51 } |
51 | 52 |
robertphillips
2014/08/04 16:08:46
// When explicit local coordinates are in use the
bsalomon
2014/08/04 16:12:33
Done.
| |
52 if (fCoordChangeMatrixSet != other.fCoordChangeMatrixSet) { | 53 if (usingExplicitLocalCoords) { |
54 return true; | |
55 } | |
56 | |
57 if (a.fCoordChangeMatrixSet != b.fCoordChangeMatrixSet) { | |
53 return false; | 58 return false; |
54 } | 59 } |
55 | 60 |
56 if (!fCoordChangeMatrixSet) { | 61 if (!a.fCoordChangeMatrixSet) { |
57 return true; | 62 return true; |
58 } | 63 } |
59 | 64 |
60 return fCoordChangeMatrix == other.fCoordChangeMatrix; | 65 return a.fCoordChangeMatrix == b.fCoordChangeMatrix; |
61 } | 66 } |
62 | 67 |
63 bool operator!= (const GrEffectStage& s) const { return !(*this == s); } | |
64 | |
65 /** | 68 /** |
66 * This is called when the coordinate system in which the geometry is specif ied will change. | 69 * This is called when the coordinate system in which the geometry is specif ied will change. |
67 * | 70 * |
68 * @param matrix The transformation from the old coord system in which ge ometry is specified | 71 * @param matrix The transformation from the old coord system in which ge ometry is specified |
69 * to the new one from which it will actually be drawn. | 72 * to the new one from which it will actually be drawn. |
70 */ | 73 */ |
71 void localCoordChange(const SkMatrix& matrix) { | 74 void localCoordChange(const SkMatrix& matrix) { |
72 if (fCoordChangeMatrixSet) { | 75 if (fCoordChangeMatrixSet) { |
73 fCoordChangeMatrix.preConcat(matrix); | 76 fCoordChangeMatrix.preConcat(matrix); |
74 } else { | 77 } else { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
132 int getVertexAttribIndexCount() const { return fEffect->numVertexAttribs(); } | 135 int getVertexAttribIndexCount() const { return fEffect->numVertexAttribs(); } |
133 | 136 |
134 private: | 137 private: |
135 bool fCoordChangeMatrixSet; | 138 bool fCoordChangeMatrixSet; |
136 SkMatrix fCoordChangeMatrix; | 139 SkMatrix fCoordChangeMatrix; |
137 SkAutoTUnref<const GrEffect> fEffect; | 140 SkAutoTUnref<const GrEffect> fEffect; |
138 int fVertexAttribIndices[2]; | 141 int fVertexAttribIndices[2]; |
139 }; | 142 }; |
140 | 143 |
141 #endif | 144 #endif |
OLD | NEW |