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