| 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 #include "SkMatrix.h" | 
|  | 16 | 
|  | 17 /** | 
|  | 18  * This a baked variant of GrFragmentStage, as recorded in GrOptDrawState. | 
|  | 19  */ | 
|  | 20 class GrPendingFragmentStage { | 
|  | 21 public: | 
|  | 22     GrPendingFragmentStage(const GrFragmentStage& stage, bool ignoreMatrix) | 
|  | 23     : fProc(stage.getProcessor()) | 
|  | 24     , fCoordChangeMatrix(ignoreMatrix ? SkMatrix::I() : stage.getCoordChangeMatr
    ix()) { | 
|  | 25     } | 
|  | 26 | 
|  | 27     GrPendingFragmentStage(const GrPendingFragmentStage& that) { *this = that; } | 
|  | 28 | 
|  | 29     GrPendingFragmentStage& operator=(const GrPendingFragmentStage& that) { | 
|  | 30         fProc.reset(that.fProc.get()); | 
|  | 31         fCoordChangeMatrix = that.fCoordChangeMatrix; | 
|  | 32         return *this; | 
|  | 33     } | 
|  | 34 | 
|  | 35     bool operator==(const GrPendingFragmentStage& that) const { | 
|  | 36         return this->getProcessor()->isEqual(*that.getProcessor()) && | 
|  | 37                fCoordChangeMatrix == that.fCoordChangeMatrix; | 
|  | 38     } | 
|  | 39 | 
|  | 40     bool operator!=(const GrPendingFragmentStage& that) const { return !(*this =
    = that); } | 
|  | 41 | 
|  | 42     const SkMatrix& getCoordChangeMatrix() const { return fCoordChangeMatrix; } | 
|  | 43 | 
|  | 44     /** | 
|  | 45      * For a coord transform on the fragment processor, does it or the coord cha
    nge matrix (if | 
|  | 46      * relevant) contain perspective? | 
|  | 47      */ | 
|  | 48     bool isPerspectiveCoordTransform(int matrixIndex) const { | 
|  | 49         const GrCoordTransform& coordTransform = this->getProcessor()->coordTran
    sform(matrixIndex); | 
|  | 50         uint32_t type = coordTransform.getMatrix().getType(); | 
|  | 51         if (kLocal_GrCoordSet == coordTransform.sourceCoords()) { | 
|  | 52             type |= this->getCoordChangeMatrix().getType(); | 
|  | 53         } | 
|  | 54 | 
|  | 55         return SkToBool(SkMatrix::kPerspective_Mask & type); | 
|  | 56     } | 
|  | 57 | 
|  | 58     const char* name() const { return fProc->name(); } | 
|  | 59 | 
|  | 60     const GrFragmentProcessor* getProcessor() const { return fProc.get(); } | 
|  | 61 | 
|  | 62 protected: | 
|  | 63     GrPendingProgramElement<const GrFragmentProcessor>  fProc; | 
|  | 64     SkMatrix                                            fCoordChangeMatrix; | 
|  | 65 }; | 
|  | 66 #endif | 
| OLD | NEW | 
|---|