OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 The Android Open Source Project |
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 "SkStrokerPriv.h" | 8 #include "SkStrokerPriv.h" |
9 #include "SkGeometry.h" | 9 #include "SkGeometry.h" |
10 #include "SkPath.h" | 10 #include "SkPath.h" |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 | 417 |
418 this->postJoinTo(pt2, normalBC, unitBC); | 418 this->postJoinTo(pt2, normalBC, unitBC); |
419 } | 419 } |
420 | 420 |
421 void SkPathStroker::cubicTo(const SkPoint& pt1, const SkPoint& pt2, | 421 void SkPathStroker::cubicTo(const SkPoint& pt1, const SkPoint& pt2, |
422 const SkPoint& pt3) { | 422 const SkPoint& pt3) { |
423 bool degenerateAB = SkPath::IsLineDegenerate(fPrevPt, pt1); | 423 bool degenerateAB = SkPath::IsLineDegenerate(fPrevPt, pt1); |
424 bool degenerateBC = SkPath::IsLineDegenerate(pt1, pt2); | 424 bool degenerateBC = SkPath::IsLineDegenerate(pt1, pt2); |
425 bool degenerateCD = SkPath::IsLineDegenerate(pt2, pt3); | 425 bool degenerateCD = SkPath::IsLineDegenerate(pt2, pt3); |
426 | 426 |
427 if (degenerateAB + degenerateBC + degenerateCD >= 2) { | 427 if (degenerateAB + degenerateBC + degenerateCD >= 2 |
| 428 || (degenerateAB && SkPath::IsLineDegenerate(fPrevPt, pt2))) { |
428 this->lineTo(pt3); | 429 this->lineTo(pt3); |
429 return; | 430 return; |
430 } | 431 } |
431 | 432 |
432 SkVector normalAB, unitAB, normalCD, unitCD; | 433 SkVector normalAB, unitAB, normalCD, unitCD; |
433 | 434 |
434 // find the first tangent (which might be pt1 or pt2 | 435 // find the first tangent (which might be pt1 or pt2 |
435 { | 436 { |
436 const SkPoint* nextPt = &pt1; | 437 const SkPoint* nextPt = &pt1; |
437 if (degenerateAB) | 438 if (degenerateAB) |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 default: | 726 default: |
726 break; | 727 break; |
727 } | 728 } |
728 | 729 |
729 if (fWidth < SkMinScalar(rw, rh) && !fDoFill) { | 730 if (fWidth < SkMinScalar(rw, rh) && !fDoFill) { |
730 r = rect; | 731 r = rect; |
731 r.inset(radius, radius); | 732 r.inset(radius, radius); |
732 dst->addRect(r, reverse_direction(dir)); | 733 dst->addRect(r, reverse_direction(dir)); |
733 } | 734 } |
734 } | 735 } |
OLD | NEW |