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 "GrDrawingManager.h" | 8 #include "GrDrawingManager.h" |
9 | 9 |
10 #include "GrContext.h" | 10 #include "GrContext.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 sk_sp<SkColorSpace> color
Space, | 217 sk_sp<SkColorSpace> color
Space, |
218 const SkSurfaceProps* sur
faceProps) { | 218 const SkSurfaceProps* sur
faceProps) { |
219 if (this->wasAbandoned()) { | 219 if (this->wasAbandoned()) { |
220 return nullptr; | 220 return nullptr; |
221 } | 221 } |
222 | 222 |
223 // SkSurface catches bad color space usage at creation. This check handles a
nything that slips | 223 // SkSurface catches bad color space usage at creation. This check handles a
nything that slips |
224 // by, including internal usage. We allow a null color space here, for read/
write pixels and | 224 // by, including internal usage. We allow a null color space here, for read/
write pixels and |
225 // other special code paths. If a color space is provided, though, enforce a
ll other rules. | 225 // other special code paths. If a color space is provided, though, enforce a
ll other rules. |
226 if (colorSpace && !SkSurface_Gpu::Valid(fContext, rt->config(), colorSpace.g
et())) { | 226 if (colorSpace && !SkSurface_Gpu::Valid(fContext, rt->config(), colorSpace.g
et())) { |
227 // SRGBTODO: Enable this assert once image filters are propagating color
type and space | 227 SkDEBUGFAIL("Invalid config and colorspace combination"); |
228 // SkDEBUGFAIL("Invalid config and colorspace combination"); | |
229 return nullptr; | 228 return nullptr; |
230 } | 229 } |
231 | 230 |
232 bool useDIF = false; | 231 bool useDIF = false; |
233 if (surfaceProps) { | 232 if (surfaceProps) { |
234 useDIF = surfaceProps->isUseDeviceIndependentFonts(); | 233 useDIF = surfaceProps->isUseDeviceIndependentFonts(); |
235 } | 234 } |
236 | 235 |
237 if (useDIF && fContext->caps()->shaderCaps()->pathRenderingSupport() && | 236 if (useDIF && fContext->caps()->shaderCaps()->pathRenderingSupport() && |
238 rt->isStencilBufferMultisampled()) { | 237 rt->isStencilBufferMultisampled()) { |
239 GrStencilAttachment* sb = fContext->resourceProvider()->attachStencilAtt
achment(rt.get()); | 238 GrStencilAttachment* sb = fContext->resourceProvider()->attachStencilAtt
achment(rt.get()); |
240 if (sb) { | 239 if (sb) { |
241 return sk_sp<GrDrawContext>(new GrPathRenderingDrawContext( | 240 return sk_sp<GrDrawContext>(new GrPathRenderingDrawContext( |
242 fContext, this, std::mov
e(rt), | 241 fContext, this, std::mov
e(rt), |
243 std::move(colorSpace), s
urfaceProps, | 242 std::move(colorSpace), s
urfaceProps, |
244 fContext->getAuditTrail(
), fSingleOwner)); | 243 fContext->getAuditTrail(
), fSingleOwner)); |
245 } | 244 } |
246 } | 245 } |
247 | 246 |
248 return sk_sp<GrDrawContext>(new GrDrawContext(fContext, this, std::move(rt), | 247 return sk_sp<GrDrawContext>(new GrDrawContext(fContext, this, std::move(rt), |
249 std::move(colorSpace), surface
Props, | 248 std::move(colorSpace), surface
Props, |
250 fContext->getAuditTrail(), | 249 fContext->getAuditTrail(), |
251 fSingleOwner)); | 250 fSingleOwner)); |
252 } | 251 } |
OLD | NEW |