Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: src/gpu/GrDrawingManager.cpp

Issue 2359443003: Fix some GPU image filter code to preserve precision and color space (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 sk_sp<SkColorSpace> color Space, 215 sk_sp<SkColorSpace> color Space,
216 const SkSurfaceProps* sur faceProps) { 216 const SkSurfaceProps* sur faceProps) {
217 if (this->wasAbandoned()) { 217 if (this->wasAbandoned()) {
218 return nullptr; 218 return nullptr;
219 } 219 }
220 220
221 // SkSurface catches bad color space usage at creation. This check handles a nything that slips 221 // SkSurface catches bad color space usage at creation. This check handles a nything that slips
222 // by, including internal usage. We allow a null color space here, for read/ write pixels and 222 // by, including internal usage. We allow a null color space here, for read/ write pixels and
223 // other special code paths. If a color space is provided, though, enforce a ll other rules. 223 // other special code paths. If a color space is provided, though, enforce a ll other rules.
224 if (colorSpace && !SkSurface_Gpu::Valid(fContext, rt->config(), colorSpace.g et())) { 224 if (colorSpace && !SkSurface_Gpu::Valid(fContext, rt->config(), colorSpace.g et())) {
225 // SRGBTODO: Enable this assert once image filters are propagating color type and space
226 // SkDEBUGFAIL("Invalid config and colorspace combination");
225 return nullptr; 227 return nullptr;
226 } 228 }
227 229
228 bool useDIF = false; 230 bool useDIF = false;
229 if (surfaceProps) { 231 if (surfaceProps) {
230 useDIF = surfaceProps->isUseDeviceIndependentFonts(); 232 useDIF = surfaceProps->isUseDeviceIndependentFonts();
231 } 233 }
232 234
233 if (useDIF && fContext->caps()->shaderCaps()->pathRenderingSupport() && 235 if (useDIF && fContext->caps()->shaderCaps()->pathRenderingSupport() &&
234 rt->isStencilBufferMultisampled()) { 236 rt->isStencilBufferMultisampled()) {
235 GrStencilAttachment* sb = fContext->resourceProvider()->attachStencilAtt achment(rt.get()); 237 GrStencilAttachment* sb = fContext->resourceProvider()->attachStencilAtt achment(rt.get());
236 if (sb) { 238 if (sb) {
237 return sk_sp<GrDrawContext>(new GrPathRenderingDrawContext( 239 return sk_sp<GrDrawContext>(new GrPathRenderingDrawContext(
238 fContext, this, std::mov e(rt), 240 fContext, this, std::mov e(rt),
239 std::move(colorSpace), s urfaceProps, 241 std::move(colorSpace), s urfaceProps,
240 fContext->getAuditTrail( ), fSingleOwner)); 242 fContext->getAuditTrail( ), fSingleOwner));
241 } 243 }
242 } 244 }
243 245
244 return sk_sp<GrDrawContext>(new GrDrawContext(fContext, this, std::move(rt), 246 return sk_sp<GrDrawContext>(new GrDrawContext(fContext, this, std::move(rt),
245 std::move(colorSpace), surface Props, 247 std::move(colorSpace), surface Props,
246 fContext->getAuditTrail(), 248 fContext->getAuditTrail(),
247 fSingleOwner)); 249 fSingleOwner));
248 } 250 }
OLDNEW
« no previous file with comments | « src/effects/SkXfermodeImageFilter.cpp ('k') | src/gpu/SkGr.cpp » ('j') | src/gpu/SkGrPriv.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698