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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 } else { | 80 } else { |
81 fCoordChangeMatrixSet = true; | 81 fCoordChangeMatrixSet = true; |
82 fCoordChangeMatrix = matrix; | 82 fCoordChangeMatrix = matrix; |
83 } | 83 } |
84 } | 84 } |
85 | 85 |
86 class SavedCoordChange { | 86 class SavedCoordChange { |
87 private: | 87 private: |
88 bool fCoordChangeMatrixSet; | 88 bool fCoordChangeMatrixSet; |
89 SkMatrix fCoordChangeMatrix; | 89 SkMatrix fCoordChangeMatrix; |
90 GR_DEBUGCODE(mutable SkAutoTUnref<const GrEffectRef> fEffectRef;) | 90 SkDEBUGCODE(mutable SkAutoTUnref<const GrEffectRef> fEffectRef;) |
91 | 91 |
92 friend class GrEffectStage; | 92 friend class GrEffectStage; |
93 }; | 93 }; |
94 | 94 |
95 /** | 95 /** |
96 * This gets the current coordinate system change. It is the accumulation of | 96 * This gets the current coordinate system change. It is the accumulation of |
97 * localCoordChange calls since the effect was installed. It is used when th
en caller | 97 * localCoordChange calls since the effect was installed. It is used when th
en caller |
98 * wants to temporarily change the source geometry coord system, draw someth
ing, and then | 98 * wants to temporarily change the source geometry coord system, draw someth
ing, and then |
99 * restore the previous coord system (e.g. temporarily draw in device coords
). | 99 * restore the previous coord system (e.g. temporarily draw in device coords
). |
100 */ | 100 */ |
101 void saveCoordChange(SavedCoordChange* savedCoordChange) const { | 101 void saveCoordChange(SavedCoordChange* savedCoordChange) const { |
102 savedCoordChange->fCoordChangeMatrixSet = fCoordChangeMatrixSet; | 102 savedCoordChange->fCoordChangeMatrixSet = fCoordChangeMatrixSet; |
103 if (fCoordChangeMatrixSet) { | 103 if (fCoordChangeMatrixSet) { |
104 savedCoordChange->fCoordChangeMatrix = fCoordChangeMatrix; | 104 savedCoordChange->fCoordChangeMatrix = fCoordChangeMatrix; |
105 } | 105 } |
106 SkASSERT(NULL == savedCoordChange->fEffectRef.get()); | 106 SkASSERT(NULL == savedCoordChange->fEffectRef.get()); |
107 GR_DEBUGCODE(SkRef(fEffectRef.get());) | 107 SkDEBUGCODE(SkRef(fEffectRef.get());) |
108 GR_DEBUGCODE(savedCoordChange->fEffectRef.reset(fEffectRef.get());) | 108 SkDEBUGCODE(savedCoordChange->fEffectRef.reset(fEffectRef.get());) |
109 } | 109 } |
110 | 110 |
111 /** | 111 /** |
112 * This balances the saveCoordChange call. | 112 * This balances the saveCoordChange call. |
113 */ | 113 */ |
114 void restoreCoordChange(const SavedCoordChange& savedCoordChange) { | 114 void restoreCoordChange(const SavedCoordChange& savedCoordChange) { |
115 fCoordChangeMatrixSet = savedCoordChange.fCoordChangeMatrixSet; | 115 fCoordChangeMatrixSet = savedCoordChange.fCoordChangeMatrixSet; |
116 if (fCoordChangeMatrixSet) { | 116 if (fCoordChangeMatrixSet) { |
117 fCoordChangeMatrix = savedCoordChange.fCoordChangeMatrix; | 117 fCoordChangeMatrix = savedCoordChange.fCoordChangeMatrix; |
118 } | 118 } |
119 SkASSERT(savedCoordChange.fEffectRef.get() == fEffectRef); | 119 SkASSERT(savedCoordChange.fEffectRef.get() == fEffectRef); |
120 GR_DEBUGCODE(savedCoordChange.fEffectRef.reset(NULL);) | 120 SkDEBUGCODE(savedCoordChange.fEffectRef.reset(NULL);) |
121 } | 121 } |
122 | 122 |
123 /** | 123 /** |
124 * Used when storing a deferred GrDrawState. The DeferredStage allows resour
ces owned by its | 124 * Used when storing a deferred GrDrawState. The DeferredStage allows resour
ces owned by its |
125 * GrEffect to be recycled through the cache. | 125 * GrEffect to be recycled through the cache. |
126 */ | 126 */ |
127 class DeferredStage { | 127 class DeferredStage { |
128 public: | 128 public: |
129 DeferredStage() : fEffect(NULL) { | 129 DeferredStage() : fEffect(NULL) { |
130 SkDEBUGCODE(fInitialized = false;) | 130 SkDEBUGCODE(fInitialized = false;) |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 int getVertexAttribIndexCount() const { return fEffectRef->get()->numVertexA
ttribs(); } | 214 int getVertexAttribIndexCount() const { return fEffectRef->get()->numVertexA
ttribs(); } |
215 | 215 |
216 private: | 216 private: |
217 bool fCoordChangeMatrixSet; | 217 bool fCoordChangeMatrixSet; |
218 SkMatrix fCoordChangeMatrix; | 218 SkMatrix fCoordChangeMatrix; |
219 SkAutoTUnref<const GrEffectRef> fEffectRef; | 219 SkAutoTUnref<const GrEffectRef> fEffectRef; |
220 int fVertexAttribIndices[2]; | 220 int fVertexAttribIndices[2]; |
221 }; | 221 }; |
222 | 222 |
223 #endif | 223 #endif |
OLD | NEW |