| 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 |
| 34 GrProcessorStage(const GrProcessorStage& other) { | 36 GrProcessorStage(const GrProcessorStage& other) { |
| 35 fCoordChangeMatrixSet = other.fCoordChangeMatrixSet; | 37 fCoordChangeMatrixSet = other.fCoordChangeMatrixSet; |
| 36 if (other.fCoordChangeMatrixSet) { | 38 if (other.fCoordChangeMatrixSet) { |
| 37 fCoordChangeMatrix = other.fCoordChangeMatrix; | 39 fCoordChangeMatrix = other.fCoordChangeMatrix; |
| 38 } | 40 } |
| 39 fProc.initAndRef(other.fProc); | 41 fProc.initAndRef(other.fProc); |
| 40 } | 42 } |
| 41 | 43 |
| 42 static bool AreCompatible(const GrProcessorStage& a, const GrProcessorStage&
b, | 44 static bool AreCompatible(const GrProcessorStage& a, const GrProcessorStage&
b, |
| 43 bool usingExplicitLocalCoords) { | 45 bool usingExplicitLocalCoords) { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 } | 142 } |
| 141 | 143 |
| 142 int combinedTypes = type0 | type1; | 144 int combinedTypes = type0 | type1; |
| 143 if (SkMatrix::kPerspective_Mask & combinedTypes) { | 145 if (SkMatrix::kPerspective_Mask & combinedTypes) { |
| 144 return true; | 146 return true; |
| 145 } else { | 147 } else { |
| 146 return false; | 148 return false; |
| 147 } | 149 } |
| 148 } | 150 } |
| 149 | 151 |
| 150 const GrProcessor* getProcessor() const { return fProc.get(); } | 152 virtual const GrProcessor* getProcessor() const = 0; |
| 151 | 153 |
| 152 void convertToPendingExec() { fProc.convertToPendingExec(); } | 154 void convertToPendingExec() { fProc.convertToPendingExec(); } |
| 153 | 155 |
| 154 private: | 156 protected: |
| 155 bool fCoordChangeMatrixSet; | 157 bool fCoordChangeMatrixSet; |
| 156 SkMatrix fCoordChangeMatrix; | 158 SkMatrix fCoordChangeMatrix; |
| 157 GrProgramElementRef<const GrProcessor> fProc; | 159 GrProgramElementRef<const GrProcessor> fProc; |
| 158 }; | 160 }; |
| 159 | 161 |
| 160 class GrFragmentStage : public GrProcessorStage { | 162 class GrFragmentStage : public GrProcessorStage { |
| 161 public: | 163 public: |
| 162 GrFragmentStage(const GrFragmentProcessor* fp) : GrProcessorStage(fp) {} | 164 GrFragmentStage(const GrFragmentProcessor* fp) : GrProcessorStage(fp) {} |
| 163 | 165 |
| 164 const GrFragmentProcessor* getFragmentProcessor() const { | 166 virtual const GrFragmentProcessor* getProcessor() const { |
| 165 return static_cast<const GrFragmentProcessor*>(this->getProcessor()); | 167 return static_cast<const GrFragmentProcessor*>(fProc.get()); |
| 166 } | 168 } |
| 169 |
| 170 typedef GrFragmentProcessor Processor; |
| 171 typedef GrGLFragmentProcessor GLProcessor; |
| 167 }; | 172 }; |
| 168 | 173 |
| 169 class GrGeometryStage : public GrProcessorStage { | 174 class GrGeometryStage : public GrProcessorStage { |
| 170 public: | 175 public: |
| 171 GrGeometryStage(const GrGeometryProcessor* gp) : GrProcessorStage(gp) {} | 176 GrGeometryStage(const GrGeometryProcessor* gp) : GrProcessorStage(gp) {} |
| 172 | 177 |
| 173 const GrGeometryProcessor* getGeometryProcessor() const { | 178 virtual const GrGeometryProcessor* getProcessor() const { |
| 174 return static_cast<const GrGeometryProcessor*>(this->getProcessor()); | 179 return static_cast<const GrGeometryProcessor*>(fProc.get()); |
| 175 } | 180 } |
| 181 |
| 182 typedef GrGeometryProcessor Processor; |
| 183 typedef GrGLGeometryProcessor GLProcessor; |
| 176 }; | 184 }; |
| 177 | 185 |
| 178 #endif | 186 #endif |
| OLD | NEW |