bsalomon@google.com | 558a75b | 2011-08-08 17:01:14 +0000 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * Copyright 2011 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
| 7 | */ |
| 8 | |
| 9 | #include "GrStencilBuffer.h" |
| 10 | |
| 11 | #include "GrContext.h" |
| 12 | #include "GrGpu.h" |
| 13 | |
| 14 | void GrStencilBuffer::wasDetachedFromRenderTarget(const GrRenderTarget* rt) { |
| 15 | GrAssert(fRTAttachmentCnt > 0); |
| 16 | if (0 == --fRTAttachmentCnt && NULL != fCacheEntry) { |
| 17 | this->getGpu()->getContext()->unlockStencilBuffer(fCacheEntry); |
| 18 | // At this point we could be deleted! |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | void GrStencilBuffer::transferToCacheAndLock() { |
| 23 | GrAssert(NULL == fCacheEntry); |
| 24 | fCacheEntry = |
| 25 | this->getGpu()->getContext()->addAndLockStencilBuffer(this); |
| 26 | } |