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

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

Issue 2324473002: Move prepareForExternalIO implementation from GrContext to GrDrawingManager (Closed)
Patch Set: Created 4 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/GrDrawingManager.h ('k') | no next file » | 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 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrDrawingManager.h" 8 #include "GrDrawingManager.h"
9 9
10 #include "GrContext.h" 10 #include "GrContext.h"
11 #include "GrDrawContext.h" 11 #include "GrDrawContext.h"
12 #include "GrDrawTarget.h" 12 #include "GrDrawTarget.h"
13 #include "GrPathRenderingDrawContext.h" 13 #include "GrPathRenderingDrawContext.h"
14 #include "GrResourceProvider.h" 14 #include "GrResourceProvider.h"
15 #include "GrSoftwarePathRenderer.h" 15 #include "GrSoftwarePathRenderer.h"
16 #include "GrSurfacePriv.h"
16 #include "SkSurface_Gpu.h" 17 #include "SkSurface_Gpu.h"
17 #include "SkTTopoSort.h" 18 #include "SkTTopoSort.h"
18 19
19 #include "instanced/InstancedRendering.h" 20 #include "instanced/InstancedRendering.h"
20 21
21 #include "text/GrAtlasTextContext.h" 22 #include "text/GrAtlasTextContext.h"
22 #include "text/GrStencilAndCoverTextContext.h" 23 #include "text/GrStencilAndCoverTextContext.h"
23 24
24 using gr_instanced::InstancedRendering; 25 using gr_instanced::InstancedRendering;
25 26
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 #endif 129 #endif
129 130
130 fFlushState.reset(); 131 fFlushState.reset();
131 // We always have to notify the cache when it requested a flush so it can re set its state. 132 // We always have to notify the cache when it requested a flush so it can re set its state.
132 if (flushed || type == GrResourceCache::FlushType::kCacheRequested) { 133 if (flushed || type == GrResourceCache::FlushType::kCacheRequested) {
133 fContext->getResourceCache()->notifyFlushOccurred(type); 134 fContext->getResourceCache()->notifyFlushOccurred(type);
134 } 135 }
135 fFlushing = false; 136 fFlushing = false;
136 } 137 }
137 138
139 void GrDrawingManager::prepareSurfaceForExternalIO(GrSurface* surface) {
140 if (this->wasAbandoned()) {
141 return;
142 }
143 SkASSERT(surface);
144 SkASSERT(surface->getContext() == fContext);
145
146 if (surface->surfacePriv().hasPendingIO()) {
147 this->flush();
148 }
149
150 GrRenderTarget* rt = surface->asRenderTarget();
151 if (fContext->getGpu() && rt) {
152 fContext->getGpu()->resolveRenderTarget(rt);
153 }
154 }
155
138 GrDrawTarget* GrDrawingManager::newDrawTarget(GrRenderTarget* rt) { 156 GrDrawTarget* GrDrawingManager::newDrawTarget(GrRenderTarget* rt) {
139 SkASSERT(fContext); 157 SkASSERT(fContext);
140 158
141 #ifndef ENABLE_MDB 159 #ifndef ENABLE_MDB
142 // When MDB is disabled we always just return the single drawTarget 160 // When MDB is disabled we always just return the single drawTarget
143 if (fDrawTargets.count()) { 161 if (fDrawTargets.count()) {
144 SkASSERT(fDrawTargets.count() == 1); 162 SkASSERT(fDrawTargets.count() == 1);
145 // In the non-MDB-world the same drawTarget gets reused for multiple ren der targets. 163 // In the non-MDB-world the same drawTarget gets reused for multiple ren der targets.
146 // Update this pointer so all the asserts are happy 164 // Update this pointer so all the asserts are happy
147 rt->setLastDrawTarget(fDrawTargets[0]); 165 rt->setLastDrawTarget(fDrawTargets[0]);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 std::move(colorSpace), s urfaceProps, 239 std::move(colorSpace), s urfaceProps,
222 fContext->getAuditTrail( ), fSingleOwner)); 240 fContext->getAuditTrail( ), fSingleOwner));
223 } 241 }
224 } 242 }
225 243
226 return sk_sp<GrDrawContext>(new GrDrawContext(fContext, this, std::move(rt), 244 return sk_sp<GrDrawContext>(new GrDrawContext(fContext, this, std::move(rt),
227 std::move(colorSpace), surface Props, 245 std::move(colorSpace), surface Props,
228 fContext->getAuditTrail(), 246 fContext->getAuditTrail(),
229 fSingleOwner)); 247 fSingleOwner));
230 } 248 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawingManager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698