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

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

Issue 1225923010: Refugee from Dead Machine 4: MDB Monster Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Last update from dead machine Created 4 years, 7 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/GrPipelineBuilder.h ('k') | src/gpu/GrReorderCommandBuilder.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"
11 11
12 #include "GrContext.h" 12 #include "GrContext.h"
13 #include "GrDrawContext.h" 13 #include "GrDrawContext.h"
14 #include "GrDrawTarget.h" 14 #include "GrDrawTarget.h"
15 #include "GrGpu.h" 15 #include "GrGpu.h"
16 #include "GrRenderTargetPriv.h" 16 #include "GrRenderTargetPriv.h"
17 #include "GrStencilAttachment.h" 17 #include "GrStencilAttachment.h"
18 18
19 GrRenderTarget::~GrRenderTarget() { 19 GrRenderTarget::~GrRenderTarget() {
20 if (fLastDrawTarget) { 20 if (fLastDrawTarget) {
21 fLastDrawTarget->clearRT(); 21 fLastDrawTarget->clearRT();
22 } 22 }
23 SkSafeUnref(fLastDrawTarget); 23 SkSafeUnref(fLastDrawTarget);
24 } 24 }
25 25
26 void GrRenderTarget::discard() { 26 void GrRenderTarget::discard() {
27
28 // since we're discarding we know we don't need the prior DC
29 // TODO: we should be able to automatically know when a discard is possible:
30 // once all pending reads are satisfied and there are no refs
31 this->setFromRawPixels(false);
27 // go through context so that all necessary flushing occurs 32 // go through context so that all necessary flushing occurs
28 GrContext* context = this->getContext(); 33 GrContext* context = this->getContext();
29 if (!context) { 34 if (!context) {
30 return; 35 return;
31 } 36 }
32 37
33 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(this)); 38 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(this));
34 if (!drawContext) { 39 if (!drawContext) {
35 return; 40 return;
36 } 41 }
37 42
38 drawContext->discard(); 43 drawContext->discard();
44
45 this->setFromRawPixels(false);
39 } 46 }
40 47
41 void GrRenderTarget::flagAsNeedingResolve(const SkIRect* rect) { 48 void GrRenderTarget::flagAsNeedingResolve(const SkIRect* rect) {
42 if (kCanResolve_ResolveType == getResolveType()) { 49 if (kCanResolve_ResolveType == getResolveType()) {
43 if (rect) { 50 if (rect) {
44 fResolveRect.join(*rect); 51 fResolveRect.join(*rect);
45 if (!fResolveRect.intersect(0, 0, this->width(), this->height())) { 52 if (!fResolveRect.intersect(0, 0, this->width(), this->height())) {
46 fResolveRect.setEmpty(); 53 fResolveRect.setEmpty();
47 } 54 }
48 } else { 55 } else {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 // we're not acctually adding one. 105 // we're not acctually adding one.
99 return true; 106 return true;
100 } 107 }
101 fRenderTarget->fStencilAttachment = stencil; 108 fRenderTarget->fStencilAttachment = stencil;
102 if (!fRenderTarget->completeStencilAttachment()) { 109 if (!fRenderTarget->completeStencilAttachment()) {
103 SkSafeSetNull(fRenderTarget->fStencilAttachment); 110 SkSafeSetNull(fRenderTarget->fStencilAttachment);
104 return false; 111 return false;
105 } 112 }
106 return true; 113 return true;
107 } 114 }
OLDNEW
« no previous file with comments | « src/gpu/GrPipelineBuilder.h ('k') | src/gpu/GrReorderCommandBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698