| 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 |
| 52 if (fCoordChangeMatrixSet != other.fCoordChangeMatrixSet) { | 53 // We always track the coord change matrix, but it has no effect when ex
plicit local coords |
| 54 // are used. |
| 55 if (usingExplicitLocalCoords) { |
| 56 return true; |
| 57 } |
| 58 |
| 59 if (a.fCoordChangeMatrixSet != b.fCoordChangeMatrixSet) { |
| 53 return false; | 60 return false; |
| 54 } | 61 } |
| 55 | 62 |
| 56 if (!fCoordChangeMatrixSet) { | 63 if (!a.fCoordChangeMatrixSet) { |
| 57 return true; | 64 return true; |
| 58 } | 65 } |
| 59 | 66 |
| 60 return fCoordChangeMatrix == other.fCoordChangeMatrix; | 67 return a.fCoordChangeMatrix == b.fCoordChangeMatrix; |
| 61 } | 68 } |
| 62 | 69 |
| 63 bool operator!= (const GrEffectStage& s) const { return !(*this == s); } | |
| 64 | |
| 65 /** | 70 /** |
| 66 * This is called when the coordinate system in which the geometry is specif
ied will change. | 71 * This is called when the coordinate system in which the geometry is specif
ied will change. |
| 67 * | 72 * |
| 68 * @param matrix The transformation from the old coord system in which ge
ometry is specified | 73 * @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. | 74 * to the new one from which it will actually be drawn. |
| 70 */ | 75 */ |
| 71 void localCoordChange(const SkMatrix& matrix) { | 76 void localCoordChange(const SkMatrix& matrix) { |
| 72 if (fCoordChangeMatrixSet) { | 77 if (fCoordChangeMatrixSet) { |
| 73 fCoordChangeMatrix.preConcat(matrix); | 78 fCoordChangeMatrix.preConcat(matrix); |
| 74 } else { | 79 } else { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 int getVertexAttribIndexCount() const { return fEffect->numVertexAttribs();
} | 137 int getVertexAttribIndexCount() const { return fEffect->numVertexAttribs();
} |
| 133 | 138 |
| 134 private: | 139 private: |
| 135 bool fCoordChangeMatrixSet; | 140 bool fCoordChangeMatrixSet; |
| 136 SkMatrix fCoordChangeMatrix; | 141 SkMatrix fCoordChangeMatrix; |
| 137 SkAutoTUnref<const GrEffect> fEffect; | 142 SkAutoTUnref<const GrEffect> fEffect; |
| 138 int fVertexAttribIndices[2]; | 143 int fVertexAttribIndices[2]; |
| 139 }; | 144 }; |
| 140 | 145 |
| 141 #endif | 146 #endif |
| OLD | NEW |