OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SkTwoPointConicalGradient_gpu.h" | 9 #include "SkTwoPointConicalGradient_gpu.h" |
10 | 10 |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 SkScalar* stops = stopsArray; | 209 SkScalar* stops = stopsArray; |
210 SkShader::TileMode tm; | 210 SkShader::TileMode tm; |
211 int colorCount = RandomGradientParams(random, colors, &stops, &tm); | 211 int colorCount = RandomGradientParams(random, colors, &stops, &tm); |
212 SkAutoTUnref<SkShader> shader(SkGradientShader::CreateTwoPointConical(center
1, radius1, | 212 SkAutoTUnref<SkShader> shader(SkGradientShader::CreateTwoPointConical(center
1, radius1, |
213 center
2, radius2, | 213 center
2, radius2, |
214 colors
, stops, colorCount, | 214 colors
, stops, colorCount, |
215 tm)); | 215 tm)); |
216 SkPaint paint; | 216 SkPaint paint; |
217 GrFragmentProcessor* fp; | 217 GrFragmentProcessor* fp; |
218 GrColor paintColor; | 218 GrColor paintColor; |
219 SkAssertResult(shader->asFragmentProcessor(context, paint, NULL, &paintColor
, &fp)); | 219 SkAssertResult(shader->asFragmentProcessor(context, paint, |
| 220 GrProcessorUnitTest::TestMatrix(r
andom), NULL, |
| 221 &paintColor, &fp)); |
220 return fp; | 222 return fp; |
221 } | 223 } |
222 | 224 |
223 GLEdge2PtConicalEffect::GLEdge2PtConicalEffect(const GrProcessor&) | 225 GLEdge2PtConicalEffect::GLEdge2PtConicalEffect(const GrProcessor&) |
224 : fVSVaryingName(NULL) | 226 : fVSVaryingName(NULL) |
225 , fFSVaryingName(NULL) | 227 , fFSVaryingName(NULL) |
226 , fCachedRadius(-SK_ScalarMax) | 228 , fCachedRadius(-SK_ScalarMax) |
227 , fCachedDiffRadius(-SK_ScalarMax) {} | 229 , fCachedDiffRadius(-SK_ScalarMax) {} |
228 | 230 |
229 void GLEdge2PtConicalEffect::emitCode(GrGLFPBuilder* builder, | 231 void GLEdge2PtConicalEffect::emitCode(GrGLFPBuilder* builder, |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 SkScalar* stops = stopsArray; | 495 SkScalar* stops = stopsArray; |
494 SkShader::TileMode tm; | 496 SkShader::TileMode tm; |
495 int colorCount = RandomGradientParams(random, colors, &stops, &tm); | 497 int colorCount = RandomGradientParams(random, colors, &stops, &tm); |
496 SkAutoTUnref<SkShader> shader(SkGradientShader::CreateTwoPointConical(center
1, radius1, | 498 SkAutoTUnref<SkShader> shader(SkGradientShader::CreateTwoPointConical(center
1, radius1, |
497 center
2, radius2, | 499 center
2, radius2, |
498 colors
, stops, colorCount, | 500 colors
, stops, colorCount, |
499 tm)); | 501 tm)); |
500 SkPaint paint; | 502 SkPaint paint; |
501 GrFragmentProcessor* effect; | 503 GrFragmentProcessor* effect; |
502 GrColor paintColor; | 504 GrColor paintColor; |
503 SkAssertResult(shader->asFragmentProcessor(context, paint, NULL, &paintColor
, &effect)); | 505 |
| 506 SkAssertResult(shader->asFragmentProcessor(context, paint, |
| 507 GrProcessorUnitTest::TestMatrix(r
andom), NULL, |
| 508 &paintColor, &effect)); |
504 return effect; | 509 return effect; |
505 } | 510 } |
506 | 511 |
507 GLFocalOutside2PtConicalEffect::GLFocalOutside2PtConicalEffect(const GrProcessor
& processor) | 512 GLFocalOutside2PtConicalEffect::GLFocalOutside2PtConicalEffect(const GrProcessor
& processor) |
508 : fVSVaryingName(NULL) | 513 : fVSVaryingName(NULL) |
509 , fFSVaryingName(NULL) | 514 , fFSVaryingName(NULL) |
510 , fCachedFocal(SK_ScalarMax) { | 515 , fCachedFocal(SK_ScalarMax) { |
511 const FocalOutside2PtConicalEffect& data = processor.cast<FocalOutside2PtCon
icalEffect>(); | 516 const FocalOutside2PtConicalEffect& data = processor.cast<FocalOutside2PtCon
icalEffect>(); |
512 fIsFlipped = data.isFlipped(); | 517 fIsFlipped = data.isFlipped(); |
513 } | 518 } |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 SkScalar* stops = stopsArray; | 716 SkScalar* stops = stopsArray; |
712 SkShader::TileMode tm; | 717 SkShader::TileMode tm; |
713 int colorCount = RandomGradientParams(random, colors, &stops, &tm); | 718 int colorCount = RandomGradientParams(random, colors, &stops, &tm); |
714 SkAutoTUnref<SkShader> shader(SkGradientShader::CreateTwoPointConical(center
1, radius1, | 719 SkAutoTUnref<SkShader> shader(SkGradientShader::CreateTwoPointConical(center
1, radius1, |
715 center
2, radius2, | 720 center
2, radius2, |
716 colors
, stops, colorCount, | 721 colors
, stops, colorCount, |
717 tm)); | 722 tm)); |
718 SkPaint paint; | 723 SkPaint paint; |
719 GrColor paintColor; | 724 GrColor paintColor; |
720 GrFragmentProcessor* fp; | 725 GrFragmentProcessor* fp; |
721 SkAssertResult(shader->asFragmentProcessor(context, paint, NULL, &paintColor
, &fp)); | 726 SkAssertResult(shader->asFragmentProcessor(context, paint, |
| 727 GrProcessorUnitTest::TestMatrix(r
andom), NULL, |
| 728 &paintColor, &fp)); |
722 return fp; | 729 return fp; |
723 } | 730 } |
724 | 731 |
725 GLFocalInside2PtConicalEffect::GLFocalInside2PtConicalEffect(const GrProcessor&) | 732 GLFocalInside2PtConicalEffect::GLFocalInside2PtConicalEffect(const GrProcessor&) |
726 : fVSVaryingName(NULL) | 733 : fVSVaryingName(NULL) |
727 , fFSVaryingName(NULL) | 734 , fFSVaryingName(NULL) |
728 , fCachedFocal(SK_ScalarMax) {} | 735 , fCachedFocal(SK_ScalarMax) {} |
729 | 736 |
730 void GLFocalInside2PtConicalEffect::emitCode(GrGLFPBuilder* builder, | 737 void GLFocalInside2PtConicalEffect::emitCode(GrGLFPBuilder* builder, |
731 const GrFragmentProcessor& fp, | 738 const GrFragmentProcessor& fp, |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 SkScalar* stops = stopsArray; | 971 SkScalar* stops = stopsArray; |
965 SkShader::TileMode tm; | 972 SkShader::TileMode tm; |
966 int colorCount = RandomGradientParams(random, colors, &stops, &tm); | 973 int colorCount = RandomGradientParams(random, colors, &stops, &tm); |
967 SkAutoTUnref<SkShader> shader(SkGradientShader::CreateTwoPointConical(center
1, radius1, | 974 SkAutoTUnref<SkShader> shader(SkGradientShader::CreateTwoPointConical(center
1, radius1, |
968 center
2, radius2, | 975 center
2, radius2, |
969 colors
, stops, colorCount, | 976 colors
, stops, colorCount, |
970 tm)); | 977 tm)); |
971 SkPaint paint; | 978 SkPaint paint; |
972 GrColor paintColor; | 979 GrColor paintColor; |
973 GrFragmentProcessor* processor; | 980 GrFragmentProcessor* processor; |
974 SkAssertResult(shader->asFragmentProcessor(context, paint, NULL, &paintColor
, &processor)); | 981 SkAssertResult(shader->asFragmentProcessor(context, paint, |
| 982 GrProcessorUnitTest::TestMatrix(r
andom), NULL, |
| 983 &paintColor, &processor)); |
975 return processor; | 984 return processor; |
976 } | 985 } |
977 | 986 |
978 GLCircleInside2PtConicalEffect::GLCircleInside2PtConicalEffect(const GrProcessor
& processor) | 987 GLCircleInside2PtConicalEffect::GLCircleInside2PtConicalEffect(const GrProcessor
& processor) |
979 : fVSVaryingName(NULL) | 988 : fVSVaryingName(NULL) |
980 , fFSVaryingName(NULL) | 989 , fFSVaryingName(NULL) |
981 , fCachedCenterX(SK_ScalarMax) | 990 , fCachedCenterX(SK_ScalarMax) |
982 , fCachedCenterY(SK_ScalarMax) | 991 , fCachedCenterY(SK_ScalarMax) |
983 , fCachedA(SK_ScalarMax) | 992 , fCachedA(SK_ScalarMax) |
984 , fCachedB(SK_ScalarMax) | 993 , fCachedB(SK_ScalarMax) |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1203 SkScalar* stops = stopsArray; | 1212 SkScalar* stops = stopsArray; |
1204 SkShader::TileMode tm; | 1213 SkShader::TileMode tm; |
1205 int colorCount = RandomGradientParams(random, colors, &stops, &tm); | 1214 int colorCount = RandomGradientParams(random, colors, &stops, &tm); |
1206 SkAutoTUnref<SkShader> shader(SkGradientShader::CreateTwoPointConical(center
1, radius1, | 1215 SkAutoTUnref<SkShader> shader(SkGradientShader::CreateTwoPointConical(center
1, radius1, |
1207 center
2, radius2, | 1216 center
2, radius2, |
1208 colors
, stops, colorCount, | 1217 colors
, stops, colorCount, |
1209 tm)); | 1218 tm)); |
1210 SkPaint paint; | 1219 SkPaint paint; |
1211 GrColor paintColor; | 1220 GrColor paintColor; |
1212 GrFragmentProcessor* processor; | 1221 GrFragmentProcessor* processor; |
1213 SkAssertResult(shader->asFragmentProcessor(context, paint, NULL, &paintColor
, &processor)); | 1222 |
| 1223 SkAssertResult(shader->asFragmentProcessor(context, paint, |
| 1224 GrProcessorUnitTest::TestMatrix(r
andom), NULL, |
| 1225 &paintColor, &processor)); |
1214 return processor; | 1226 return processor; |
1215 } | 1227 } |
1216 | 1228 |
1217 GLCircleOutside2PtConicalEffect::GLCircleOutside2PtConicalEffect(const GrProcess
or& processor) | 1229 GLCircleOutside2PtConicalEffect::GLCircleOutside2PtConicalEffect(const GrProcess
or& processor) |
1218 : fVSVaryingName(NULL) | 1230 : fVSVaryingName(NULL) |
1219 , fFSVaryingName(NULL) | 1231 , fFSVaryingName(NULL) |
1220 , fCachedCenterX(SK_ScalarMax) | 1232 , fCachedCenterX(SK_ScalarMax) |
1221 , fCachedCenterY(SK_ScalarMax) | 1233 , fCachedCenterY(SK_ScalarMax) |
1222 , fCachedA(SK_ScalarMax) | 1234 , fCachedA(SK_ScalarMax) |
1223 , fCachedB(SK_ScalarMax) | 1235 , fCachedB(SK_ScalarMax) |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1360 return CircleInside2PtConicalEffect::Create(ctx, shader, matrix, tm, inf
o); | 1372 return CircleInside2PtConicalEffect::Create(ctx, shader, matrix, tm, inf
o); |
1361 } else if (type == kEdge_ConicalType) { | 1373 } else if (type == kEdge_ConicalType) { |
1362 set_matrix_edge_conical(shader, &matrix); | 1374 set_matrix_edge_conical(shader, &matrix); |
1363 return Edge2PtConicalEffect::Create(ctx, shader, matrix, tm); | 1375 return Edge2PtConicalEffect::Create(ctx, shader, matrix, tm); |
1364 } else { | 1376 } else { |
1365 return CircleOutside2PtConicalEffect::Create(ctx, shader, matrix, tm, in
fo); | 1377 return CircleOutside2PtConicalEffect::Create(ctx, shader, matrix, tm, in
fo); |
1366 } | 1378 } |
1367 } | 1379 } |
1368 | 1380 |
1369 #endif | 1381 #endif |
OLD | NEW |