Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: include/gpu/GrEffectStage.h

Issue 553973002: Remove debug-only ref of GrEffectStage (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: revert grrodrawstate.h Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 fCoordChangeMatrix.preConcat(matrix); 77 fCoordChangeMatrix.preConcat(matrix);
78 } else { 78 } else {
79 fCoordChangeMatrixSet = true; 79 fCoordChangeMatrixSet = true;
80 fCoordChangeMatrix = matrix; 80 fCoordChangeMatrix = matrix;
81 } 81 }
82 } 82 }
83 83
84 class SavedCoordChange { 84 class SavedCoordChange {
85 private: 85 private:
86 bool fCoordChangeMatrixSet; 86 bool fCoordChangeMatrixSet;
87 SkMatrix fCoordChangeMatrix; 87 SkMatrix fCoordChangeMatrix;
robertphillips 2014/09/08 15:38:09 mutable ? init to SK_InvalidUniqueID ?
88 SkDEBUGCODE(mutable SkAutoTUnref<const GrEffect> fEffect;) 88 SkDEBUGCODE(uint32_t fEffectUniqueID;)
89 89
90 friend class GrEffectStage; 90 friend class GrEffectStage;
91 }; 91 };
92 92
93 /** 93 /**
94 * This gets the current coordinate system change. It is the accumulation of 94 * This gets the current coordinate system change. It is the accumulation of
95 * localCoordChange calls since the effect was installed. It is used when th en caller 95 * localCoordChange calls since the effect was installed. It is used when th en caller
96 * wants to temporarily change the source geometry coord system, draw someth ing, and then 96 * wants to temporarily change the source geometry coord system, draw someth ing, and then
97 * restore the previous coord system (e.g. temporarily draw in device coords ). 97 * restore the previous coord system (e.g. temporarily draw in device coords ).
98 */ 98 */
99 void saveCoordChange(SavedCoordChange* savedCoordChange) const { 99 void saveCoordChange(SavedCoordChange* savedCoordChange) const {
100 savedCoordChange->fCoordChangeMatrixSet = fCoordChangeMatrixSet; 100 savedCoordChange->fCoordChangeMatrixSet = fCoordChangeMatrixSet;
101 if (fCoordChangeMatrixSet) { 101 if (fCoordChangeMatrixSet) {
102 savedCoordChange->fCoordChangeMatrix = fCoordChangeMatrix; 102 savedCoordChange->fCoordChangeMatrix = fCoordChangeMatrix;
103 } 103 }
robertphillips 2014/09/08 15:38:09 SkASSERT(SK_InvalidUniqueID == saveCoordChange->fE
104 SkASSERT(NULL == savedCoordChange->fEffect.get()); 104 SkDEBUGCODE(savedCoordChange->fEffectUniqueID = fEffect->getUniqueID();)
105 SkDEBUGCODE(SkRef(fEffect.get());)
106 SkDEBUGCODE(savedCoordChange->fEffect.reset(fEffect.get());)
107 } 105 }
108 106
109 /** 107 /**
110 * This balances the saveCoordChange call. 108 * This balances the saveCoordChange call.
111 */ 109 */
112 void restoreCoordChange(const SavedCoordChange& savedCoordChange) { 110 void restoreCoordChange(const SavedCoordChange& savedCoordChange) {
113 fCoordChangeMatrixSet = savedCoordChange.fCoordChangeMatrixSet; 111 fCoordChangeMatrixSet = savedCoordChange.fCoordChangeMatrixSet;
114 if (fCoordChangeMatrixSet) { 112 if (fCoordChangeMatrixSet) {
115 fCoordChangeMatrix = savedCoordChange.fCoordChangeMatrix; 113 fCoordChangeMatrix = savedCoordChange.fCoordChangeMatrix;
116 } 114 }
117 SkASSERT(savedCoordChange.fEffect.get() == fEffect); 115 SkASSERT(savedCoordChange.fEffectUniqueID == fEffect->getUniqueID());
robertphillips 2014/09/08 15:38:09 SkDEBUGCODE(savedCoordChange.fEffectUniqueID = SK_
118 SkDEBUGCODE(savedCoordChange.fEffect.reset(NULL);)
119 } 116 }
120 117
121 /** 118 /**
122 * Gets the matrix representing all changes of coordinate system since the G rEffect was 119 * Gets the matrix representing all changes of coordinate system since the G rEffect was
123 * installed in the stage. 120 * installed in the stage.
124 */ 121 */
125 const SkMatrix& getCoordChangeMatrix() const { 122 const SkMatrix& getCoordChangeMatrix() const {
126 if (fCoordChangeMatrixSet) { 123 if (fCoordChangeMatrixSet) {
127 return fCoordChangeMatrix; 124 return fCoordChangeMatrix;
128 } else { 125 } else {
129 return SkMatrix::I(); 126 return SkMatrix::I();
130 } 127 }
131 } 128 }
132 129
133 const GrEffect* getEffect() const { return fEffect.get(); } 130 const GrEffect* getEffect() const { return fEffect.get(); }
134 131
135 const int* getVertexAttribIndices() const { return fVertexAttribIndices; } 132 const int* getVertexAttribIndices() const { return fVertexAttribIndices; }
136 int getVertexAttribIndexCount() const { return fEffect->numVertexAttribs(); } 133 int getVertexAttribIndexCount() const { return fEffect->numVertexAttribs(); }
137 134
138 void convertToPendingExec() { fEffect.convertToPendingExec(); } 135 void convertToPendingExec() { fEffect.convertToPendingExec(); }
139 136
140 private: 137 private:
141 bool fCoordChangeMatrixSet; 138 bool fCoordChangeMatrixSet;
142 SkMatrix fCoordChangeMatrix; 139 SkMatrix fCoordChangeMatrix;
143 GrProgramElementRef<const GrEffect> fEffect; 140 GrProgramElementRef<const GrEffect> fEffect;
144 int fVertexAttribIndices[2]; 141 int fVertexAttribIndices[2];
145 }; 142 };
146 143
147 #endif 144 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698