blob: d004612d1431157d9d131354213a4a8a69548af0 [file] [log] [blame]
bsalomon@google.com558a75b2011-08-08 17:01:14 +00001
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
14void 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
22void GrStencilBuffer::transferToCacheAndLock() {
23 GrAssert(NULL == fCacheEntry);
24 fCacheEntry =
25 this->getGpu()->getContext()->addAndLockStencilBuffer(this);
26}