aboutsummaryrefslogtreecommitdiffhomepage
path: root/gpu/src/GrStencilBuffer.cpp
blob: d004612d1431157d9d131354213a4a8a69548af0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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);
}