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

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

Issue 1406173003: Loosen requirement that there be only one GrDrawTarget (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix comment Created 5 years, 2 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/GrDrawTarget.cpp ('k') | src/gpu/GrTest.cpp » ('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"
11 11
12 #include "GrContext.h" 12 #include "GrContext.h"
13 #include "GrDrawContext.h" 13 #include "GrDrawContext.h"
14 #include "GrDrawTarget.h"
14 #include "GrGpu.h" 15 #include "GrGpu.h"
15 #include "GrRenderTargetPriv.h" 16 #include "GrRenderTargetPriv.h"
16 #include "GrStencilAttachment.h" 17 #include "GrStencilAttachment.h"
17 18
18 void GrRenderTarget::discard() { 19 void GrRenderTarget::discard() {
19 // go through context so that all necessary flushing occurs 20 // go through context so that all necessary flushing occurs
20 GrContext* context = this->getContext(); 21 GrContext* context = this->getContext();
21 if (!context) { 22 if (!context) {
22 return; 23 return;
23 } 24 }
(...skipping 25 matching lines...) Expand all
49 fResolveRect.setLargestInverted(); 50 fResolveRect.setLargestInverted();
50 } else { 51 } else {
51 if (!fResolveRect.intersect(0, 0, this->width(), this->height())) { 52 if (!fResolveRect.intersect(0, 0, this->width(), this->height())) {
52 fResolveRect.setLargestInverted(); 53 fResolveRect.setLargestInverted();
53 } 54 }
54 } 55 }
55 } 56 }
56 57
57 void GrRenderTarget::onRelease() { 58 void GrRenderTarget::onRelease() {
58 SkSafeSetNull(fStencilAttachment); 59 SkSafeSetNull(fStencilAttachment);
60 fLastDrawTarget = nullptr;
59 61
60 INHERITED::onRelease(); 62 INHERITED::onRelease();
61 } 63 }
62 64
63 void GrRenderTarget::onAbandon() { 65 void GrRenderTarget::onAbandon() {
64 SkSafeSetNull(fStencilAttachment); 66 SkSafeSetNull(fStencilAttachment);
67 fLastDrawTarget = nullptr;
65 68
66 INHERITED::onAbandon(); 69 INHERITED::onAbandon();
67 } 70 }
68 71
72 void GrRenderTarget::setLastDrawTarget(GrDrawTarget* dt) {
73 if (fLastDrawTarget) {
74 SkASSERT(fLastDrawTarget->isClosed());
75 }
76
77 fLastDrawTarget = dt;
78 }
79
69 /////////////////////////////////////////////////////////////////////////////// 80 ///////////////////////////////////////////////////////////////////////////////
70 81
71 bool GrRenderTargetPriv::attachStencilAttachment(GrStencilAttachment* stencil) { 82 bool GrRenderTargetPriv::attachStencilAttachment(GrStencilAttachment* stencil) {
72 if (!stencil && !fRenderTarget->fStencilAttachment) { 83 if (!stencil && !fRenderTarget->fStencilAttachment) {
73 // No need to do any work since we currently don't have a stencil attach ment and 84 // No need to do any work since we currently don't have a stencil attach ment and
74 // we're not acctually adding one. 85 // we're not acctually adding one.
75 return true; 86 return true;
76 } 87 }
77 fRenderTarget->fStencilAttachment = stencil; 88 fRenderTarget->fStencilAttachment = stencil;
78 if (!fRenderTarget->completeStencilAttachment()) { 89 if (!fRenderTarget->completeStencilAttachment()) {
79 SkSafeSetNull(fRenderTarget->fStencilAttachment); 90 SkSafeSetNull(fRenderTarget->fStencilAttachment);
80 return false; 91 return false;
81 } 92 }
82 return true; 93 return true;
83 } 94 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.cpp ('k') | src/gpu/GrTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698