diff options
author | 2012-06-13 18:49:30 +0000 | |
---|---|---|
committer | 2012-06-13 18:49:30 +0000 | |
commit | 972265db219ce25b5159879c75e6c62efaf0fa79 (patch) | |
tree | 7e6315d9224f44c3a7df0f5cf941c4e4583cb69c /src/gpu/GrDrawState.h | |
parent | fedd09ba7e218116df8a676069726de6e9d35277 (diff) |
releaseTextures portion of GrDrawState Ref textures CL (http://codereview.appspot.com/6251049/)
http://codereview.appspot.com/6299081/
git-svn-id: http://skia.googlecode.com/svn/trunk@4254 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/GrDrawState.h')
-rw-r--r-- | src/gpu/GrDrawState.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h index 55bd04c87e..e77b63ad81 100644 --- a/src/gpu/GrDrawState.h +++ b/src/gpu/GrDrawState.h @@ -205,6 +205,27 @@ public: return fTextures[stage]; } + /** + * Release all the textures referred to by this draw state + */ + void releaseTextures() { + for (int i = 0; i < kNumStages; ++i) { + this->setTexture(i, NULL); + } + } + + class AutoTextureRelease : public ::GrNoncopyable { + public: + AutoTextureRelease(GrDrawState* ds) : fDrawState(ds) {} + ~AutoTextureRelease() { + if (NULL != fDrawState) { + fDrawState->releaseTextures(); + } + } + private: + GrDrawState* fDrawState; + }; + /// @} /////////////////////////////////////////////////////////////////////////// |