| 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 | 
| 11 #include "GrBackendEffectFactory.h" | 11 #include "GrBackendEffectFactory.h" | 
| 12 #include "GrBlend.h" | 12 #include "GrBlend.h" | 
| 13 #include "GrColor.h" | 13 #include "GrColor.h" | 
| 14 #include "GrEffectStage.h" | 14 #include "GrEffectStage.h" | 
| 15 #include "GrPaint.h" | 15 #include "GrPaint.h" | 
| 16 #include "GrPoint.h" | 16 #include "GrPoint.h" | 
| 17 #include "GrRefCnt.h" |  | 
| 18 #include "GrRenderTarget.h" | 17 #include "GrRenderTarget.h" | 
| 19 #include "GrStencil.h" | 18 #include "GrStencil.h" | 
| 20 #include "GrTemplates.h" | 19 #include "GrTemplates.h" | 
| 21 #include "GrTexture.h" | 20 #include "GrTexture.h" | 
| 22 #include "GrTypesPriv.h" | 21 #include "GrTypesPriv.h" | 
| 23 #include "effects/GrSimpleTextureEffect.h" | 22 #include "effects/GrSimpleTextureEffect.h" | 
| 24 | 23 | 
| 25 #include "SkMatrix.h" | 24 #include "SkMatrix.h" | 
| 26 #include "SkXfermode.h" | 25 #include "SkXfermode.h" | 
| 27 | 26 | 
| 28 class GrDrawState : public GrRefCnt { | 27 class GrDrawState : public SkRefCnt { | 
| 29 public: | 28 public: | 
| 30     SK_DECLARE_INST_COUNT(GrDrawState) | 29     SK_DECLARE_INST_COUNT(GrDrawState) | 
| 31 | 30 | 
| 32     GrDrawState() { | 31     GrDrawState() { | 
| 33         SkDEBUGCODE(fBlockEffectRemovalCnt = 0;) | 32         SkDEBUGCODE(fBlockEffectRemovalCnt = 0;) | 
| 34         this->reset(); | 33         this->reset(); | 
| 35     } | 34     } | 
| 36 | 35 | 
| 37     GrDrawState(const SkMatrix& initialViewMatrix) { | 36     GrDrawState(const SkMatrix& initialViewMatrix) { | 
| 38         SkDEBUGCODE(fBlockEffectRemovalCnt = 0;) | 37         SkDEBUGCODE(fBlockEffectRemovalCnt = 0;) | 
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 668             fSavedTarget = NULL; | 667             fSavedTarget = NULL; | 
| 669             this->set(ds, newTarget); | 668             this->set(ds, newTarget); | 
| 670         } | 669         } | 
| 671         ~AutoRenderTargetRestore() { this->restore(); } | 670         ~AutoRenderTargetRestore() { this->restore(); } | 
| 672 | 671 | 
| 673         void restore() { | 672         void restore() { | 
| 674             if (NULL != fDrawState) { | 673             if (NULL != fDrawState) { | 
| 675                 fDrawState->setRenderTarget(fSavedTarget); | 674                 fDrawState->setRenderTarget(fSavedTarget); | 
| 676                 fDrawState = NULL; | 675                 fDrawState = NULL; | 
| 677             } | 676             } | 
| 678             GrSafeSetNull(fSavedTarget); | 677             SkSafeSetNull(fSavedTarget); | 
| 679         } | 678         } | 
| 680 | 679 | 
| 681         void set(GrDrawState* ds, GrRenderTarget* newTarget) { | 680         void set(GrDrawState* ds, GrRenderTarget* newTarget) { | 
| 682             this->restore(); | 681             this->restore(); | 
| 683 | 682 | 
| 684             if (NULL != ds) { | 683             if (NULL != ds) { | 
| 685                 SkASSERT(NULL == fSavedTarget); | 684                 SkASSERT(NULL == fSavedTarget); | 
| 686                 fSavedTarget = ds->getRenderTarget(); | 685                 fSavedTarget = ds->getRenderTarget(); | 
| 687                 SkSafeRef(fSavedTarget); | 686                 SkSafeRef(fSavedTarget); | 
| 688                 ds->setRenderTarget(newTarget); | 687                 ds->setRenderTarget(newTarget); | 
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1070     SkDEBUGCODE(int fBlockEffectRemovalCnt;) | 1069     SkDEBUGCODE(int fBlockEffectRemovalCnt;) | 
| 1071 | 1070 | 
| 1072     /** | 1071     /** | 
| 1073      *  Sets vertex attributes for next draw. | 1072      *  Sets vertex attributes for next draw. | 
| 1074      * | 1073      * | 
| 1075      *  @param attribs    the array of vertex attributes to set. | 1074      *  @param attribs    the array of vertex attributes to set. | 
| 1076      *  @param count      the number of attributes being set, limited to kMaxVer
      texAttribCnt. | 1075      *  @param count      the number of attributes being set, limited to kMaxVer
      texAttribCnt. | 
| 1077      */ | 1076      */ | 
| 1078     void setVertexAttribs(const GrVertexAttrib attribs[], int count); | 1077     void setVertexAttribs(const GrVertexAttrib attribs[], int count); | 
| 1079 | 1078 | 
| 1080     typedef GrRefCnt INHERITED; | 1079     typedef SkRefCnt INHERITED; | 
| 1081 }; | 1080 }; | 
| 1082 | 1081 | 
| 1083 GR_MAKE_BITFIELD_OPS(GrDrawState::BlendOptFlags); | 1082 GR_MAKE_BITFIELD_OPS(GrDrawState::BlendOptFlags); | 
| 1084 | 1083 | 
| 1085 #endif | 1084 #endif | 
| OLD | NEW | 
|---|