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

Side by Side Diff: src/effects/gradients/SkLinearGradient.cpp

Issue 2337313002: (Some) gradients are gamma and gamut correct on GPU (Closed)
Patch Set: Rebase 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 2012 Google Inc. 2 * Copyright 2012 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 "Sk4fLinearGradient.h" 8 #include "Sk4fLinearGradient.h"
9 #include "SkLinearGradient.h" 9 #include "SkLinearGradient.h"
10 #include "SkRefCnt.h" 10 #include "SkRefCnt.h"
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 if (info) { 334 if (info) {
335 commonAsAGradient(info); 335 commonAsAGradient(info);
336 info->fPoint[0] = fStart; 336 info->fPoint[0] = fStart;
337 info->fPoint[1] = fEnd; 337 info->fPoint[1] = fEnd;
338 } 338 }
339 return kLinear_GradientType; 339 return kLinear_GradientType;
340 } 340 }
341 341
342 #if SK_SUPPORT_GPU 342 #if SK_SUPPORT_GPU
343 343
344 #include "GrColorSpaceXform.h"
344 #include "glsl/GrGLSLCaps.h" 345 #include "glsl/GrGLSLCaps.h"
345 #include "glsl/GrGLSLFragmentShaderBuilder.h" 346 #include "glsl/GrGLSLFragmentShaderBuilder.h"
346 #include "SkGr.h" 347 #include "SkGr.h"
347 348
348 ///////////////////////////////////////////////////////////////////// 349 /////////////////////////////////////////////////////////////////////
349 350
350 class GrLinearGradient : public GrGradientEffect { 351 class GrLinearGradient : public GrGradientEffect {
351 public: 352 public:
352 class GLSLLinearProcessor; 353 class GLSLLinearProcessor;
353 354
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 } 455 }
455 if (args.fLocalMatrix) { 456 if (args.fLocalMatrix) {
456 SkMatrix inv; 457 SkMatrix inv;
457 if (!args.fLocalMatrix->invert(&inv)) { 458 if (!args.fLocalMatrix->invert(&inv)) {
458 return nullptr; 459 return nullptr;
459 } 460 }
460 matrix.postConcat(inv); 461 matrix.postConcat(inv);
461 } 462 }
462 matrix.postConcat(fPtsToUnit); 463 matrix.postConcat(fPtsToUnit);
463 464
465 sk_sp<GrColorSpaceXform> colorSpaceXform = GrColorSpaceXform::Make(fColorSpa ce.get(),
466 args.fDst ColorSpace);
464 sk_sp<GrFragmentProcessor> inner(GrLinearGradient::Make( 467 sk_sp<GrFragmentProcessor> inner(GrLinearGradient::Make(
465 GrGradientEffect::CreateArgs(args.fContext, this, &matrix, fTileMode))); 468 GrGradientEffect::CreateArgs(args.fContext, this, &matrix, fTileMode,
469 std::move(colorSpaceXform), SkToBool(args.f DstColorSpace))));
466 return GrFragmentProcessor::MulOutputByInputAlpha(std::move(inner)); 470 return GrFragmentProcessor::MulOutputByInputAlpha(std::move(inner));
467 } 471 }
468 472
469 473
470 #endif 474 #endif
471 475
472 #ifndef SK_IGNORE_TO_STRING 476 #ifndef SK_IGNORE_TO_STRING
473 void SkLinearGradient::toString(SkString* str) const { 477 void SkLinearGradient::toString(SkString* str) const {
474 str->append("SkLinearGradient ("); 478 str->append("SkLinearGradient (");
475 479
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 this->shade4_dx_clamp<false, true>(dstC, count, fx, dx, invDx, dithe r); 758 this->shade4_dx_clamp<false, true>(dstC, count, fx, dx, invDx, dithe r);
755 } 759 }
756 } else { 760 } else {
757 if (fApplyAlphaAfterInterp) { 761 if (fApplyAlphaAfterInterp) {
758 this->shade4_dx_clamp<true, false>(dstC, count, fx, dx, invDx, dithe r); 762 this->shade4_dx_clamp<true, false>(dstC, count, fx, dx, invDx, dithe r);
759 } else { 763 } else {
760 this->shade4_dx_clamp<false, false>(dstC, count, fx, dx, invDx, dith er); 764 this->shade4_dx_clamp<false, false>(dstC, count, fx, dx, invDx, dith er);
761 } 765 }
762 } 766 }
763 } 767 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698