OLD | NEW |
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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 {d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()}
}; | 413 {d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()}
}; |
414 | 414 |
415 SkColor colors[kMaxRandomGradientColors]; | 415 SkColor colors[kMaxRandomGradientColors]; |
416 SkScalar stopsArray[kMaxRandomGradientColors]; | 416 SkScalar stopsArray[kMaxRandomGradientColors]; |
417 SkScalar* stops = stopsArray; | 417 SkScalar* stops = stopsArray; |
418 SkShader::TileMode tm; | 418 SkShader::TileMode tm; |
419 int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tm); | 419 int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tm); |
420 auto shader = SkGradientShader::MakeLinear(points, colors, stops, colorCount
, tm); | 420 auto shader = SkGradientShader::MakeLinear(points, colors, stops, colorCount
, tm); |
421 SkMatrix viewMatrix = GrTest::TestMatrix(d->fRandom); | 421 SkMatrix viewMatrix = GrTest::TestMatrix(d->fRandom); |
422 sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(SkShader::AsFPAr
gs( | 422 sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(SkShader::AsFPAr
gs( |
423 d->fContext, &viewMatrix, NULL, kNone_SkFilterQuality, SkSourceGammaTrea
tment::kRespect)); | 423 d->fContext, &viewMatrix, NULL, kNone_SkFilterQuality, nullptr, |
| 424 SkSourceGammaTreatment::kRespect)); |
424 GrAlwaysAssert(fp); | 425 GrAlwaysAssert(fp); |
425 return fp; | 426 return fp; |
426 } | 427 } |
427 | 428 |
428 ///////////////////////////////////////////////////////////////////// | 429 ///////////////////////////////////////////////////////////////////// |
429 | 430 |
430 void GrGLLinearGradient::emitCode(EmitArgs& args) { | 431 void GrGLLinearGradient::emitCode(EmitArgs& args) { |
431 const GrLinearGradient& ge = args.fFp.cast<GrLinearGradient>(); | 432 const GrLinearGradient& ge = args.fFp.cast<GrLinearGradient>(); |
432 this->emitUniforms(args.fUniformHandler, ge); | 433 this->emitUniforms(args.fUniformHandler, ge); |
433 SkString t = args.fFragBuilder->ensureFSCoords2D(args.fCoords, 0); | 434 SkString t = args.fFragBuilder->ensureFSCoords2D(args.fCoords, 0); |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 this->shade4_dx_clamp<false, true>(dstC, count, fx, dx, invDx, dithe
r); | 753 this->shade4_dx_clamp<false, true>(dstC, count, fx, dx, invDx, dithe
r); |
753 } | 754 } |
754 } else { | 755 } else { |
755 if (fApplyAlphaAfterInterp) { | 756 if (fApplyAlphaAfterInterp) { |
756 this->shade4_dx_clamp<true, false>(dstC, count, fx, dx, invDx, dithe
r); | 757 this->shade4_dx_clamp<true, false>(dstC, count, fx, dx, invDx, dithe
r); |
757 } else { | 758 } else { |
758 this->shade4_dx_clamp<false, false>(dstC, count, fx, dx, invDx, dith
er); | 759 this->shade4_dx_clamp<false, false>(dstC, count, fx, dx, invDx, dith
er); |
759 } | 760 } |
760 } | 761 } |
761 } | 762 } |
OLD | NEW |