| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright 2014 Google Inc. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license that can be | |
| 5 * found in the LICENSE file. | |
| 6 */ | |
| 7 | |
| 8 #ifndef GrPendingProcessorStage_DEFINED | |
| 9 #define GrPendingProcessorStage_DEFINED | |
| 10 | |
| 11 #include "GrFragmentStage.h" | |
| 12 #include "GrCoordTransform.h" | |
| 13 #include "GrFragmentProcessor.h" | |
| 14 #include "GrPendingProgramElement.h" | |
| 15 | |
| 16 /** | |
| 17 * This a baked variant of GrFragmentStage, as recorded in GrOptDrawState. | |
| 18 */ | |
| 19 class GrPendingFragmentStage { | |
| 20 public: | |
| 21 GrPendingFragmentStage(const GrFragmentStage& stage) : fProc(stage.processor
()) {} | |
| 22 | |
| 23 GrPendingFragmentStage(const GrPendingFragmentStage& that) { *this = that; } | |
| 24 | |
| 25 GrPendingFragmentStage& operator=(const GrPendingFragmentStage& that) { | |
| 26 fProc.reset(that.fProc.get()); | |
| 27 return *this; | |
| 28 } | |
| 29 | |
| 30 bool operator==(const GrPendingFragmentStage& that) const { | |
| 31 return this->processor()->isEqual(*that.processor()); | |
| 32 } | |
| 33 | |
| 34 bool operator!=(const GrPendingFragmentStage& that) const { return !(*this =
= that); } | |
| 35 | |
| 36 /** | |
| 37 * For a coord transform on the fragment processor, does it or the coord cha
nge matrix (if | |
| 38 * relevant) contain perspective? | |
| 39 */ | |
| 40 bool isPerspectiveCoordTransform(int matrixIndex) const { | |
| 41 const GrCoordTransform& coordTransform = this->processor()->coordTransfo
rm(matrixIndex); | |
| 42 uint32_t type = coordTransform.getMatrix().getType(); | |
| 43 return SkToBool(SkMatrix::kPerspective_Mask & type); | |
| 44 } | |
| 45 | |
| 46 const char* name() const { return fProc->name(); } | |
| 47 | |
| 48 const GrFragmentProcessor* processor() const { return fProc.get(); } | |
| 49 | |
| 50 protected: | |
| 51 GrPendingProgramElement<const GrFragmentProcessor> fProc; | |
| 52 }; | |
| 53 #endif | |
| OLD | NEW |