OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrPendingProcessorStage_DEFINED | 8 #ifndef GrPendingFragmentStage_DEFINED |
9 #define GrPendingProcessorStage_DEFINED | 9 #define GrPendingFragmentStage_DEFINED |
10 | 10 |
11 #include "GrFragmentStage.h" | 11 #include "GrStagedProcessor.h" |
12 #include "GrCoordTransform.h" | |
13 #include "GrFragmentProcessor.h" | |
14 #include "GrPendingProgramElement.h" | 12 #include "GrPendingProgramElement.h" |
15 | 13 |
16 /** | 14 /** |
17 * This a baked variant of GrFragmentStage, as recorded in GrOptDrawState. | 15 * This a baked variant of GrFragmentStage, as recorded in GrPipeline |
18 */ | 16 */ |
19 class GrPendingFragmentStage { | 17 class GrPendingFragmentStage : public GrStagedProcessor<GrPendingProgramElement>
{ |
20 public: | 18 public: |
21 GrPendingFragmentStage(const GrFragmentStage& stage) : fProc(stage.processor
()) {} | 19 GrPendingFragmentStage(const GrFragmentStage& stage) { |
22 | 20 INHERITED::fProc.reset(stage.processor()); |
23 GrPendingFragmentStage(const GrPendingFragmentStage& that) { *this = that; } | |
24 | |
25 GrPendingFragmentStage& operator=(const GrPendingFragmentStage& that) { | |
26 fProc.reset(that.fProc.get()); | |
27 return *this; | |
28 } | 21 } |
29 | 22 |
30 bool operator==(const GrPendingFragmentStage& that) const { | 23 private: |
31 return this->processor()->isEqual(*that.processor()); | 24 typedef GrStagedProcessor<GrPendingProgramElement> INHERITED; |
32 } | 25 }; |
33 | 26 |
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 | 27 #endif |
OLD | NEW |