| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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.h" | 8 #include "SkTwoPointConicalGradient.h" |
| 9 #include "SkTwoPointConicalGradient_gpu.h" | 9 #include "SkTwoPointConicalGradient_gpu.h" |
| 10 | 10 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 fB += fDB; | 115 fB += fDB; |
| 116 | 116 |
| 117 if (0 == countRoots) { | 117 if (0 == countRoots) { |
| 118 return TwoPtRadial::kDontDrawT; | 118 return TwoPtRadial::kDontDrawT; |
| 119 } | 119 } |
| 120 | 120 |
| 121 // Prefer the bigger t value if both give a radius(t) > 0 | 121 // Prefer the bigger t value if both give a radius(t) > 0 |
| 122 // find_quad_roots returns the values sorted, so we start with the last | 122 // find_quad_roots returns the values sorted, so we start with the last |
| 123 float t = roots[countRoots - 1]; | 123 float t = roots[countRoots - 1]; |
| 124 float r = lerp(fRec.fRadius, fRec.fDRadius, t); | 124 float r = lerp(fRec.fRadius, fRec.fDRadius, t); |
| 125 if (r <= 0) { | 125 if (r < 0) { |
| 126 t = roots[0]; // might be the same as roots[countRoots-1] | 126 t = roots[0]; // might be the same as roots[countRoots-1] |
| 127 r = lerp(fRec.fRadius, fRec.fDRadius, t); | 127 r = lerp(fRec.fRadius, fRec.fDRadius, t); |
| 128 if (r <= 0) { | 128 if (r < 0) { |
| 129 return TwoPtRadial::kDontDrawT; | 129 return TwoPtRadial::kDontDrawT; |
| 130 } | 130 } |
| 131 } | 131 } |
| 132 return SkFloatToFixed(t); | 132 return SkFloatToFixed(t); |
| 133 } | 133 } |
| 134 | 134 |
| 135 typedef void (*TwoPointConicalProc)(TwoPtRadialContext* rec, SkPMColor* dstC, | 135 typedef void (*TwoPointConicalProc)(TwoPtRadialContext* rec, SkPMColor* dstC, |
| 136 const SkPMColor* cache, int toggle, int coun
t); | 136 const SkPMColor* cache, int toggle, int coun
t); |
| 137 | 137 |
| 138 static void twopoint_clamp(TwoPtRadialContext* rec, SkPMColor* SK_RESTRICT dstC, | 138 static void twopoint_clamp(TwoPtRadialContext* rec, SkPMColor* SK_RESTRICT dstC, |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 str->appendScalar(fCenter2.fY); | 388 str->appendScalar(fCenter2.fY); |
| 389 str->append(") radius2: "); | 389 str->append(") radius2: "); |
| 390 str->appendScalar(fRadius2); | 390 str->appendScalar(fRadius2); |
| 391 str->append(" "); | 391 str->append(" "); |
| 392 | 392 |
| 393 this->INHERITED::toString(str); | 393 this->INHERITED::toString(str); |
| 394 | 394 |
| 395 str->append(")"); | 395 str->append(")"); |
| 396 } | 396 } |
| 397 #endif | 397 #endif |
| OLD | NEW |