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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 if (!pr && allowSW) { | 169 if (!pr && allowSW) { |
170 if (!fSoftwarePathRenderer) { | 170 if (!fSoftwarePathRenderer) { |
171 fSoftwarePathRenderer = new GrSoftwarePathRenderer(fContext->texture
Provider()); | 171 fSoftwarePathRenderer = new GrSoftwarePathRenderer(fContext->texture
Provider()); |
172 } | 172 } |
173 pr = fSoftwarePathRenderer; | 173 pr = fSoftwarePathRenderer; |
174 } | 174 } |
175 | 175 |
176 return pr; | 176 return pr; |
177 } | 177 } |
178 | 178 |
179 sk_sp<GrDrawContext> GrDrawingManager::drawContext(sk_sp<GrRenderTarget> rt, | 179 sk_sp<GrDrawContext> GrDrawingManager::makeDrawContext(sk_sp<GrRenderTarget> rt, |
180 sk_sp<SkColorSpace> colorSpac
e, | 180 sk_sp<SkColorSpace> color
Space, |
181 const SkSurfaceProps* surface
Props) { | 181 const SkSurfaceProps* sur
faceProps) { |
182 if (this->wasAbandoned()) { | 182 if (this->wasAbandoned()) { |
183 return nullptr; | 183 return nullptr; |
184 } | 184 } |
185 | 185 |
186 | 186 |
187 bool useDIF = false; | 187 bool useDIF = false; |
188 if (surfaceProps) { | 188 if (surfaceProps) { |
189 useDIF = surfaceProps->isUseDeviceIndependentFonts(); | 189 useDIF = surfaceProps->isUseDeviceIndependentFonts(); |
190 } | 190 } |
191 | 191 |
192 if (useDIF && fContext->caps()->shaderCaps()->pathRenderingSupport() && | 192 if (useDIF && fContext->caps()->shaderCaps()->pathRenderingSupport() && |
193 rt->isStencilBufferMultisampled()) { | 193 rt->isStencilBufferMultisampled()) { |
194 GrStencilAttachment* sb = fContext->resourceProvider()->attachStencilAtt
achment(rt.get()); | 194 GrStencilAttachment* sb = fContext->resourceProvider()->attachStencilAtt
achment(rt.get()); |
195 if (sb) { | 195 if (sb) { |
196 return sk_sp<GrDrawContext>(new GrPathRenderingDrawContext( | 196 return sk_sp<GrDrawContext>(new GrPathRenderingDrawContext( |
197 fContext, this, std::mov
e(rt), | 197 fContext, this, std::mov
e(rt), |
198 std::move(colorSpace), s
urfaceProps, | 198 std::move(colorSpace), s
urfaceProps, |
199 fContext->getAuditTrail(
), fSingleOwner)); | 199 fContext->getAuditTrail(
), fSingleOwner)); |
200 } | 200 } |
201 } | 201 } |
202 | 202 |
203 return sk_sp<GrDrawContext>(new GrDrawContext(fContext, this, std::move(rt), | 203 return sk_sp<GrDrawContext>(new GrDrawContext(fContext, this, std::move(rt), |
204 std::move(colorSpace), surface
Props, | 204 std::move(colorSpace), surface
Props, |
205 fContext->getAuditTrail(), | 205 fContext->getAuditTrail(), |
206 fSingleOwner)); | 206 fSingleOwner)); |
207 } | 207 } |
OLD | NEW |