OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 // This test only works with the GPU backend. | 8 // This test only works with the GPU backend. |
9 | 9 |
10 #include "gm.h" | 10 #include "gm.h" |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 SkScalar t = SkFindQuadMaxCurvature(src); | 346 SkScalar t = SkFindQuadMaxCurvature(src); |
347 if (t == 0) { | 347 if (t == 0) { |
348 if (dst) { | 348 if (dst) { |
349 dst[0].set(src, weight); | 349 dst[0].set(src, weight); |
350 } | 350 } |
351 return 1; | 351 return 1; |
352 } else { | 352 } else { |
353 if (dst) { | 353 if (dst) { |
354 SkConic conic; | 354 SkConic conic; |
355 conic.set(src, weight); | 355 conic.set(src, weight); |
356 conic.chopAt(t, dst); | 356 if (!conic.chopAt(t, dst)) { |
| 357 dst[0].set(src, weight); |
| 358 return 1; |
| 359 } |
357 } | 360 } |
358 return 2; | 361 return 2; |
359 } | 362 } |
360 } | 363 } |
361 | 364 |
362 // Calls split_conic on the entire conic and then once more on each subsecti
on. | 365 // Calls split_conic on the entire conic and then once more on each subsecti
on. |
363 // Most cases will result in either 1 conic (chop point is not within t rang
e) | 366 // Most cases will result in either 1 conic (chop point is not within t rang
e) |
364 // or 3 points (split once and then one subsection is split again). | 367 // or 3 points (split once and then one subsection is split again). |
365 int chop_conic(const SkPoint src[3], SkConic dst[4], const SkScalar weight)
{ | 368 int chop_conic(const SkPoint src[3], SkConic dst[4], const SkScalar weight)
{ |
366 SkConic dstTemp[2]; | 369 SkConic dstTemp[2]; |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 private: | 550 private: |
548 typedef GM INHERITED; | 551 typedef GM INHERITED; |
549 }; | 552 }; |
550 | 553 |
551 DEF_GM(return new BezierCubicEffects;) | 554 DEF_GM(return new BezierCubicEffects;) |
552 DEF_GM(return new BezierConicEffects;) | 555 DEF_GM(return new BezierConicEffects;) |
553 DEF_GM(return new BezierQuadEffects;) | 556 DEF_GM(return new BezierQuadEffects;) |
554 } | 557 } |
555 | 558 |
556 #endif | 559 #endif |
OLD | NEW |