| 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 "GrDrawContext.h" | 8 #include "GrDrawContext.h" |
| 9 #include "GrDrawingManager.h" | 9 #include "GrDrawingManager.h" |
| 10 #include "GrDrawTarget.h" | 10 #include "GrDrawTarget.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 if (fDrawTargets.count()) { | 107 if (fDrawTargets.count()) { |
| 108 SkASSERT(fDrawTargets.count() == 1); | 108 SkASSERT(fDrawTargets.count() == 1); |
| 109 // Clear out this flag so the topological sort's SkTTopoSort_CheckAllUnm
arked check | 109 // Clear out this flag so the topological sort's SkTTopoSort_CheckAllUnm
arked check |
| 110 // won't bark | 110 // won't bark |
| 111 fDrawTargets[0]->resetFlag(GrDrawTarget::kWasOutput_Flag); | 111 fDrawTargets[0]->resetFlag(GrDrawTarget::kWasOutput_Flag); |
| 112 } | 112 } |
| 113 #else | 113 #else |
| 114 fDrawTargets.reset(); | 114 fDrawTargets.reset(); |
| 115 #endif | 115 #endif |
| 116 | 116 |
| 117 // Clear batch debugging output |
| 118 if (GR_BATCH_DEBUGGING_OUTPUT) { |
| 119 SkDebugf("%s\n", fContext->getAuditTrail()->toJson().c_str()); |
| 120 // TODO This currently crashes because not all ops are accounted for |
| 121 //GR_AUDIT_TRAIL_RESET(fContext->getAuditTrail()); |
| 122 } |
| 123 |
| 117 fFlushState.reset(); | 124 fFlushState.reset(); |
| 118 fFlushing = false; | 125 fFlushing = false; |
| 119 } | 126 } |
| 120 | 127 |
| 121 GrTextContext* GrDrawingManager::textContext(const SkSurfaceProps& props, | 128 GrTextContext* GrDrawingManager::textContext(const SkSurfaceProps& props, |
| 122 GrRenderTarget* rt) { | 129 GrRenderTarget* rt) { |
| 123 if (this->abandoned()) { | 130 if (this->abandoned()) { |
| 124 return nullptr; | 131 return nullptr; |
| 125 } | 132 } |
| 126 | 133 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 155 SkASSERT(fDrawTargets.count() == 1); | 162 SkASSERT(fDrawTargets.count() == 1); |
| 156 // 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. |
| 157 // Update this pointer so all the asserts are happy | 164 // Update this pointer so all the asserts are happy |
| 158 rt->setLastDrawTarget(fDrawTargets[0]); | 165 rt->setLastDrawTarget(fDrawTargets[0]); |
| 159 // DrawingManager gets the creation ref - this ref is for the caller | 166 // DrawingManager gets the creation ref - this ref is for the caller |
| 160 return SkRef(fDrawTargets[0]); | 167 return SkRef(fDrawTargets[0]); |
| 161 } | 168 } |
| 162 #endif | 169 #endif |
| 163 | 170 |
| 164 GrDrawTarget* dt = new GrDrawTarget(rt, fContext->getGpu(), fContext->resour
ceProvider(), | 171 GrDrawTarget* dt = new GrDrawTarget(rt, fContext->getGpu(), fContext->resour
ceProvider(), |
| 165 fOptionsForDrawTargets); | 172 fContext->getAuditTrail(), fOptionsForDr
awTargets); |
| 166 | 173 |
| 167 *fDrawTargets.append() = dt; | 174 *fDrawTargets.append() = dt; |
| 168 | 175 |
| 169 // DrawingManager gets the creation ref - this ref is for the caller | 176 // DrawingManager gets the creation ref - this ref is for the caller |
| 170 return SkRef(dt); | 177 return SkRef(dt); |
| 171 } | 178 } |
| 172 | 179 |
| 173 /* | 180 /* |
| 174 * This method finds a path renderer that can draw the specified path on | 181 * This method finds a path renderer that can draw the specified path on |
| 175 * the provided target. | 182 * the provided target. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 197 } | 204 } |
| 198 | 205 |
| 199 GrDrawContext* GrDrawingManager::drawContext(GrRenderTarget* rt, | 206 GrDrawContext* GrDrawingManager::drawContext(GrRenderTarget* rt, |
| 200 const SkSurfaceProps* surfaceProps)
{ | 207 const SkSurfaceProps* surfaceProps)
{ |
| 201 if (this->abandoned()) { | 208 if (this->abandoned()) { |
| 202 return nullptr; | 209 return nullptr; |
| 203 } | 210 } |
| 204 | 211 |
| 205 return new GrDrawContext(this, rt, surfaceProps, fSingleOwner); | 212 return new GrDrawContext(this, rt, surfaceProps, fSingleOwner); |
| 206 } | 213 } |
| OLD | NEW |