| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 return SkNEW_ARGS(GLEdge2PtConicalEffect, (*this)); | 179 return SkNEW_ARGS(GLEdge2PtConicalEffect, (*this)); |
| 180 } | 180 } |
| 181 | 181 |
| 182 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(Edge2PtConicalEffect); | 182 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(Edge2PtConicalEffect); |
| 183 | 183 |
| 184 /* | 184 /* |
| 185 * All Two point conical gradient test create functions may occasionally create
edge case shaders | 185 * All Two point conical gradient test create functions may occasionally create
edge case shaders |
| 186 */ | 186 */ |
| 187 GrFragmentProcessor* Edge2PtConicalEffect::TestCreate(SkRandom* random, | 187 GrFragmentProcessor* Edge2PtConicalEffect::TestCreate(SkRandom* random, |
| 188 GrContext* context, | 188 GrContext* context, |
| 189 const GrDrawTargetCaps&, | 189 const GrCaps&, |
| 190 GrTexture**) { | 190 GrTexture**) { |
| 191 SkPoint center1 = {random->nextUScalar1(), random->nextUScalar1()}; | 191 SkPoint center1 = {random->nextUScalar1(), random->nextUScalar1()}; |
| 192 SkScalar radius1 = random->nextUScalar1(); | 192 SkScalar radius1 = random->nextUScalar1(); |
| 193 SkPoint center2; | 193 SkPoint center2; |
| 194 SkScalar radius2; | 194 SkScalar radius2; |
| 195 do { | 195 do { |
| 196 center2.set(random->nextUScalar1(), random->nextUScalar1()); | 196 center2.set(random->nextUScalar1(), random->nextUScalar1()); |
| 197 // If the circles are identical the factory will give us an empty shader
. | 197 // If the circles are identical the factory will give us an empty shader
. |
| 198 // This will happen if we pick identical centers | 198 // This will happen if we pick identical centers |
| 199 } while (center1 == center2); | 199 } while (center1 == center2); |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 return SkNEW_ARGS(GLFocalOutside2PtConicalEffect, (*this)); | 468 return SkNEW_ARGS(GLFocalOutside2PtConicalEffect, (*this)); |
| 469 } | 469 } |
| 470 | 470 |
| 471 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(FocalOutside2PtConicalEffect); | 471 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(FocalOutside2PtConicalEffect); |
| 472 | 472 |
| 473 /* | 473 /* |
| 474 * All Two point conical gradient test create functions may occasionally create
edge case shaders | 474 * All Two point conical gradient test create functions may occasionally create
edge case shaders |
| 475 */ | 475 */ |
| 476 GrFragmentProcessor* FocalOutside2PtConicalEffect::TestCreate(SkRandom* random, | 476 GrFragmentProcessor* FocalOutside2PtConicalEffect::TestCreate(SkRandom* random, |
| 477 GrContext* context
, | 477 GrContext* context
, |
| 478 const GrDrawTarget
Caps&, | 478 const GrCaps&, |
| 479 GrTexture**) { | 479 GrTexture**) { |
| 480 SkPoint center1 = {random->nextUScalar1(), random->nextUScalar1()}; | 480 SkPoint center1 = {random->nextUScalar1(), random->nextUScalar1()}; |
| 481 SkScalar radius1 = 0.f; | 481 SkScalar radius1 = 0.f; |
| 482 SkPoint center2; | 482 SkPoint center2; |
| 483 SkScalar radius2; | 483 SkScalar radius2; |
| 484 do { | 484 do { |
| 485 center2.set(random->nextUScalar1(), random->nextUScalar1()); | 485 center2.set(random->nextUScalar1(), random->nextUScalar1()); |
| 486 // Need to make sure the centers are not the same or else focal point wi
ll be inside | 486 // Need to make sure the centers are not the same or else focal point wi
ll be inside |
| 487 } while (center1 == center2); | 487 } while (center1 == center2); |
| 488 SkPoint diff = center2 - center1; | 488 SkPoint diff = center2 - center1; |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 return SkNEW_ARGS(GLFocalInside2PtConicalEffect, (*this)); | 687 return SkNEW_ARGS(GLFocalInside2PtConicalEffect, (*this)); |
| 688 } | 688 } |
| 689 | 689 |
| 690 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(FocalInside2PtConicalEffect); | 690 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(FocalInside2PtConicalEffect); |
| 691 | 691 |
| 692 /* | 692 /* |
| 693 * All Two point conical gradient test create functions may occasionally create
edge case shaders | 693 * All Two point conical gradient test create functions may occasionally create
edge case shaders |
| 694 */ | 694 */ |
| 695 GrFragmentProcessor* FocalInside2PtConicalEffect::TestCreate(SkRandom* random, | 695 GrFragmentProcessor* FocalInside2PtConicalEffect::TestCreate(SkRandom* random, |
| 696 GrContext* context, | 696 GrContext* context, |
| 697 const GrDrawTargetC
aps&, | 697 const GrCaps&, |
| 698 GrTexture**) { | 698 GrTexture**) { |
| 699 SkPoint center1 = {random->nextUScalar1(), random->nextUScalar1()}; | 699 SkPoint center1 = {random->nextUScalar1(), random->nextUScalar1()}; |
| 700 SkScalar radius1 = 0.f; | 700 SkScalar radius1 = 0.f; |
| 701 SkPoint center2; | 701 SkPoint center2; |
| 702 SkScalar radius2; | 702 SkScalar radius2; |
| 703 do { | 703 do { |
| 704 center2.set(random->nextUScalar1(), random->nextUScalar1()); | 704 center2.set(random->nextUScalar1(), random->nextUScalar1()); |
| 705 // Below makes sure radius2 is larger enouch such that the focal point | 705 // Below makes sure radius2 is larger enouch such that the focal point |
| 706 // is inside the end circle | 706 // is inside the end circle |
| 707 SkScalar increase = random->nextUScalar1(); | 707 SkScalar increase = random->nextUScalar1(); |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 return SkNEW_ARGS(GLCircleInside2PtConicalEffect, (*this)); | 943 return SkNEW_ARGS(GLCircleInside2PtConicalEffect, (*this)); |
| 944 } | 944 } |
| 945 | 945 |
| 946 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircleInside2PtConicalEffect); | 946 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircleInside2PtConicalEffect); |
| 947 | 947 |
| 948 /* | 948 /* |
| 949 * All Two point conical gradient test create functions may occasionally create
edge case shaders | 949 * All Two point conical gradient test create functions may occasionally create
edge case shaders |
| 950 */ | 950 */ |
| 951 GrFragmentProcessor* CircleInside2PtConicalEffect::TestCreate(SkRandom* random, | 951 GrFragmentProcessor* CircleInside2PtConicalEffect::TestCreate(SkRandom* random, |
| 952 GrContext* context
, | 952 GrContext* context
, |
| 953 const GrDrawTarget
Caps&, | 953 const GrCaps&, |
| 954 GrTexture**) { | 954 GrTexture**) { |
| 955 SkPoint center1 = {random->nextUScalar1(), random->nextUScalar1()}; | 955 SkPoint center1 = {random->nextUScalar1(), random->nextUScalar1()}; |
| 956 SkScalar radius1 = random->nextUScalar1() + 0.0001f; // make sure radius1 !=
0 | 956 SkScalar radius1 = random->nextUScalar1() + 0.0001f; // make sure radius1 !=
0 |
| 957 SkPoint center2; | 957 SkPoint center2; |
| 958 SkScalar radius2; | 958 SkScalar radius2; |
| 959 do { | 959 do { |
| 960 center2.set(random->nextUScalar1(), random->nextUScalar1()); | 960 center2.set(random->nextUScalar1(), random->nextUScalar1()); |
| 961 // Below makes sure that circle one is contained within circle two | 961 // Below makes sure that circle one is contained within circle two |
| 962 SkScalar increase = random->nextUScalar1(); | 962 SkScalar increase = random->nextUScalar1(); |
| 963 SkPoint diff = center2 - center1; | 963 SkPoint diff = center2 - center1; |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1182 return SkNEW_ARGS(GLCircleOutside2PtConicalEffect, (*this)); | 1182 return SkNEW_ARGS(GLCircleOutside2PtConicalEffect, (*this)); |
| 1183 } | 1183 } |
| 1184 | 1184 |
| 1185 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircleOutside2PtConicalEffect); | 1185 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircleOutside2PtConicalEffect); |
| 1186 | 1186 |
| 1187 /* | 1187 /* |
| 1188 * All Two point conical gradient test create functions may occasionally create
edge case shaders | 1188 * All Two point conical gradient test create functions may occasionally create
edge case shaders |
| 1189 */ | 1189 */ |
| 1190 GrFragmentProcessor* CircleOutside2PtConicalEffect::TestCreate(SkRandom* random, | 1190 GrFragmentProcessor* CircleOutside2PtConicalEffect::TestCreate(SkRandom* random, |
| 1191 GrContext* contex
t, | 1191 GrContext* contex
t, |
| 1192 const GrDrawTarge
tCaps&, | 1192 const GrCaps&, |
| 1193 GrTexture**) { | 1193 GrTexture**) { |
| 1194 SkPoint center1 = {random->nextUScalar1(), random->nextUScalar1()}; | 1194 SkPoint center1 = {random->nextUScalar1(), random->nextUScalar1()}; |
| 1195 SkScalar radius1 = random->nextUScalar1() + 0.0001f; // make sure radius1 !=
0 | 1195 SkScalar radius1 = random->nextUScalar1() + 0.0001f; // make sure radius1 !=
0 |
| 1196 SkPoint center2; | 1196 SkPoint center2; |
| 1197 SkScalar radius2; | 1197 SkScalar radius2; |
| 1198 SkScalar diffLen; | 1198 SkScalar diffLen; |
| 1199 do { | 1199 do { |
| 1200 center2.set(random->nextUScalar1(), random->nextUScalar1()); | 1200 center2.set(random->nextUScalar1(), random->nextUScalar1()); |
| 1201 // If the circles share a center than we can't be in the outside case | 1201 // If the circles share a center than we can't be in the outside case |
| 1202 } while (center1 == center2); | 1202 } while (center1 == center2); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1371 return CircleInside2PtConicalEffect::Create(ctx, shader, matrix, tm, inf
o); | 1371 return CircleInside2PtConicalEffect::Create(ctx, shader, matrix, tm, inf
o); |
| 1372 } else if (type == kEdge_ConicalType) { | 1372 } else if (type == kEdge_ConicalType) { |
| 1373 set_matrix_edge_conical(shader, &matrix); | 1373 set_matrix_edge_conical(shader, &matrix); |
| 1374 return Edge2PtConicalEffect::Create(ctx, shader, matrix, tm); | 1374 return Edge2PtConicalEffect::Create(ctx, shader, matrix, tm); |
| 1375 } else { | 1375 } else { |
| 1376 return CircleOutside2PtConicalEffect::Create(ctx, shader, matrix, tm, in
fo); | 1376 return CircleOutside2PtConicalEffect::Create(ctx, shader, matrix, tm, in
fo); |
| 1377 } | 1377 } |
| 1378 } | 1378 } |
| 1379 | 1379 |
| 1380 #endif | 1380 #endif |
| OLD | NEW |