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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 if (radius <= 0) { | 555 if (radius <= 0) { |
556 return; | 556 return; |
557 } | 557 } |
558 | 558 |
559 // If src is really a rect, call our specialty strokeRect() method | 559 // If src is really a rect, call our specialty strokeRect() method |
560 { | 560 { |
561 bool isClosed; | 561 bool isClosed; |
562 SkPath::Direction dir; | 562 SkPath::Direction dir; |
563 if (src.isRect(&isClosed, &dir) && isClosed) { | 563 if (src.isRect(&isClosed, &dir) && isClosed) { |
564 this->strokeRect(src.getBounds(), dst, dir); | 564 this->strokeRect(src.getBounds(), dst, dir); |
565 // our answer should preserve the inverseness of the src | 565 // our answer should preserve the inverseness of the src, but the |
566 if (src.isInverseFillType()) { | 566 // rect should not be inverse-stroked. |
| 567 if (src.isInverseFillType() && fWidth < 0) { |
567 SkASSERT(!dst->isInverseFillType()); | 568 SkASSERT(!dst->isInverseFillType()); |
568 dst->toggleInverseFillType(); | 569 dst->toggleInverseFillType(); |
569 } | 570 } |
570 return; | 571 return; |
571 } | 572 } |
572 } | 573 } |
573 | 574 |
574 SkAutoConicToQuads converter; | 575 SkAutoConicToQuads converter; |
575 const SkScalar conicTol = SK_Scalar1 / 4; | 576 const SkScalar conicTol = SK_Scalar1 / 4; |
576 | 577 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 canvas->drawLine(pts[0].fX, pts[0].fY, pts[1].fX, pts[1].fY, paint); | 640 canvas->drawLine(pts[0].fX, pts[0].fY, pts[1].fX, pts[1].fY, paint); |
640 } | 641 } |
641 #endif | 642 #endif |
642 #if 0 | 643 #if 0 |
643 if (2 == src.countPoints()) { | 644 if (2 == src.countPoints()) { |
644 dst->setIsConvex(true); | 645 dst->setIsConvex(true); |
645 } | 646 } |
646 #endif | 647 #endif |
647 } | 648 } |
648 | 649 |
649 // our answer should preserve the inverseness of the src | 650 // our answer should preserve the inverseness of the src, but the path |
650 if (src.isInverseFillType()) { | 651 // should not be inverse-stroked. |
| 652 if (src.isInverseFillType() && fWidth < 0) { |
651 SkASSERT(!dst->isInverseFillType()); | 653 SkASSERT(!dst->isInverseFillType()); |
652 dst->toggleInverseFillType(); | 654 dst->toggleInverseFillType(); |
653 } | 655 } |
654 } | 656 } |
655 | 657 |
656 static SkPath::Direction reverse_direction(SkPath::Direction dir) { | 658 static SkPath::Direction reverse_direction(SkPath::Direction dir) { |
657 SkASSERT(SkPath::kUnknown_Direction != dir); | 659 SkASSERT(SkPath::kUnknown_Direction != dir); |
658 return SkPath::kCW_Direction == dir ? SkPath::kCCW_Direction : SkPath::kCW_D
irection; | 660 return SkPath::kCW_Direction == dir ? SkPath::kCCW_Direction : SkPath::kCW_D
irection; |
659 } | 661 } |
660 | 662 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 default: | 727 default: |
726 break; | 728 break; |
727 } | 729 } |
728 | 730 |
729 if (fWidth < SkMinScalar(rw, rh) && !fDoFill) { | 731 if (fWidth < SkMinScalar(rw, rh) && !fDoFill) { |
730 r = rect; | 732 r = rect; |
731 r.inset(radius, radius); | 733 r.inset(radius, radius); |
732 dst->addRect(r, reverse_direction(dir)); | 734 dst->addRect(r, reverse_direction(dir)); |
733 } | 735 } |
734 } | 736 } |
OLD | NEW |