OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkTwoPointConicalGradient_gpu.h" | 8 #include "SkTwoPointConicalGradient_gpu.h" |
9 | 9 |
10 #include "SkTwoPointConicalGradient.h" | 10 #include "SkTwoPointConicalGradient.h" |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 203 |
204 SkColor colors[kMaxRandomGradientColors]; | 204 SkColor colors[kMaxRandomGradientColors]; |
205 SkScalar stopsArray[kMaxRandomGradientColors]; | 205 SkScalar stopsArray[kMaxRandomGradientColors]; |
206 SkScalar* stops = stopsArray; | 206 SkScalar* stops = stopsArray; |
207 SkShader::TileMode tm; | 207 SkShader::TileMode tm; |
208 int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tm); | 208 int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tm); |
209 auto shader = SkGradientShader::MakeTwoPointConical(center1, radius1, center
2, radius2, | 209 auto shader = SkGradientShader::MakeTwoPointConical(center1, radius1, center
2, radius2, |
210 colors, stops, colorCoun
t, tm); | 210 colors, stops, colorCoun
t, tm); |
211 SkMatrix viewMatrix = GrTest::TestMatrix(d->fRandom); | 211 SkMatrix viewMatrix = GrTest::TestMatrix(d->fRandom); |
212 sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(SkShader::AsFPAr
gs( | 212 sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(SkShader::AsFPAr
gs( |
213 d->fContext, &viewMatrix, NULL, kNone_SkFilterQuality, SkSourceGammaTrea
tment::kRespect)); | 213 d->fContext, &viewMatrix, NULL, kNone_SkFilterQuality, nullptr, |
| 214 SkSourceGammaTreatment::kRespect)); |
214 GrAlwaysAssert(fp); | 215 GrAlwaysAssert(fp); |
215 return fp; | 216 return fp; |
216 } | 217 } |
217 | 218 |
218 GLEdge2PtConicalEffect::GLEdge2PtConicalEffect(const GrProcessor&) | 219 GLEdge2PtConicalEffect::GLEdge2PtConicalEffect(const GrProcessor&) |
219 : fVSVaryingName(nullptr) | 220 : fVSVaryingName(nullptr) |
220 , fFSVaryingName(nullptr) | 221 , fFSVaryingName(nullptr) |
221 , fCachedRadius(-SK_ScalarMax) | 222 , fCachedRadius(-SK_ScalarMax) |
222 , fCachedDiffRadius(-SK_ScalarMax) {} | 223 , fCachedDiffRadius(-SK_ScalarMax) {} |
223 | 224 |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 | 481 |
481 SkColor colors[kMaxRandomGradientColors]; | 482 SkColor colors[kMaxRandomGradientColors]; |
482 SkScalar stopsArray[kMaxRandomGradientColors]; | 483 SkScalar stopsArray[kMaxRandomGradientColors]; |
483 SkScalar* stops = stopsArray; | 484 SkScalar* stops = stopsArray; |
484 SkShader::TileMode tm; | 485 SkShader::TileMode tm; |
485 int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tm); | 486 int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tm); |
486 auto shader = SkGradientShader::MakeTwoPointConical(center1, radius1, center
2, radius2, | 487 auto shader = SkGradientShader::MakeTwoPointConical(center1, radius1, center
2, radius2, |
487 colors, stops, colorCoun
t, tm); | 488 colors, stops, colorCoun
t, tm); |
488 SkMatrix viewMatrix = GrTest::TestMatrix(d->fRandom); | 489 SkMatrix viewMatrix = GrTest::TestMatrix(d->fRandom); |
489 sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(SkShader::AsFPAr
gs( | 490 sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(SkShader::AsFPAr
gs( |
490 d->fContext, &viewMatrix, NULL, kNone_SkFilterQuality, SkSourceGammaTrea
tment::kRespect)); | 491 d->fContext, &viewMatrix, NULL, kNone_SkFilterQuality, nullptr, |
| 492 SkSourceGammaTreatment::kRespect)); |
491 GrAlwaysAssert(fp); | 493 GrAlwaysAssert(fp); |
492 return fp; | 494 return fp; |
493 } | 495 } |
494 | 496 |
495 GLFocalOutside2PtConicalEffect::GLFocalOutside2PtConicalEffect(const GrProcessor
& processor) | 497 GLFocalOutside2PtConicalEffect::GLFocalOutside2PtConicalEffect(const GrProcessor
& processor) |
496 : fVSVaryingName(nullptr) | 498 : fVSVaryingName(nullptr) |
497 , fFSVaryingName(nullptr) | 499 , fFSVaryingName(nullptr) |
498 , fCachedFocal(SK_ScalarMax) { | 500 , fCachedFocal(SK_ScalarMax) { |
499 const FocalOutside2PtConicalEffect& data = processor.cast<FocalOutside2PtCon
icalEffect>(); | 501 const FocalOutside2PtConicalEffect& data = processor.cast<FocalOutside2PtCon
icalEffect>(); |
500 fIsFlipped = data.isFlipped(); | 502 fIsFlipped = data.isFlipped(); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 | 690 |
689 SkColor colors[kMaxRandomGradientColors]; | 691 SkColor colors[kMaxRandomGradientColors]; |
690 SkScalar stopsArray[kMaxRandomGradientColors]; | 692 SkScalar stopsArray[kMaxRandomGradientColors]; |
691 SkScalar* stops = stopsArray; | 693 SkScalar* stops = stopsArray; |
692 SkShader::TileMode tm; | 694 SkShader::TileMode tm; |
693 int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tm); | 695 int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tm); |
694 auto shader = SkGradientShader::MakeTwoPointConical(center1, radius1, center
2, radius2, | 696 auto shader = SkGradientShader::MakeTwoPointConical(center1, radius1, center
2, radius2, |
695 colors, stops, colorCoun
t, tm); | 697 colors, stops, colorCoun
t, tm); |
696 SkMatrix viewMatrix = GrTest::TestMatrix(d->fRandom); | 698 SkMatrix viewMatrix = GrTest::TestMatrix(d->fRandom); |
697 sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(SkShader::AsFPAr
gs( | 699 sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(SkShader::AsFPAr
gs( |
698 d->fContext, &viewMatrix, NULL, kNone_SkFilterQuality, SkSourceGammaTrea
tment::kRespect)); | 700 d->fContext, &viewMatrix, NULL, kNone_SkFilterQuality, nullptr, |
| 701 SkSourceGammaTreatment::kRespect)); |
699 GrAlwaysAssert(fp); | 702 GrAlwaysAssert(fp); |
700 return fp; | 703 return fp; |
701 } | 704 } |
702 | 705 |
703 GLFocalInside2PtConicalEffect::GLFocalInside2PtConicalEffect(const GrProcessor&) | 706 GLFocalInside2PtConicalEffect::GLFocalInside2PtConicalEffect(const GrProcessor&) |
704 : fVSVaryingName(nullptr) | 707 : fVSVaryingName(nullptr) |
705 , fFSVaryingName(nullptr) | 708 , fFSVaryingName(nullptr) |
706 , fCachedFocal(SK_ScalarMax) {} | 709 , fCachedFocal(SK_ScalarMax) {} |
707 | 710 |
708 void GLFocalInside2PtConicalEffect::emitCode(EmitArgs& args) { | 711 void GLFocalInside2PtConicalEffect::emitCode(EmitArgs& args) { |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 | 939 |
937 SkColor colors[kMaxRandomGradientColors]; | 940 SkColor colors[kMaxRandomGradientColors]; |
938 SkScalar stopsArray[kMaxRandomGradientColors]; | 941 SkScalar stopsArray[kMaxRandomGradientColors]; |
939 SkScalar* stops = stopsArray; | 942 SkScalar* stops = stopsArray; |
940 SkShader::TileMode tm; | 943 SkShader::TileMode tm; |
941 int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tm); | 944 int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tm); |
942 auto shader = SkGradientShader::MakeTwoPointConical(center1, radius1, center
2, radius2, | 945 auto shader = SkGradientShader::MakeTwoPointConical(center1, radius1, center
2, radius2, |
943 colors, stops, colorCoun
t, tm); | 946 colors, stops, colorCoun
t, tm); |
944 SkMatrix viewMatrix = GrTest::TestMatrix(d->fRandom); | 947 SkMatrix viewMatrix = GrTest::TestMatrix(d->fRandom); |
945 sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(SkShader::AsFPAr
gs( | 948 sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(SkShader::AsFPAr
gs( |
946 d->fContext, &viewMatrix, NULL, kNone_SkFilterQuality, SkSourceGammaTrea
tment::kRespect)); | 949 d->fContext, &viewMatrix, NULL, kNone_SkFilterQuality, nullptr, |
| 950 SkSourceGammaTreatment::kRespect)); |
947 GrAlwaysAssert(fp); | 951 GrAlwaysAssert(fp); |
948 return fp; | 952 return fp; |
949 } | 953 } |
950 | 954 |
951 GLCircleInside2PtConicalEffect::GLCircleInside2PtConicalEffect(const GrProcessor
& processor) | 955 GLCircleInside2PtConicalEffect::GLCircleInside2PtConicalEffect(const GrProcessor
& processor) |
952 : fVSVaryingName(nullptr) | 956 : fVSVaryingName(nullptr) |
953 , fFSVaryingName(nullptr) | 957 , fFSVaryingName(nullptr) |
954 , fCachedCenterX(SK_ScalarMax) | 958 , fCachedCenterX(SK_ScalarMax) |
955 , fCachedCenterY(SK_ScalarMax) | 959 , fCachedCenterY(SK_ScalarMax) |
956 , fCachedA(SK_ScalarMax) | 960 , fCachedA(SK_ScalarMax) |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1169 | 1173 |
1170 SkColor colors[kMaxRandomGradientColors]; | 1174 SkColor colors[kMaxRandomGradientColors]; |
1171 SkScalar stopsArray[kMaxRandomGradientColors]; | 1175 SkScalar stopsArray[kMaxRandomGradientColors]; |
1172 SkScalar* stops = stopsArray; | 1176 SkScalar* stops = stopsArray; |
1173 SkShader::TileMode tm; | 1177 SkShader::TileMode tm; |
1174 int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tm); | 1178 int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tm); |
1175 auto shader = SkGradientShader::MakeTwoPointConical(center1, radius1, center
2, radius2, | 1179 auto shader = SkGradientShader::MakeTwoPointConical(center1, radius1, center
2, radius2, |
1176 colors, stops, colorCoun
t, tm); | 1180 colors, stops, colorCoun
t, tm); |
1177 SkMatrix viewMatrix = GrTest::TestMatrix(d->fRandom); | 1181 SkMatrix viewMatrix = GrTest::TestMatrix(d->fRandom); |
1178 sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(SkShader::AsFPAr
gs( | 1182 sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(SkShader::AsFPAr
gs( |
1179 d->fContext, &viewMatrix, NULL, kNone_SkFilterQuality, SkSourceGammaTrea
tment::kRespect)); | 1183 d->fContext, &viewMatrix, NULL, kNone_SkFilterQuality, nullptr, |
| 1184 SkSourceGammaTreatment::kRespect)); |
1180 GrAlwaysAssert(fp); | 1185 GrAlwaysAssert(fp); |
1181 return fp; | 1186 return fp; |
1182 } | 1187 } |
1183 | 1188 |
1184 GLCircleOutside2PtConicalEffect::GLCircleOutside2PtConicalEffect(const GrProcess
or& processor) | 1189 GLCircleOutside2PtConicalEffect::GLCircleOutside2PtConicalEffect(const GrProcess
or& processor) |
1185 : fVSVaryingName(nullptr) | 1190 : fVSVaryingName(nullptr) |
1186 , fFSVaryingName(nullptr) | 1191 , fFSVaryingName(nullptr) |
1187 , fCachedCenterX(SK_ScalarMax) | 1192 , fCachedCenterX(SK_ScalarMax) |
1188 , fCachedCenterY(SK_ScalarMax) | 1193 , fCachedCenterY(SK_ScalarMax) |
1189 , fCachedA(SK_ScalarMax) | 1194 , fCachedA(SK_ScalarMax) |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1331 return CircleInside2PtConicalEffect::Make(ctx, shader, matrix, tm, info)
; | 1336 return CircleInside2PtConicalEffect::Make(ctx, shader, matrix, tm, info)
; |
1332 } else if (type == kEdge_ConicalType) { | 1337 } else if (type == kEdge_ConicalType) { |
1333 set_matrix_edge_conical(shader, &matrix); | 1338 set_matrix_edge_conical(shader, &matrix); |
1334 return Edge2PtConicalEffect::Make(ctx, shader, matrix, tm); | 1339 return Edge2PtConicalEffect::Make(ctx, shader, matrix, tm); |
1335 } else { | 1340 } else { |
1336 return CircleOutside2PtConicalEffect::Make(ctx, shader, matrix, tm, info
); | 1341 return CircleOutside2PtConicalEffect::Make(ctx, shader, matrix, tm, info
); |
1337 } | 1342 } |
1338 } | 1343 } |
1339 | 1344 |
1340 #endif | 1345 #endif |
OLD | NEW |