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