OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 GrPipelineBuilder_DEFINED | 8 #ifndef GrPipelineBuilder_DEFINED |
9 #define GrPipelineBuilder_DEFINED | 9 #define GrPipelineBuilder_DEFINED |
10 | 10 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 /** | 107 /** |
108 * When this object is destroyed it will remove any color/coverage FPs from
the pipeline builder | 108 * When this object is destroyed it will remove any color/coverage FPs from
the pipeline builder |
109 * and also remove any additions to the GrProcessorDataManager that were add
ed after its | 109 * and also remove any additions to the GrProcessorDataManager that were add
ed after its |
110 * constructor. | 110 * constructor. |
111 * This class can transiently modify its "const" GrPipelineBuilder object bu
t will restore it | 111 * This class can transiently modify its "const" GrPipelineBuilder object bu
t will restore it |
112 * when done - so it is notionally "const" correct. | 112 * when done - so it is notionally "const" correct. |
113 */ | 113 */ |
114 class AutoRestoreFragmentProcessorState : public ::SkNoncopyable { | 114 class AutoRestoreFragmentProcessorState : public ::SkNoncopyable { |
115 public: | 115 public: |
116 AutoRestoreFragmentProcessorState() | 116 AutoRestoreFragmentProcessorState() |
117 : fPipelineBuilder(NULL) | 117 : fPipelineBuilder(nullptr) |
118 , fColorEffectCnt(0) | 118 , fColorEffectCnt(0) |
119 , fCoverageEffectCnt(0) | 119 , fCoverageEffectCnt(0) |
120 , fSaveMarker(0) {} | 120 , fSaveMarker(0) {} |
121 | 121 |
122 AutoRestoreFragmentProcessorState(const GrPipelineBuilder& ds) | 122 AutoRestoreFragmentProcessorState(const GrPipelineBuilder& ds) |
123 : fPipelineBuilder(NULL) | 123 : fPipelineBuilder(nullptr) |
124 , fColorEffectCnt(0) | 124 , fColorEffectCnt(0) |
125 , fCoverageEffectCnt(0) | 125 , fCoverageEffectCnt(0) |
126 , fSaveMarker(0) { | 126 , fSaveMarker(0) { |
127 this->set(&ds); | 127 this->set(&ds); |
128 } | 128 } |
129 | 129 |
130 ~AutoRestoreFragmentProcessorState() { this->set(NULL); } | 130 ~AutoRestoreFragmentProcessorState() { this->set(nullptr); } |
131 | 131 |
132 void set(const GrPipelineBuilder* ds); | 132 void set(const GrPipelineBuilder* ds); |
133 | 133 |
134 bool isSet() const { return SkToBool(fPipelineBuilder); } | 134 bool isSet() const { return SkToBool(fPipelineBuilder); } |
135 | 135 |
136 GrProcessorDataManager* getProcessorDataManager() { | 136 GrProcessorDataManager* getProcessorDataManager() { |
137 SkASSERT(this->isSet()); | 137 SkASSERT(this->isSet()); |
138 return fPipelineBuilder->getProcessorDataManager(); | 138 return fPipelineBuilder->getProcessorDataManager(); |
139 } | 139 } |
140 | 140 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 | 250 |
251 /** | 251 /** |
252 * AutoRestoreStencil | 252 * AutoRestoreStencil |
253 * | 253 * |
254 * This simple struct saves and restores the stencil settings | 254 * This simple struct saves and restores the stencil settings |
255 * This class can transiently modify its "const" GrPipelineBuilder object bu
t will restore it | 255 * This class can transiently modify its "const" GrPipelineBuilder object bu
t will restore it |
256 * when done - so it is notionally "const" correct. | 256 * when done - so it is notionally "const" correct. |
257 */ | 257 */ |
258 class AutoRestoreStencil : public ::SkNoncopyable { | 258 class AutoRestoreStencil : public ::SkNoncopyable { |
259 public: | 259 public: |
260 AutoRestoreStencil() : fPipelineBuilder(NULL) {} | 260 AutoRestoreStencil() : fPipelineBuilder(nullptr) {} |
261 | 261 |
262 AutoRestoreStencil(const GrPipelineBuilder& ds) : fPipelineBuilder(NULL)
{ this->set(&ds); } | 262 AutoRestoreStencil(const GrPipelineBuilder& ds) : fPipelineBuilder(nullp
tr) { this->set(&ds); } |
263 | 263 |
264 ~AutoRestoreStencil() { this->set(NULL); } | 264 ~AutoRestoreStencil() { this->set(nullptr); } |
265 | 265 |
266 void set(const GrPipelineBuilder* ds) { | 266 void set(const GrPipelineBuilder* ds) { |
267 if (fPipelineBuilder) { | 267 if (fPipelineBuilder) { |
268 fPipelineBuilder->setStencil(fStencilSettings); | 268 fPipelineBuilder->setStencil(fStencilSettings); |
269 } | 269 } |
270 fPipelineBuilder = const_cast<GrPipelineBuilder*>(ds); | 270 fPipelineBuilder = const_cast<GrPipelineBuilder*>(ds); |
271 if (ds) { | 271 if (ds) { |
272 fStencilSettings = ds->getStencil(); | 272 fStencilSettings = ds->getStencil(); |
273 } | 273 } |
274 } | 274 } |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 FragmentProcessorArray fCoverageFragmentProcessors; | 448 FragmentProcessorArray fCoverageFragmentProcessors; |
449 GrClip fClip; | 449 GrClip fClip; |
450 | 450 |
451 mutable GrProcOptInfo fColorProcInfo; | 451 mutable GrProcOptInfo fColorProcInfo; |
452 mutable GrProcOptInfo fCoverageProcInfo; | 452 mutable GrProcOptInfo fCoverageProcInfo; |
453 | 453 |
454 friend class GrPipeline; | 454 friend class GrPipeline; |
455 }; | 455 }; |
456 | 456 |
457 #endif | 457 #endif |
OLD | NEW |