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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 radius2 = radius1 + diffLen; | 202 radius2 = radius1 + diffLen; |
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 const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext, | 211 const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext, |
212 GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality); | 212 GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality, |
| 213 SkSourceGammaTreatment::kRespect); |
213 GrAlwaysAssert(fp); | 214 GrAlwaysAssert(fp); |
214 return fp; | 215 return fp; |
215 } | 216 } |
216 | 217 |
217 GLEdge2PtConicalEffect::GLEdge2PtConicalEffect(const GrProcessor&) | 218 GLEdge2PtConicalEffect::GLEdge2PtConicalEffect(const GrProcessor&) |
218 : fVSVaryingName(nullptr) | 219 : fVSVaryingName(nullptr) |
219 , fFSVaryingName(nullptr) | 220 , fFSVaryingName(nullptr) |
220 , fCachedRadius(-SK_ScalarMax) | 221 , fCachedRadius(-SK_ScalarMax) |
221 , fCachedDiffRadius(-SK_ScalarMax) {} | 222 , fCachedDiffRadius(-SK_ScalarMax) {} |
222 | 223 |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 radius2 = d->fRandom->nextRangeF(0.f, diffLen); | 478 radius2 = d->fRandom->nextRangeF(0.f, diffLen); |
478 | 479 |
479 SkColor colors[kMaxRandomGradientColors]; | 480 SkColor colors[kMaxRandomGradientColors]; |
480 SkScalar stopsArray[kMaxRandomGradientColors]; | 481 SkScalar stopsArray[kMaxRandomGradientColors]; |
481 SkScalar* stops = stopsArray; | 482 SkScalar* stops = stopsArray; |
482 SkShader::TileMode tm; | 483 SkShader::TileMode tm; |
483 int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tm); | 484 int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tm); |
484 auto shader = SkGradientShader::MakeTwoPointConical(center1, radius1, center
2, radius2, | 485 auto shader = SkGradientShader::MakeTwoPointConical(center1, radius1, center
2, radius2, |
485 colors, stops, colorCoun
t, tm); | 486 colors, stops, colorCoun
t, tm); |
486 const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext, | 487 const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext, |
487 GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality); | 488 GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality, |
| 489 SkSourceGammaTreatment::kRespect); |
488 GrAlwaysAssert(fp); | 490 GrAlwaysAssert(fp); |
489 return fp; | 491 return fp; |
490 } | 492 } |
491 | 493 |
492 GLFocalOutside2PtConicalEffect::GLFocalOutside2PtConicalEffect(const GrProcessor
& processor) | 494 GLFocalOutside2PtConicalEffect::GLFocalOutside2PtConicalEffect(const GrProcessor
& processor) |
493 : fVSVaryingName(nullptr) | 495 : fVSVaryingName(nullptr) |
494 , fFSVaryingName(nullptr) | 496 , fFSVaryingName(nullptr) |
495 , fCachedFocal(SK_ScalarMax) { | 497 , fCachedFocal(SK_ScalarMax) { |
496 const FocalOutside2PtConicalEffect& data = processor.cast<FocalOutside2PtCon
icalEffect>(); | 498 const FocalOutside2PtConicalEffect& data = processor.cast<FocalOutside2PtCon
icalEffect>(); |
497 fIsFlipped = data.isFlipped(); | 499 fIsFlipped = data.isFlipped(); |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 } while (radius1 == radius2 && center1 == center2); | 685 } while (radius1 == radius2 && center1 == center2); |
684 | 686 |
685 SkColor colors[kMaxRandomGradientColors]; | 687 SkColor colors[kMaxRandomGradientColors]; |
686 SkScalar stopsArray[kMaxRandomGradientColors]; | 688 SkScalar stopsArray[kMaxRandomGradientColors]; |
687 SkScalar* stops = stopsArray; | 689 SkScalar* stops = stopsArray; |
688 SkShader::TileMode tm; | 690 SkShader::TileMode tm; |
689 int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tm); | 691 int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tm); |
690 auto shader = SkGradientShader::MakeTwoPointConical(center1, radius1, center
2, radius2, | 692 auto shader = SkGradientShader::MakeTwoPointConical(center1, radius1, center
2, radius2, |
691 colors, stops, colorCoun
t, tm); | 693 colors, stops, colorCoun
t, tm); |
692 const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext, | 694 const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext, |
693 GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality); | 695 GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality, |
| 696 SkSourceGammaTreatment::kRespect); |
694 GrAlwaysAssert(fp); | 697 GrAlwaysAssert(fp); |
695 return fp; | 698 return fp; |
696 } | 699 } |
697 | 700 |
698 GLFocalInside2PtConicalEffect::GLFocalInside2PtConicalEffect(const GrProcessor&) | 701 GLFocalInside2PtConicalEffect::GLFocalInside2PtConicalEffect(const GrProcessor&) |
699 : fVSVaryingName(nullptr) | 702 : fVSVaryingName(nullptr) |
700 , fFSVaryingName(nullptr) | 703 , fFSVaryingName(nullptr) |
701 , fCachedFocal(SK_ScalarMax) {} | 704 , fCachedFocal(SK_ScalarMax) {} |
702 | 705 |
703 void GLFocalInside2PtConicalEffect::emitCode(EmitArgs& args) { | 706 void GLFocalInside2PtConicalEffect::emitCode(EmitArgs& args) { |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
929 } while (radius1 == radius2 && center1 == center2); | 932 } while (radius1 == radius2 && center1 == center2); |
930 | 933 |
931 SkColor colors[kMaxRandomGradientColors]; | 934 SkColor colors[kMaxRandomGradientColors]; |
932 SkScalar stopsArray[kMaxRandomGradientColors]; | 935 SkScalar stopsArray[kMaxRandomGradientColors]; |
933 SkScalar* stops = stopsArray; | 936 SkScalar* stops = stopsArray; |
934 SkShader::TileMode tm; | 937 SkShader::TileMode tm; |
935 int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tm); | 938 int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tm); |
936 auto shader = SkGradientShader::MakeTwoPointConical(center1, radius1, center
2, radius2, | 939 auto shader = SkGradientShader::MakeTwoPointConical(center1, radius1, center
2, radius2, |
937 colors, stops, colorCoun
t, tm); | 940 colors, stops, colorCoun
t, tm); |
938 const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext, | 941 const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext, |
939 GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality); | 942 GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality, |
| 943 SkSourceGammaTreatment::kRespect); |
940 GrAlwaysAssert(fp); | 944 GrAlwaysAssert(fp); |
941 return fp; | 945 return fp; |
942 } | 946 } |
943 | 947 |
944 GLCircleInside2PtConicalEffect::GLCircleInside2PtConicalEffect(const GrProcessor
& processor) | 948 GLCircleInside2PtConicalEffect::GLCircleInside2PtConicalEffect(const GrProcessor
& processor) |
945 : fVSVaryingName(nullptr) | 949 : fVSVaryingName(nullptr) |
946 , fFSVaryingName(nullptr) | 950 , fFSVaryingName(nullptr) |
947 , fCachedCenterX(SK_ScalarMax) | 951 , fCachedCenterX(SK_ScalarMax) |
948 , fCachedCenterY(SK_ScalarMax) | 952 , fCachedCenterY(SK_ScalarMax) |
949 , fCachedA(SK_ScalarMax) | 953 , fCachedA(SK_ScalarMax) |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1160 radius2 = radius1 + d->fRandom->nextRangeF(0.f, diffLen); | 1164 radius2 = radius1 + d->fRandom->nextRangeF(0.f, diffLen); |
1161 | 1165 |
1162 SkColor colors[kMaxRandomGradientColors]; | 1166 SkColor colors[kMaxRandomGradientColors]; |
1163 SkScalar stopsArray[kMaxRandomGradientColors]; | 1167 SkScalar stopsArray[kMaxRandomGradientColors]; |
1164 SkScalar* stops = stopsArray; | 1168 SkScalar* stops = stopsArray; |
1165 SkShader::TileMode tm; | 1169 SkShader::TileMode tm; |
1166 int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tm); | 1170 int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tm); |
1167 auto shader = SkGradientShader::MakeTwoPointConical(center1, radius1, center
2, radius2, | 1171 auto shader = SkGradientShader::MakeTwoPointConical(center1, radius1, center
2, radius2, |
1168 colors, stops, colorCoun
t, tm); | 1172 colors, stops, colorCoun
t, tm); |
1169 const GrFragmentProcessor* fp = shader->asFragmentProcessor( | 1173 const GrFragmentProcessor* fp = shader->asFragmentProcessor( |
1170 d->fContext,GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality)
; | 1174 d->fContext,GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality, |
| 1175 SkSourceGammaTreatment::kRespect); |
1171 GrAlwaysAssert(fp); | 1176 GrAlwaysAssert(fp); |
1172 return fp; | 1177 return fp; |
1173 } | 1178 } |
1174 | 1179 |
1175 GLCircleOutside2PtConicalEffect::GLCircleOutside2PtConicalEffect(const GrProcess
or& processor) | 1180 GLCircleOutside2PtConicalEffect::GLCircleOutside2PtConicalEffect(const GrProcess
or& processor) |
1176 : fVSVaryingName(nullptr) | 1181 : fVSVaryingName(nullptr) |
1177 , fFSVaryingName(nullptr) | 1182 , fFSVaryingName(nullptr) |
1178 , fCachedCenterX(SK_ScalarMax) | 1183 , fCachedCenterX(SK_ScalarMax) |
1179 , fCachedCenterY(SK_ScalarMax) | 1184 , fCachedCenterY(SK_ScalarMax) |
1180 , fCachedA(SK_ScalarMax) | 1185 , fCachedA(SK_ScalarMax) |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1322 return CircleInside2PtConicalEffect::Create(ctx, shader, matrix, tm, inf
o); | 1327 return CircleInside2PtConicalEffect::Create(ctx, shader, matrix, tm, inf
o); |
1323 } else if (type == kEdge_ConicalType) { | 1328 } else if (type == kEdge_ConicalType) { |
1324 set_matrix_edge_conical(shader, &matrix); | 1329 set_matrix_edge_conical(shader, &matrix); |
1325 return Edge2PtConicalEffect::Create(ctx, shader, matrix, tm); | 1330 return Edge2PtConicalEffect::Create(ctx, shader, matrix, tm); |
1326 } else { | 1331 } else { |
1327 return CircleOutside2PtConicalEffect::Create(ctx, shader, matrix, tm, in
fo); | 1332 return CircleOutside2PtConicalEffect::Create(ctx, shader, matrix, tm, in
fo); |
1328 } | 1333 } |
1329 } | 1334 } |
1330 | 1335 |
1331 #endif | 1336 #endif |
OLD | NEW |