| 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" |
| 11 #include "GrDrawTarget.h" | 11 #include "GrDrawTarget.h" |
| 12 #include "GrResourceProvider.h" | 12 #include "GrResourceProvider.h" |
| 13 #include "GrStencilAndCoverTextContext.h" | 13 #include "GrStencilAndCoverTextContext.h" |
| 14 #include "SkTTopoSort.h" | 14 #include "SkTTopoSort.h" |
| 15 | 15 |
| 16 //#define ENABLE_MDB 1 | |
| 17 | |
| 18 void GrDrawingManager::cleanup() { | 16 void GrDrawingManager::cleanup() { |
| 19 for (int i = 0; i < fDrawTargets.count(); ++i) { | 17 for (int i = 0; i < fDrawTargets.count(); ++i) { |
| 20 fDrawTargets[i]->unref(); | 18 fDrawTargets[i]->unref(); |
| 21 } | 19 } |
| 22 | 20 |
| 23 fDrawTargets.reset(); | 21 fDrawTargets.reset(); |
| 24 | 22 |
| 25 delete fNVPRTextContext; | 23 delete fNVPRTextContext; |
| 26 fNVPRTextContext = nullptr; | 24 fNVPRTextContext = nullptr; |
| 27 | 25 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 98 |
| 101 #ifndef ENABLE_MDB | 99 #ifndef ENABLE_MDB |
| 102 // When MDB is disabled we always just return the single drawTarget | 100 // When MDB is disabled we always just return the single drawTarget |
| 103 if (fDrawTargets.count()) { | 101 if (fDrawTargets.count()) { |
| 104 SkASSERT(fDrawTargets.count() == 1); | 102 SkASSERT(fDrawTargets.count() == 1); |
| 105 // DrawingManager gets the creation ref - this ref is for the caller | 103 // DrawingManager gets the creation ref - this ref is for the caller |
| 106 return SkRef(fDrawTargets[0]); | 104 return SkRef(fDrawTargets[0]); |
| 107 } | 105 } |
| 108 #endif | 106 #endif |
| 109 | 107 |
| 110 GrDrawTarget* dt = new GrDrawTarget(rt, fContext->getGpu(), fContext->resour
ceProvider()); | 108 GrDrawTarget* dt = new GrDrawTarget(fContext->getGpu(), fContext->resourcePr
ovider()); |
| 111 | 109 |
| 112 *fDrawTargets.append() = dt; | 110 *fDrawTargets.append() = dt; |
| 113 | 111 |
| 114 // DrawingManager gets the creation ref - this ref is for the caller | 112 // DrawingManager gets the creation ref - this ref is for the caller |
| 115 return SkRef(dt); | 113 return SkRef(dt); |
| 116 } | 114 } |
| 117 | 115 |
| 118 GrDrawContext* GrDrawingManager::drawContext(GrRenderTarget* rt, | 116 GrDrawContext* GrDrawingManager::drawContext(GrRenderTarget* rt, |
| 119 const SkSurfaceProps* surfaceProps)
{ | 117 const SkSurfaceProps* surfaceProps)
{ |
| 120 if (this->abandoned()) { | 118 if (this->abandoned()) { |
| 121 return nullptr; | 119 return nullptr; |
| 122 } | 120 } |
| 123 | 121 |
| 124 return new GrDrawContext(this, rt, surfaceProps); | 122 return new GrDrawContext(this, rt, surfaceProps); |
| 125 } | 123 } |
| OLD | NEW |