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

Side by Side Diff: src/gpu/GrRenderTarget.cpp

Issue 1333383002: Move some of the adding stencil attachment logic of Gpu and into Render Target. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: spelling Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « src/gpu/GrGpu.cpp ('k') | src/gpu/GrRenderTargetPriv.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "GrRenderTarget.h" 10 #include "GrRenderTarget.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 if (fResolveRect.isEmpty()) { 48 if (fResolveRect.isEmpty()) {
49 fResolveRect.setLargestInverted(); 49 fResolveRect.setLargestInverted();
50 } else { 50 } else {
51 if (!fResolveRect.intersect(0, 0, this->width(), this->height())) { 51 if (!fResolveRect.intersect(0, 0, this->width(), this->height())) {
52 fResolveRect.setLargestInverted(); 52 fResolveRect.setLargestInverted();
53 } 53 }
54 } 54 }
55 } 55 }
56 56
57 void GrRenderTarget::onRelease() { 57 void GrRenderTarget::onRelease() {
58 this->renderTargetPriv().didAttachStencilAttachment(nullptr); 58 SkSafeSetNull(fStencilAttachment);
59 59
60 INHERITED::onRelease(); 60 INHERITED::onRelease();
61 } 61 }
62 62
63 void GrRenderTarget::onAbandon() { 63 void GrRenderTarget::onAbandon() {
64 this->renderTargetPriv().didAttachStencilAttachment(nullptr); 64 SkSafeSetNull(fStencilAttachment);
65 65
66 INHERITED::onAbandon(); 66 INHERITED::onAbandon();
67 } 67 }
68 68
69 /////////////////////////////////////////////////////////////////////////////// 69 ///////////////////////////////////////////////////////////////////////////////
70 70
71 void GrRenderTargetPriv::didAttachStencilAttachment(GrStencilAttachment* stencil Attachment) { 71 bool GrRenderTargetPriv::attachStencilAttachment(GrStencilAttachment* stencil) {
72 SkRefCnt_SafeAssign(fRenderTarget->fStencilAttachment, stencilAttachment); 72 fRenderTarget->fStencilAttachment = stencil;
73 if (!fRenderTarget->completeStencilAttachment()) {
74 SkSafeSetNull(fRenderTarget->fStencilAttachment);
75 return false;
76 }
77 return true;
73 } 78 }
74
75 GrStencilAttachment* GrRenderTargetPriv::attachStencilAttachment() const {
76 if (fRenderTarget->fStencilAttachment) {
77 return fRenderTarget->fStencilAttachment;
78 }
79 if (!fRenderTarget->wasDestroyed() && fRenderTarget->canAttemptStencilAttach ment()) {
80 fRenderTarget->getGpu()->attachStencilAttachmentToRenderTarget(fRenderTa rget);
81 }
82 return fRenderTarget->fStencilAttachment;
83 }
OLDNEW
« 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