OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 GrDrawState_DEFINED | 8 #ifndef GrDrawState_DEFINED |
9 #define GrDrawState_DEFINED | 9 #define GrDrawState_DEFINED |
10 | 10 |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
339 | 339 |
340 bool isSet() const { return SkToBool(fDrawState); } | 340 bool isSet() const { return SkToBool(fDrawState); } |
341 | 341 |
342 private: | 342 private: |
343 GrDrawState* fDrawState; | 343 GrDrawState* fDrawState; |
344 uint32_t fOriginalGPID; | 344 uint32_t fOriginalGPID; |
345 int fColorEffectCnt; | 345 int fColorEffectCnt; |
346 int fCoverageEffectCnt; | 346 int fCoverageEffectCnt; |
347 }; | 347 }; |
348 | 348 |
349 /** | |
350 * AutoRestoreStencil | |
351 * | |
352 * This simple struct saves and restores the stencil settings | |
353 */ | |
354 class AutoRestoreStencil : public ::SkNoncopyable { | |
355 public: | |
356 AutoRestoreStencil() | |
357 : fDrawState(NULL) {} | |
bsalomon
2014/10/24 21:04:38
can put the two cons each on one line if you want
| |
358 | |
359 AutoRestoreStencil(GrDrawState* ds) | |
360 : fDrawState(NULL) { this->set(ds); } | |
361 | |
362 ~AutoRestoreStencil() { this->set(NULL); } | |
363 | |
364 void set(GrDrawState* ds) { | |
365 if (fDrawState) { | |
366 fDrawState->setStencil(fStencilSettings); | |
367 } | |
368 fDrawState = ds; | |
369 if (ds) { | |
370 fStencilSettings = ds->getStencil(); | |
371 } | |
372 } | |
373 | |
374 bool isSet() const { return SkToBool(fDrawState); } | |
375 | |
376 private: | |
377 GrDrawState* fDrawState; | |
378 GrStencilSettings fStencilSettings; | |
379 }; | |
380 | |
349 /// @} | 381 /// @} |
350 | 382 |
351 /////////////////////////////////////////////////////////////////////////// | 383 /////////////////////////////////////////////////////////////////////////// |
352 /// @name Blending | 384 /// @name Blending |
353 //// | 385 //// |
354 | 386 |
355 GrBlendCoeff getSrcBlendCoeff() const { return fSrcBlend; } | 387 GrBlendCoeff getSrcBlendCoeff() const { return fSrcBlend; } |
356 GrBlendCoeff getDstBlendCoeff() const { return fDstBlend; } | 388 GrBlendCoeff getDstBlendCoeff() const { return fDstBlend; } |
357 | 389 |
358 /** | 390 /** |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
826 mutable uint32_t fCachedCapsID; | 858 mutable uint32_t fCachedCapsID; |
827 | 859 |
828 friend class GrOptDrawState; | 860 friend class GrOptDrawState; |
829 | 861 |
830 typedef SkRefCnt INHERITED; | 862 typedef SkRefCnt INHERITED; |
831 }; | 863 }; |
832 | 864 |
833 GR_MAKE_BITFIELD_OPS(GrDrawState::BlendOptFlags); | 865 GR_MAKE_BITFIELD_OPS(GrDrawState::BlendOptFlags); |
834 | 866 |
835 #endif | 867 #endif |
OLD | NEW |