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 "GrSoftwarePathRenderer.h" | 13 #include "GrSoftwarePathRenderer.h" |
14 #include "GrStencilAndCoverTextContext.h" | 14 #include "GrStencilAndCoverTextContext.h" |
15 #include "SkTTopoSort.h" | 15 #include "SkTTopoSort.h" |
16 | 16 |
| 17 //#define ENABLE_MDB 1 |
| 18 |
17 void GrDrawingManager::cleanup() { | 19 void GrDrawingManager::cleanup() { |
18 for (int i = 0; i < fDrawTargets.count(); ++i) { | 20 for (int i = 0; i < fDrawTargets.count(); ++i) { |
19 fDrawTargets[i]->unref(); | 21 fDrawTargets[i]->unref(); |
20 } | 22 } |
21 | 23 |
22 fDrawTargets.reset(); | 24 fDrawTargets.reset(); |
23 | 25 |
24 delete fNVPRTextContext; | 26 delete fNVPRTextContext; |
25 fNVPRTextContext = nullptr; | 27 fNVPRTextContext = nullptr; |
26 | 28 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 110 |
109 #ifndef ENABLE_MDB | 111 #ifndef ENABLE_MDB |
110 // When MDB is disabled we always just return the single drawTarget | 112 // When MDB is disabled we always just return the single drawTarget |
111 if (fDrawTargets.count()) { | 113 if (fDrawTargets.count()) { |
112 SkASSERT(fDrawTargets.count() == 1); | 114 SkASSERT(fDrawTargets.count() == 1); |
113 // DrawingManager gets the creation ref - this ref is for the caller | 115 // DrawingManager gets the creation ref - this ref is for the caller |
114 return SkRef(fDrawTargets[0]); | 116 return SkRef(fDrawTargets[0]); |
115 } | 117 } |
116 #endif | 118 #endif |
117 | 119 |
118 GrDrawTarget* dt = new GrDrawTarget(fContext->getGpu(), fContext->resourcePr
ovider(), | 120 GrDrawTarget* dt = new GrDrawTarget(rt, fContext->getGpu(), fContext->resour
ceProvider(), |
119 fOptions); | 121 fOptions); |
120 | 122 |
121 *fDrawTargets.append() = dt; | 123 *fDrawTargets.append() = dt; |
122 | 124 |
123 // DrawingManager gets the creation ref - this ref is for the caller | 125 // DrawingManager gets the creation ref - this ref is for the caller |
124 return SkRef(dt); | 126 return SkRef(dt); |
125 } | 127 } |
126 | 128 |
127 /* | 129 /* |
128 * This method finds a path renderer that can draw the specified path on | 130 * This method finds a path renderer that can draw the specified path on |
(...skipping 22 matching lines...) Expand all 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 |