Index: src/gpu/GrRenderTarget.cpp |
diff --git a/src/gpu/GrRenderTarget.cpp b/src/gpu/GrRenderTarget.cpp |
index 5cb34e849aa1ed601fe908d7c201066aa554198d..c16738e795d8d1698609b5d9c64f2a0a323780f1 100644 |
--- a/src/gpu/GrRenderTarget.cpp |
+++ b/src/gpu/GrRenderTarget.cpp |
@@ -55,29 +55,24 @@ void GrRenderTarget::overrideResolveRect(const SkIRect rect) { |
} |
void GrRenderTarget::onRelease() { |
- this->renderTargetPriv().didAttachStencilAttachment(nullptr); |
+ SkSafeSetNull(fStencilAttachment); |
INHERITED::onRelease(); |
} |
void GrRenderTarget::onAbandon() { |
- this->renderTargetPriv().didAttachStencilAttachment(nullptr); |
+ SkSafeSetNull(fStencilAttachment); |
INHERITED::onAbandon(); |
} |
/////////////////////////////////////////////////////////////////////////////// |
-void GrRenderTargetPriv::didAttachStencilAttachment(GrStencilAttachment* stencilAttachment) { |
- SkRefCnt_SafeAssign(fRenderTarget->fStencilAttachment, stencilAttachment); |
-} |
- |
-GrStencilAttachment* GrRenderTargetPriv::attachStencilAttachment() const { |
- if (fRenderTarget->fStencilAttachment) { |
- return fRenderTarget->fStencilAttachment; |
- } |
- if (!fRenderTarget->wasDestroyed() && fRenderTarget->canAttemptStencilAttachment()) { |
- fRenderTarget->getGpu()->attachStencilAttachmentToRenderTarget(fRenderTarget); |
- } |
- return fRenderTarget->fStencilAttachment; |
+bool GrRenderTargetPriv::attachStencilAttachment(GrStencilAttachment* stencil) { |
+ fRenderTarget->fStencilAttachment = stencil; |
+ if (!fRenderTarget->completeStencilAttachment()) { |
+ SkSafeSetNull(fRenderTarget->fStencilAttachment); |
+ return false; |
+ } |
+ return true; |
} |