| 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 |
| 349 /// @} | 379 /// @} |
| 350 | 380 |
| 351 /////////////////////////////////////////////////////////////////////////// | 381 /////////////////////////////////////////////////////////////////////////// |
| 352 /// @name Blending | 382 /// @name Blending |
| 353 //// | 383 //// |
| 354 | 384 |
| 355 GrBlendCoeff getSrcBlendCoeff() const { return fSrcBlend; } | 385 GrBlendCoeff getSrcBlendCoeff() const { return fSrcBlend; } |
| 356 GrBlendCoeff getDstBlendCoeff() const { return fDstBlend; } | 386 GrBlendCoeff getDstBlendCoeff() const { return fDstBlend; } |
| 357 | 387 |
| 358 /** | 388 /** |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 mutable uint32_t fCachedCapsID; | 856 mutable uint32_t fCachedCapsID; |
| 827 | 857 |
| 828 friend class GrOptDrawState; | 858 friend class GrOptDrawState; |
| 829 | 859 |
| 830 typedef SkRefCnt INHERITED; | 860 typedef SkRefCnt INHERITED; |
| 831 }; | 861 }; |
| 832 | 862 |
| 833 GR_MAKE_BITFIELD_OPS(GrDrawState::BlendOptFlags); | 863 GR_MAKE_BITFIELD_OPS(GrDrawState::BlendOptFlags); |
| 834 | 864 |
| 835 #endif | 865 #endif |
| OLD | NEW |