| 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() : fDrawState(NULL) {} | |
| 357 | |
| 358 AutoRestoreStencil(GrDrawState* ds) : fDrawState(NULL) { this->set(ds);
} | |
| 359 | |
| 360 ~AutoRestoreStencil() { this->set(NULL); } | |
| 361 | |
| 362 void set(GrDrawState* ds) { | |
| 363 if (fDrawState) { | |
| 364 fDrawState->setStencil(fStencilSettings); | |
| 365 } | |
| 366 fDrawState = ds; | |
| 367 if (ds) { | |
| 368 fStencilSettings = ds->getStencil(); | |
| 369 } | |
| 370 } | |
| 371 | |
| 372 bool isSet() const { return SkToBool(fDrawState); } | |
| 373 | |
| 374 private: | |
| 375 GrDrawState* fDrawState; | |
| 376 GrStencilSettings fStencilSettings; | |
| 377 }; | |
| 378 | |
| 379 /// @} | 349 /// @} |
| 380 | 350 |
| 381 /////////////////////////////////////////////////////////////////////////// | 351 /////////////////////////////////////////////////////////////////////////// |
| 382 /// @name Blending | 352 /// @name Blending |
| 383 //// | 353 //// |
| 384 | 354 |
| 385 GrBlendCoeff getSrcBlendCoeff() const { return fSrcBlend; } | 355 GrBlendCoeff getSrcBlendCoeff() const { return fSrcBlend; } |
| 386 GrBlendCoeff getDstBlendCoeff() const { return fDstBlend; } | 356 GrBlendCoeff getDstBlendCoeff() const { return fDstBlend; } |
| 387 | 357 |
| 388 /** | 358 /** |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 mutable uint32_t fCachedCapsID; | 826 mutable uint32_t fCachedCapsID; |
| 857 | 827 |
| 858 friend class GrOptDrawState; | 828 friend class GrOptDrawState; |
| 859 | 829 |
| 860 typedef SkRefCnt INHERITED; | 830 typedef SkRefCnt INHERITED; |
| 861 }; | 831 }; |
| 862 | 832 |
| 863 GR_MAKE_BITFIELD_OPS(GrDrawState::BlendOptFlags); | 833 GR_MAKE_BITFIELD_OPS(GrDrawState::BlendOptFlags); |
| 864 | 834 |
| 865 #endif | 835 #endif |
| OLD | NEW |