| 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 "GrAtlasTextContext.h" | 8 #include "GrAtlasTextContext.h" |
| 9 #include "GrDrawContext.h" | 9 #include "GrDrawContext.h" |
| 10 #include "GrDrawingManager.h" | 10 #include "GrDrawingManager.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 delete fNVPRTextContext; | 24 delete fNVPRTextContext; |
| 25 fNVPRTextContext = nullptr; | 25 fNVPRTextContext = nullptr; |
| 26 | 26 |
| 27 for (int i = 0; i < kNumPixelGeometries; ++i) { | 27 for (int i = 0; i < kNumPixelGeometries; ++i) { |
| 28 delete fTextContexts[i][0]; | 28 delete fTextContexts[i][0]; |
| 29 fTextContexts[i][0] = nullptr; | 29 fTextContexts[i][0] = nullptr; |
| 30 delete fTextContexts[i][1]; | 30 delete fTextContexts[i][1]; |
| 31 fTextContexts[i][1] = nullptr; | 31 fTextContexts[i][1] = nullptr; |
| 32 } | 32 } |
| 33 | 33 |
| 34 SkSafeSetNull(fPathRendererChain); | 34 delete fPathRendererChain; |
| 35 fPathRendererChain = nullptr; |
| 35 SkSafeSetNull(fSoftwarePathRenderer); | 36 SkSafeSetNull(fSoftwarePathRenderer); |
| 36 } | 37 } |
| 37 | 38 |
| 38 GrDrawingManager::~GrDrawingManager() { | 39 GrDrawingManager::~GrDrawingManager() { |
| 39 this->cleanup(); | 40 this->cleanup(); |
| 40 } | 41 } |
| 41 | 42 |
| 42 void GrDrawingManager::abandon() { | 43 void GrDrawingManager::abandon() { |
| 43 fAbandoned = true; | 44 fAbandoned = true; |
| 44 this->cleanup(); | 45 this->cleanup(); |
| 45 } | 46 } |
| 46 | 47 |
| 47 void GrDrawingManager::freeGpuResources() { | 48 void GrDrawingManager::freeGpuResources() { |
| 48 // a path renderer may be holding onto resources | 49 // a path renderer may be holding onto resources |
| 49 SkSafeSetNull(fPathRendererChain); | 50 delete fPathRendererChain; |
| 51 fPathRendererChain = nullptr; |
| 50 SkSafeSetNull(fSoftwarePathRenderer); | 52 SkSafeSetNull(fSoftwarePathRenderer); |
| 51 } | 53 } |
| 52 | 54 |
| 53 void GrDrawingManager::reset() { | 55 void GrDrawingManager::reset() { |
| 54 for (int i = 0; i < fDrawTargets.count(); ++i) { | 56 for (int i = 0; i < fDrawTargets.count(); ++i) { |
| 55 fDrawTargets[i]->reset(); | 57 fDrawTargets[i]->reset(); |
| 56 } | 58 } |
| 57 } | 59 } |
| 58 | 60 |
| 59 void GrDrawingManager::flush() { | 61 void GrDrawingManager::flush() { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 } | 153 } |
| 152 | 154 |
| 153 GrDrawContext* GrDrawingManager::drawContext(GrRenderTarget* rt, | 155 GrDrawContext* GrDrawingManager::drawContext(GrRenderTarget* rt, |
| 154 const SkSurfaceProps* surfaceProps)
{ | 156 const SkSurfaceProps* surfaceProps)
{ |
| 155 if (this->abandoned()) { | 157 if (this->abandoned()) { |
| 156 return nullptr; | 158 return nullptr; |
| 157 } | 159 } |
| 158 | 160 |
| 159 return new GrDrawContext(this, rt, surfaceProps); | 161 return new GrDrawContext(this, rt, surfaceProps); |
| 160 } | 162 } |
| OLD | NEW |