| 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" |
| 11 #include "GrResourceProvider.h" | 11 #include "GrResourceProvider.h" |
| 12 #include "GrSoftwarePathRenderer.h" | 12 #include "GrSoftwarePathRenderer.h" |
| 13 #include "SkTTopoSort.h" | 13 #include "SkTTopoSort.h" |
| 14 | 14 |
| 15 #include "text/GrAtlasTextContext.h" | 15 #include "text/GrAtlasTextContext.h" |
| 16 #include "text/GrStencilAndCoverTextContext.h" | 16 #include "text/GrStencilAndCoverTextContext.h" |
| 17 | 17 |
| 18 void GrDrawingManager::cleanup() { | 18 void GrDrawingManager::cleanup() { |
| 19 for (int i = 0; i < fDrawTargets.count(); ++i) { | 19 for (int i = 0; i < fDrawTargets.count(); ++i) { |
| 20 fDrawTargets[i]->makeClosed(); // no drawTarget should receive a new co
mmand after this | 20 fDrawTargets[i]->makeClosed(); // no drawTarget should receive a new co
mmand after this |
| 21 fDrawTargets[i]->clearRT(); | 21 fDrawTargets[i]->clearRT(); |
| 22 | 22 |
| 23 // We shouldn't need to do this, but it turns out some clients still hol
d onto drawtargets |
| 24 // after a cleanup |
| 25 fDrawTargets[i]->reset(); |
| 23 fDrawTargets[i]->unref(); | 26 fDrawTargets[i]->unref(); |
| 24 } | 27 } |
| 25 | 28 |
| 26 fDrawTargets.reset(); | 29 fDrawTargets.reset(); |
| 27 | 30 |
| 28 delete fNVPRTextContext; | 31 delete fNVPRTextContext; |
| 29 fNVPRTextContext = nullptr; | 32 fNVPRTextContext = nullptr; |
| 30 | 33 |
| 31 for (int i = 0; i < kNumPixelGeometries; ++i) { | 34 for (int i = 0; i < kNumPixelGeometries; ++i) { |
| 32 delete fTextContexts[i][0]; | 35 delete fTextContexts[i][0]; |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 } | 197 } |
| 195 | 198 |
| 196 GrDrawContext* GrDrawingManager::drawContext(GrRenderTarget* rt, | 199 GrDrawContext* GrDrawingManager::drawContext(GrRenderTarget* rt, |
| 197 const SkSurfaceProps* surfaceProps)
{ | 200 const SkSurfaceProps* surfaceProps)
{ |
| 198 if (this->abandoned()) { | 201 if (this->abandoned()) { |
| 199 return nullptr; | 202 return nullptr; |
| 200 } | 203 } |
| 201 | 204 |
| 202 return new GrDrawContext(this, rt, surfaceProps); | 205 return new GrDrawContext(this, rt, surfaceProps); |
| 203 } | 206 } |
| OLD | NEW |