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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 } | 51 } |
52 | 52 |
53 void GrDrawingManager::reset() { | 53 void GrDrawingManager::reset() { |
54 for (int i = 0; i < fDrawTargets.count(); ++i) { | 54 for (int i = 0; i < fDrawTargets.count(); ++i) { |
55 fDrawTargets[i]->reset(); | 55 fDrawTargets[i]->reset(); |
56 } | 56 } |
57 fFlushState.reset(); | 57 fFlushState.reset(); |
58 } | 58 } |
59 | 59 |
60 void GrDrawingManager::flush() { | 60 void GrDrawingManager::flush() { |
61 if (fFlushing || this->abandoned()) { | 61 if (fFlushing || this->wasAbandoned()) { |
62 return; | 62 return; |
63 } | 63 } |
64 fFlushing = true; | 64 fFlushing = true; |
65 | 65 |
66 SkDEBUGCODE(bool result =) | 66 SkDEBUGCODE(bool result =) |
67 SkTTopoSort<GrDrawTarget, GrDrawTarget::TopoSortTraits>(
&fDrawTargets); | 67 SkTTopoSort<GrDrawTarget, GrDrawTarget::TopoSortTraits>(
&fDrawTargets); |
68 SkASSERT(result); | 68 SkASSERT(result); |
69 | 69 |
70 #if 0 | 70 #if 0 |
71 for (int i = 0; i < fDrawTargets.count(); ++i) { | 71 for (int i = 0; i < fDrawTargets.count(); ++i) { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 fSoftwarePathRenderer = new GrSoftwarePathRenderer(fContext); | 154 fSoftwarePathRenderer = new GrSoftwarePathRenderer(fContext); |
155 } | 155 } |
156 pr = fSoftwarePathRenderer; | 156 pr = fSoftwarePathRenderer; |
157 } | 157 } |
158 | 158 |
159 return pr; | 159 return pr; |
160 } | 160 } |
161 | 161 |
162 sk_sp<GrDrawContext> GrDrawingManager::drawContext(sk_sp<GrRenderTarget> rt, | 162 sk_sp<GrDrawContext> GrDrawingManager::drawContext(sk_sp<GrRenderTarget> rt, |
163 const SkSurfaceProps* surface
Props) { | 163 const SkSurfaceProps* surface
Props) { |
164 if (this->abandoned()) { | 164 if (this->wasAbandoned()) { |
165 return nullptr; | 165 return nullptr; |
166 } | 166 } |
167 | 167 |
168 | 168 |
169 bool useDIF = false; | 169 bool useDIF = false; |
170 if (surfaceProps) { | 170 if (surfaceProps) { |
171 useDIF = surfaceProps->isUseDeviceIndependentFonts(); | 171 useDIF = surfaceProps->isUseDeviceIndependentFonts(); |
172 } | 172 } |
173 | 173 |
174 if (useDIF && fContext->caps()->shaderCaps()->pathRenderingSupport() && | 174 if (useDIF && fContext->caps()->shaderCaps()->pathRenderingSupport() && |
175 rt->isStencilBufferMultisampled()) { | 175 rt->isStencilBufferMultisampled()) { |
176 GrStencilAttachment* sb = fContext->resourceProvider()->attachStencilAtt
achment(rt.get()); | 176 GrStencilAttachment* sb = fContext->resourceProvider()->attachStencilAtt
achment(rt.get()); |
177 if (sb) { | 177 if (sb) { |
178 return sk_sp<GrDrawContext>(new GrPathRenderingDrawContext( | 178 return sk_sp<GrDrawContext>(new GrPathRenderingDrawContext( |
179 fContext, this, std::mov
e(rt), | 179 fContext, this, std::mov
e(rt), |
180 surfaceProps, | 180 surfaceProps, |
181 fContext->getAuditTrail(
), fSingleOwner)); | 181 fContext->getAuditTrail(
), fSingleOwner)); |
182 } | 182 } |
183 } | 183 } |
184 | 184 |
185 return sk_sp<GrDrawContext>(new GrDrawContext(fContext, this, std::move(rt),
surfaceProps, | 185 return sk_sp<GrDrawContext>(new GrDrawContext(fContext, this, std::move(rt),
surfaceProps, |
186 fContext->getAuditTrail(), | 186 fContext->getAuditTrail(), |
187 fSingleOwner)); | 187 fSingleOwner)); |
188 } | 188 } |
OLD | NEW |