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 13 matching lines...) Expand all Loading... |
24 // is immutable, and only owns pending execution refs. This requries removing th
e common base | 24 // is immutable, and only owns pending execution refs. This requries removing th
e common base |
25 // class from GrDrawState and GrOptDrawState called GrRODrawState and converting
to GrOptDrawState | 25 // class from GrDrawState and GrOptDrawState called GrRODrawState and converting
to GrOptDrawState |
26 // when draws are enqueued in the GrInOrderDrawBuffer. | 26 // when draws are enqueued in the GrInOrderDrawBuffer. |
27 class GrProcessorStage { | 27 class GrProcessorStage { |
28 public: | 28 public: |
29 explicit GrProcessorStage(const GrProcessor* proc) | 29 explicit GrProcessorStage(const GrProcessor* proc) |
30 : fProc(SkRef(proc)) { | 30 : fProc(SkRef(proc)) { |
31 fCoordChangeMatrixSet = false; | 31 fCoordChangeMatrixSet = false; |
32 } | 32 } |
33 | 33 |
34 virtual ~GrProcessorStage() {} | |
35 | |
36 GrProcessorStage(const GrProcessorStage& other) { | 34 GrProcessorStage(const GrProcessorStage& other) { |
37 fCoordChangeMatrixSet = other.fCoordChangeMatrixSet; | 35 fCoordChangeMatrixSet = other.fCoordChangeMatrixSet; |
38 if (other.fCoordChangeMatrixSet) { | 36 if (other.fCoordChangeMatrixSet) { |
39 fCoordChangeMatrix = other.fCoordChangeMatrix; | 37 fCoordChangeMatrix = other.fCoordChangeMatrix; |
40 } | 38 } |
41 fProc.initAndRef(other.fProc); | 39 fProc.initAndRef(other.fProc); |
42 } | 40 } |
43 | 41 |
44 static bool AreCompatible(const GrProcessorStage& a, const GrProcessorStage&
b, | 42 static bool AreCompatible(const GrProcessorStage& a, const GrProcessorStage&
b, |
45 bool usingExplicitLocalCoords) { | 43 bool usingExplicitLocalCoords) { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 } | 140 } |
143 | 141 |
144 int combinedTypes = type0 | type1; | 142 int combinedTypes = type0 | type1; |
145 if (SkMatrix::kPerspective_Mask & combinedTypes) { | 143 if (SkMatrix::kPerspective_Mask & combinedTypes) { |
146 return true; | 144 return true; |
147 } else { | 145 } else { |
148 return false; | 146 return false; |
149 } | 147 } |
150 } | 148 } |
151 | 149 |
152 virtual const GrProcessor* getProcessor() const = 0; | 150 const GrProcessor* getProcessor() const { return fProc.get(); } |
153 | 151 |
154 void convertToPendingExec() { fProc.convertToPendingExec(); } | 152 void convertToPendingExec() { fProc.convertToPendingExec(); } |
155 | 153 |
156 protected: | 154 private: |
157 bool fCoordChangeMatrixSet; | 155 bool fCoordChangeMatrixSet; |
158 SkMatrix fCoordChangeMatrix; | 156 SkMatrix fCoordChangeMatrix; |
159 GrProgramElementRef<const GrProcessor> fProc; | 157 GrProgramElementRef<const GrProcessor> fProc; |
160 }; | 158 }; |
161 | 159 |
162 class GrFragmentStage : public GrProcessorStage { | 160 class GrFragmentStage : public GrProcessorStage { |
163 public: | 161 public: |
164 GrFragmentStage(const GrFragmentProcessor* fp) : GrProcessorStage(fp) {} | 162 GrFragmentStage(const GrFragmentProcessor* fp) : GrProcessorStage(fp) {} |
165 | 163 |
166 virtual const GrFragmentProcessor* getProcessor() const { | 164 const GrFragmentProcessor* getFragmentProcessor() const { |
167 return static_cast<const GrFragmentProcessor*>(fProc.get()); | 165 return static_cast<const GrFragmentProcessor*>(this->getProcessor()); |
168 } | 166 } |
169 | |
170 typedef GrFragmentProcessor Processor; | |
171 typedef GrGLFragmentProcessor GLProcessor; | |
172 }; | 167 }; |
173 | 168 |
174 class GrGeometryStage : public GrProcessorStage { | 169 class GrGeometryStage : public GrProcessorStage { |
175 public: | 170 public: |
176 GrGeometryStage(const GrGeometryProcessor* gp) : GrProcessorStage(gp) {} | 171 GrGeometryStage(const GrGeometryProcessor* gp) : GrProcessorStage(gp) {} |
177 | 172 |
178 virtual const GrGeometryProcessor* getProcessor() const { | 173 const GrGeometryProcessor* getGeometryProcessor() const { |
179 return static_cast<const GrGeometryProcessor*>(fProc.get()); | 174 return static_cast<const GrGeometryProcessor*>(this->getProcessor()); |
180 } | 175 } |
181 | |
182 typedef GrGeometryProcessor Processor; | |
183 typedef GrGLGeometryProcessor GLProcessor; | |
184 }; | 176 }; |
185 | 177 |
186 #endif | 178 #endif |
OLD | NEW |