Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Unified Diff: src/gpu/GrRenderTarget.cpp

Issue 938383004: Dynamically create stencil buffer when needed. (Closed) Base URL: https://skia.googlesource.com/skia.git@bigstencil
Patch Set: Actually save file before uploading Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrGpu.cpp ('k') | src/gpu/GrRenderTargetPriv.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrRenderTarget.cpp
diff --git a/src/gpu/GrRenderTarget.cpp b/src/gpu/GrRenderTarget.cpp
index 386bd2e779926e888f1edb87f33682827cc9691d..042e19f6ad6745ea1da528ccfd50d00b19e562ec 100644
--- a/src/gpu/GrRenderTarget.cpp
+++ b/src/gpu/GrRenderTarget.cpp
@@ -11,6 +11,7 @@
#include "GrContext.h"
#include "GrGpu.h"
+#include "GrRenderTargetPriv.h"
#include "GrStencilBuffer.h"
void GrRenderTarget::discard() {
@@ -46,18 +47,30 @@ void GrRenderTarget::overrideResolveRect(const SkIRect rect) {
}
}
-void GrRenderTarget::setStencilBuffer(GrStencilBuffer* stencilBuffer) {
- SkRefCnt_SafeAssign(fStencilBuffer, stencilBuffer);
-}
-
void GrRenderTarget::onRelease() {
- this->setStencilBuffer(NULL);
+ this->renderTargetPriv().didAttachStencilBuffer(NULL);
INHERITED::onRelease();
}
void GrRenderTarget::onAbandon() {
- this->setStencilBuffer(NULL);
+ this->renderTargetPriv().didAttachStencilBuffer(NULL);
INHERITED::onAbandon();
}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void GrRenderTargetPriv::didAttachStencilBuffer(GrStencilBuffer* stencilBuffer) {
+ SkRefCnt_SafeAssign(fRenderTarget->fStencilBuffer, stencilBuffer);
+}
+
+GrStencilBuffer* GrRenderTargetPriv::attachStencilBuffer() const {
+ if (fRenderTarget->fStencilBuffer) {
+ return fRenderTarget->fStencilBuffer;
+ }
+ if (!fRenderTarget->wasDestroyed() && fRenderTarget->canAttemptStencilAttachment()) {
+ fRenderTarget->getGpu()->attachStencilBufferToRenderTarget(fRenderTarget);
+ }
+ return fRenderTarget->fStencilBuffer;
+}
« no previous file with comments | « src/gpu/GrGpu.cpp ('k') | src/gpu/GrRenderTargetPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698