diff options
author | Brian Osman <brianosman@google.com> | 2016-10-19 11:12:09 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-10-19 16:01:07 +0000 |
commit | 9f532a3598891a74375a4659e0dc498b704e3cf1 (patch) | |
tree | eed5fe2329eb3a24dec22cc062bfebf8a6f3c9a1 /src/effects/gradients | |
parent | 5e3d9c2e31b61edcfac4fd7b31e98f826d42d9f0 (diff) |
Add helper to create random AsFPArgs for Ganesh unit tests
Reduces copy-paste and eases maintenance. I'll be adding another field to
AsFPArgs soon, and this is going to streamline that change.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3639
Change-Id: I6372ed5dce50a5ba9d73039bd4714e34502a1f75
Reviewed-on: https://skia-review.googlesource.com/3639
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/effects/gradients')
-rw-r--r-- | src/effects/gradients/SkLinearGradient.cpp | 7 | ||||
-rw-r--r-- | src/effects/gradients/SkRadialGradient.cpp | 7 | ||||
-rw-r--r-- | src/effects/gradients/SkSweepGradient.cpp | 7 | ||||
-rw-r--r-- | src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp | 35 |
4 files changed, 16 insertions, 40 deletions
diff --git a/src/effects/gradients/SkLinearGradient.cpp b/src/effects/gradients/SkLinearGradient.cpp index a34515cfef..ea20595d3d 100644 --- a/src/effects/gradients/SkLinearGradient.cpp +++ b/src/effects/gradients/SkLinearGradient.cpp @@ -420,11 +420,8 @@ sk_sp<GrFragmentProcessor> GrLinearGradient::TestCreate(GrProcessorTestData* d) params.fColorCount, params.fTileMode) : SkGradientShader::MakeLinear(points, params.fColors, params.fStops, params.fColorCount, params.fTileMode); - SkMatrix viewMatrix = GrTest::TestMatrix(d->fRandom); - auto dstColorSpace = GrTest::TestColorSpace(d->fRandom); - sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(SkShader::AsFPArgs( - d->fContext, &viewMatrix, NULL, kNone_SkFilterQuality, dstColorSpace.get(), - SkSourceGammaTreatment::kRespect)); + GrTest::TestAsFPArgs asFPArgs(d); + sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(asFPArgs.args()); GrAlwaysAssert(fp); return fp; } diff --git a/src/effects/gradients/SkRadialGradient.cpp b/src/effects/gradients/SkRadialGradient.cpp index 5cf524537e..8ad588013b 100644 --- a/src/effects/gradients/SkRadialGradient.cpp +++ b/src/effects/gradients/SkRadialGradient.cpp @@ -314,11 +314,8 @@ sk_sp<GrFragmentProcessor> GrRadialGradient::TestCreate(GrProcessorTestData* d) params.fStops, params.fColorCount, params.fTileMode) : SkGradientShader::MakeRadial(center, radius, params.fColors, params.fStops, params.fColorCount, params.fTileMode); - SkMatrix viewMatrix = GrTest::TestMatrix(d->fRandom); - auto dstColorSpace = GrTest::TestColorSpace(d->fRandom); - sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(SkShader::AsFPArgs( - d->fContext, &viewMatrix, NULL, kNone_SkFilterQuality, dstColorSpace.get(), - SkSourceGammaTreatment::kRespect)); + GrTest::TestAsFPArgs asFPArgs(d); + sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(asFPArgs.args()); GrAlwaysAssert(fp); return fp; } diff --git a/src/effects/gradients/SkSweepGradient.cpp b/src/effects/gradients/SkSweepGradient.cpp index 04fc2c7436..b791f988f3 100644 --- a/src/effects/gradients/SkSweepGradient.cpp +++ b/src/effects/gradients/SkSweepGradient.cpp @@ -196,11 +196,8 @@ sk_sp<GrFragmentProcessor> GrSweepGradient::TestCreate(GrProcessorTestData* d) { params.fStops, params.fColorCount) : SkGradientShader::MakeSweep(center.fX, center.fY, params.fColors, params.fStops, params.fColorCount); - SkMatrix viewMatrix = GrTest::TestMatrix(d->fRandom); - auto dstColorSpace = GrTest::TestColorSpace(d->fRandom); - sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(SkShader::AsFPArgs( - d->fContext, &viewMatrix, NULL, kNone_SkFilterQuality, dstColorSpace.get(), - SkSourceGammaTreatment::kRespect)); + GrTest::TestAsFPArgs asFPArgs(d); + sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(asFPArgs.args()); GrAlwaysAssert(fp); return fp; } diff --git a/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp b/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp index 8eb8b638f5..1275be7315 100644 --- a/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp +++ b/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp @@ -207,11 +207,8 @@ sk_sp<GrFragmentProcessor> Edge2PtConicalEffect::TestCreate(GrProcessorTestData* SkGradientShader::MakeTwoPointConical(center1, radius1, center2, radius2, params.fColors, params.fStops, params.fColorCount, params.fTileMode); - SkMatrix viewMatrix = GrTest::TestMatrix(d->fRandom); - auto dstColorSpace = GrTest::TestColorSpace(d->fRandom); - sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(SkShader::AsFPArgs( - d->fContext, &viewMatrix, NULL, kNone_SkFilterQuality, dstColorSpace.get(), - SkSourceGammaTreatment::kRespect)); + GrTest::TestAsFPArgs asFPArgs(d); + sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(asFPArgs.args()); GrAlwaysAssert(fp); return fp; } @@ -485,11 +482,8 @@ sk_sp<GrFragmentProcessor> FocalOutside2PtConicalEffect::TestCreate(GrProcessorT SkGradientShader::MakeTwoPointConical(center1, radius1, center2, radius2, params.fColors, params.fStops, params.fColorCount, params.fTileMode); - SkMatrix viewMatrix = GrTest::TestMatrix(d->fRandom); - auto dstColorSpace = GrTest::TestColorSpace(d->fRandom); - sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(SkShader::AsFPArgs( - d->fContext, &viewMatrix, NULL, kNone_SkFilterQuality, dstColorSpace.get(), - SkSourceGammaTreatment::kRespect)); + GrTest::TestAsFPArgs asFPArgs(d); + sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(asFPArgs.args()); GrAlwaysAssert(fp); return fp; } @@ -691,11 +685,8 @@ sk_sp<GrFragmentProcessor> FocalInside2PtConicalEffect::TestCreate(GrProcessorTe SkGradientShader::MakeTwoPointConical(center1, radius1, center2, radius2, params.fColors, params.fStops, params.fColorCount, params.fTileMode); - SkMatrix viewMatrix = GrTest::TestMatrix(d->fRandom); - auto dstColorSpace = GrTest::TestColorSpace(d->fRandom); - sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(SkShader::AsFPArgs( - d->fContext, &viewMatrix, NULL, kNone_SkFilterQuality, dstColorSpace.get(), - SkSourceGammaTreatment::kRespect)); + GrTest::TestAsFPArgs asFPArgs(d); + sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(asFPArgs.args()); GrAlwaysAssert(fp); return fp; } @@ -939,11 +930,8 @@ sk_sp<GrFragmentProcessor> CircleInside2PtConicalEffect::TestCreate(GrProcessorT SkGradientShader::MakeTwoPointConical(center1, radius1, center2, radius2, params.fColors, params.fStops, params.fColorCount, params.fTileMode); - SkMatrix viewMatrix = GrTest::TestMatrix(d->fRandom); - auto dstColorSpace = GrTest::TestColorSpace(d->fRandom); - sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(SkShader::AsFPArgs( - d->fContext, &viewMatrix, NULL, kNone_SkFilterQuality, dstColorSpace.get(), - SkSourceGammaTreatment::kRespect)); + GrTest::TestAsFPArgs asFPArgs(d); + sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(asFPArgs.args()); GrAlwaysAssert(fp); return fp; } @@ -1174,11 +1162,8 @@ sk_sp<GrFragmentProcessor> CircleOutside2PtConicalEffect::TestCreate(GrProcessor SkGradientShader::MakeTwoPointConical(center1, radius1, center2, radius2, params.fColors, params.fStops, params.fColorCount, params.fTileMode); - SkMatrix viewMatrix = GrTest::TestMatrix(d->fRandom); - auto dstColorSpace = GrTest::TestColorSpace(d->fRandom); - sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(SkShader::AsFPArgs( - d->fContext, &viewMatrix, NULL, kNone_SkFilterQuality, dstColorSpace.get(), - SkSourceGammaTreatment::kRespect)); + GrTest::TestAsFPArgs asFPArgs(d); + sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(asFPArgs.args()); GrAlwaysAssert(fp); return fp; } |