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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 GrSafeAssign(fEffectRef, other.fEffectRef); | 51 GrSafeAssign(fEffectRef, other.fEffectRef); |
52 if (NULL != fEffectRef) { | 52 if (NULL != fEffectRef) { |
53 fCoordChangeMatrix = other.fCoordChangeMatrix; | 53 fCoordChangeMatrix = other.fCoordChangeMatrix; |
54 } | 54 } |
55 return *this; | 55 return *this; |
56 } | 56 } |
57 | 57 |
58 /** | 58 /** |
59 * This is called when the coordinate system in which the geometry is specif
ied will change. | 59 * This is called when the coordinate system in which the geometry is specif
ied will change. |
60 * | 60 * |
61 * @param matrix The transformation from the old coord system to the new
one. | 61 * @param matrix The transformation from the old coord system in which ge
ometry is specified |
| 62 * to the new one from which it will actually be drawn. |
62 */ | 63 */ |
63 void preConcatCoordChange(const SkMatrix& matrix) { fCoordChangeMatrix.preCo
ncat(matrix); } | 64 void localCoordChange(const SkMatrix& matrix) { fCoordChangeMatrix.preConcat
(matrix); } |
64 | 65 |
65 class SavedCoordChange { | 66 class SavedCoordChange { |
66 private: | 67 private: |
67 SkMatrix fCoordChangeMatrix; | 68 SkMatrix fCoordChangeMatrix; |
68 GR_DEBUGCODE(mutable SkAutoTUnref<const GrEffectRef> fEffectRef;) | 69 GR_DEBUGCODE(mutable SkAutoTUnref<const GrEffectRef> fEffectRef;) |
69 | 70 |
70 friend class GrEffectStage; | 71 friend class GrEffectStage; |
71 }; | 72 }; |
72 | 73 |
73 /** | 74 /** |
74 * This gets the current coordinate system change. It is the accumulation of | 75 * This gets the current coordinate system change. It is the accumulation of |
75 * preConcatCoordChange calls since the effect was installed. It is used whe
n then caller | 76 * localCoordChange calls since the effect was installed. It is used when th
en caller |
76 * wants to temporarily change the source geometry coord system, draw someth
ing, and then | 77 * wants to temporarily change the source geometry coord system, draw someth
ing, and then |
77 * restore the previous coord system (e.g. temporarily draw in device coords
). | 78 * restore the previous coord system (e.g. temporarily draw in device coords
). |
78 */ | 79 */ |
79 void saveCoordChange(SavedCoordChange* savedCoordChange) const { | 80 void saveCoordChange(SavedCoordChange* savedCoordChange) const { |
80 savedCoordChange->fCoordChangeMatrix = fCoordChangeMatrix; | 81 savedCoordChange->fCoordChangeMatrix = fCoordChangeMatrix; |
81 GrAssert(NULL == savedCoordChange->fEffectRef.get()); | 82 GrAssert(NULL == savedCoordChange->fEffectRef.get()); |
82 GR_DEBUGCODE(GrSafeRef(fEffectRef);) | 83 GR_DEBUGCODE(GrSafeRef(fEffectRef);) |
83 GR_DEBUGCODE(savedCoordChange->fEffectRef.reset(fEffectRef);) | 84 GR_DEBUGCODE(savedCoordChange->fEffectRef.reset(fEffectRef);) |
84 GR_DEBUGCODE(++fSavedCoordChangeCnt); | 85 GR_DEBUGCODE(++fSavedCoordChangeCnt); |
85 } | 86 } |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 190 |
190 private: | 191 private: |
191 SkMatrix fCoordChangeMatrix; | 192 SkMatrix fCoordChangeMatrix; |
192 const GrEffectRef* fEffectRef; | 193 const GrEffectRef* fEffectRef; |
193 SkSTArray<2, int, true> fVertexAttribIndices; | 194 SkSTArray<2, int, true> fVertexAttribIndices; |
194 | 195 |
195 GR_DEBUGCODE(mutable int fSavedCoordChangeCnt;) | 196 GR_DEBUGCODE(mutable int fSavedCoordChangeCnt;) |
196 }; | 197 }; |
197 | 198 |
198 #endif | 199 #endif |
OLD | NEW |