OLD | NEW |
---|---|
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" | |
9 | |
10 #include "GrContext.h" | |
8 #include "GrDrawContext.h" | 11 #include "GrDrawContext.h" |
9 #include "GrDrawingManager.h" | |
10 #include "GrDrawTarget.h" | 12 #include "GrDrawTarget.h" |
11 #include "GrPathRenderingDrawContext.h" | 13 #include "GrPathRenderingDrawContext.h" |
12 #include "GrResourceProvider.h" | 14 #include "GrResourceProvider.h" |
13 #include "GrSoftwarePathRenderer.h" | 15 #include "GrSoftwarePathRenderer.h" |
14 #include "SkSurface_Gpu.h" | 16 #include "SkSurface_Gpu.h" |
15 #include "SkTTopoSort.h" | 17 #include "SkTTopoSort.h" |
16 | 18 |
17 #include "instanced/InstancedRendering.h" | 19 #include "instanced/InstancedRendering.h" |
18 | 20 |
19 #include "text/GrAtlasTextContext.h" | 21 #include "text/GrAtlasTextContext.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 } | 69 } |
68 } | 70 } |
69 | 71 |
70 void GrDrawingManager::reset() { | 72 void GrDrawingManager::reset() { |
71 for (int i = 0; i < fDrawTargets.count(); ++i) { | 73 for (int i = 0; i < fDrawTargets.count(); ++i) { |
72 fDrawTargets[i]->reset(); | 74 fDrawTargets[i]->reset(); |
73 } | 75 } |
74 fFlushState.reset(); | 76 fFlushState.reset(); |
75 } | 77 } |
76 | 78 |
77 bool GrDrawingManager::flush() { | 79 void GrDrawingManager::internalFlush(GrResourceCache::FlushType type) { |
78 if (fFlushing || this->wasAbandoned()) { | 80 if (fFlushing || this->wasAbandoned()) { |
79 return false; | 81 return; |
80 } | 82 } |
81 fFlushing = true; | 83 fFlushing = true; |
82 bool flushed = false; | 84 bool flushed = false; |
83 SkDEBUGCODE(bool result =) | 85 SkDEBUGCODE(bool result =) |
84 SkTTopoSort<GrDrawTarget, GrDrawTarget::TopoSortTraits>( &fDrawTargets); | 86 SkTTopoSort<GrDrawTarget, GrDrawTarget::TopoSortTraits>( &fDrawTargets); |
85 SkASSERT(result); | 87 SkASSERT(result); |
86 | 88 |
87 for (int i = 0; i < fDrawTargets.count(); ++i) { | 89 for (int i = 0; i < fDrawTargets.count(); ++i) { |
88 fDrawTargets[i]->prepareBatches(&fFlushState); | 90 fDrawTargets[i]->prepareBatches(&fFlushState); |
89 } | 91 } |
(...skipping 28 matching lines...) Expand all Loading... | |
118 if (fDrawTargets.count()) { | 120 if (fDrawTargets.count()) { |
119 SkASSERT(fDrawTargets.count() == 1); | 121 SkASSERT(fDrawTargets.count() == 1); |
120 // Clear out this flag so the topological sort's SkTTopoSort_CheckAllUnm arked check | 122 // Clear out this flag so the topological sort's SkTTopoSort_CheckAllUnm arked check |
121 // won't bark | 123 // won't bark |
122 fDrawTargets[0]->resetFlag(GrDrawTarget::kWasOutput_Flag); | 124 fDrawTargets[0]->resetFlag(GrDrawTarget::kWasOutput_Flag); |
123 } | 125 } |
124 #else | 126 #else |
125 fDrawTargets.reset(); | 127 fDrawTargets.reset(); |
126 #endif | 128 #endif |
127 | 129 |
128 fFlushState.reset(); | 130 fFlushState.reset(); |
robertphillips
2016/09/02 16:23:06
// We always have to notify the cache when it requ
| |
131 if (flushed || type == GrResourceCache::FlushType::kCacheRequested) { | |
132 fContext->getResourceCache()->notifyFlushOccurred(type); | |
133 } | |
129 fFlushing = false; | 134 fFlushing = false; |
130 return flushed; | |
131 } | 135 } |
132 | 136 |
133 GrDrawTarget* GrDrawingManager::newDrawTarget(GrRenderTarget* rt) { | 137 GrDrawTarget* GrDrawingManager::newDrawTarget(GrRenderTarget* rt) { |
134 SkASSERT(fContext); | 138 SkASSERT(fContext); |
135 | 139 |
136 #ifndef ENABLE_MDB | 140 #ifndef ENABLE_MDB |
137 // When MDB is disabled we always just return the single drawTarget | 141 // When MDB is disabled we always just return the single drawTarget |
138 if (fDrawTargets.count()) { | 142 if (fDrawTargets.count()) { |
139 SkASSERT(fDrawTargets.count() == 1); | 143 SkASSERT(fDrawTargets.count() == 1); |
140 // In the non-MDB-world the same drawTarget gets reused for multiple ren der targets. | 144 // In the non-MDB-world the same drawTarget gets reused for multiple ren der targets. |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
216 std::move(colorSpace), s urfaceProps, | 220 std::move(colorSpace), s urfaceProps, |
217 fContext->getAuditTrail( ), fSingleOwner)); | 221 fContext->getAuditTrail( ), fSingleOwner)); |
218 } | 222 } |
219 } | 223 } |
220 | 224 |
221 return sk_sp<GrDrawContext>(new GrDrawContext(fContext, this, std::move(rt), | 225 return sk_sp<GrDrawContext>(new GrDrawContext(fContext, this, std::move(rt), |
222 std::move(colorSpace), surface Props, | 226 std::move(colorSpace), surface Props, |
223 fContext->getAuditTrail(), | 227 fContext->getAuditTrail(), |
224 fSingleOwner)); | 228 fSingleOwner)); |
225 } | 229 } |
OLD | NEW |