diff options
Diffstat (limited to 'gpu/src/GrStencilBuffer.cpp')
-rw-r--r-- | gpu/src/GrStencilBuffer.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gpu/src/GrStencilBuffer.cpp b/gpu/src/GrStencilBuffer.cpp new file mode 100644 index 0000000000..d004612d14 --- /dev/null +++ b/gpu/src/GrStencilBuffer.cpp @@ -0,0 +1,26 @@ + +/* + * Copyright 2011 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "GrStencilBuffer.h" + +#include "GrContext.h" +#include "GrGpu.h" + +void GrStencilBuffer::wasDetachedFromRenderTarget(const GrRenderTarget* rt) { + GrAssert(fRTAttachmentCnt > 0); + if (0 == --fRTAttachmentCnt && NULL != fCacheEntry) { + this->getGpu()->getContext()->unlockStencilBuffer(fCacheEntry); + // At this point we could be deleted! + } +} + +void GrStencilBuffer::transferToCacheAndLock() { + GrAssert(NULL == fCacheEntry); + fCacheEntry = + this->getGpu()->getContext()->addAndLockStencilBuffer(this); +} |