aboutsummaryrefslogtreecommitdiffhomepage
path: root/gpu/src/GrStencilBuffer.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-08-08 17:01:14 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-08-08 17:01:14 +0000
commit558a75bcb323c03dd7482555c7214062a363276f (patch)
tree97f1d503a021a607f9d0776315b584b9e1b4cd1b /gpu/src/GrStencilBuffer.cpp
parentf121b0525485fb18e96c4b9dbc57594c430e42f4 (diff)
Use a single stencil buffer for a given width,height,samplecount
Review URL: http://codereview.appspot.com/4854044/ git-svn-id: http://skia.googlecode.com/svn/trunk@2061 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gpu/src/GrStencilBuffer.cpp')
-rw-r--r--gpu/src/GrStencilBuffer.cpp26
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);
+}