OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkBuffer.h" | 10 #include "SkBuffer.h" |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 return result; | 593 return result; |
594 } | 594 } |
595 | 595 |
596 bool SkPath::isRect(bool* isClosed, Direction* direction) const { | 596 bool SkPath::isRect(bool* isClosed, Direction* direction) const { |
597 SkDEBUGCODE(this->validate();) | 597 SkDEBUGCODE(this->validate();) |
598 int currVerb = 0; | 598 int currVerb = 0; |
599 const SkPoint* pts = fPathRef->points(); | 599 const SkPoint* pts = fPathRef->points(); |
600 return isRectContour(false, &currVerb, &pts, isClosed, direction); | 600 return isRectContour(false, &currVerb, &pts, isClosed, direction); |
601 } | 601 } |
602 | 602 |
603 bool SkPath::isNestedRects(SkRect rects[2]) const { | 603 bool SkPath::isNestedRects(SkRect rects[2], Direction dirs[2]) const { |
604 SkDEBUGCODE(this->validate();) | 604 SkDEBUGCODE(this->validate();) |
605 int currVerb = 0; | 605 int currVerb = 0; |
606 const SkPoint* pts = fPathRef->points(); | 606 const SkPoint* pts = fPathRef->points(); |
607 const SkPoint* first = pts; | 607 const SkPoint* first = pts; |
608 if (!isRectContour(true, &currVerb, &pts, NULL, NULL)) { | 608 Direction testDirs[2]; |
| 609 if (!isRectContour(true, &currVerb, &pts, NULL, &testDirs[0])) { |
609 return false; | 610 return false; |
610 } | 611 } |
611 const SkPoint* last = pts; | 612 const SkPoint* last = pts; |
612 SkRect testRects[2]; | 613 SkRect testRects[2]; |
613 if (isRectContour(false, &currVerb, &pts, NULL, NULL)) { | 614 if (isRectContour(false, &currVerb, &pts, NULL, &testDirs[1])) { |
614 testRects[0].set(first, SkToS32(last - first)); | 615 testRects[0].set(first, SkToS32(last - first)); |
615 testRects[1].set(last, SkToS32(pts - last)); | 616 testRects[1].set(last, SkToS32(pts - last)); |
616 if (testRects[0].contains(testRects[1])) { | 617 if (testRects[0].contains(testRects[1])) { |
617 if (rects) { | 618 if (rects) { |
618 rects[0] = testRects[0]; | 619 rects[0] = testRects[0]; |
619 rects[1] = testRects[1]; | 620 rects[1] = testRects[1]; |
620 } | 621 } |
| 622 if (dirs) { |
| 623 dirs[0] = testDirs[0]; |
| 624 dirs[1] = testDirs[1]; |
| 625 } |
621 return true; | 626 return true; |
622 } | 627 } |
623 if (testRects[1].contains(testRects[0])) { | 628 if (testRects[1].contains(testRects[0])) { |
624 if (rects) { | 629 if (rects) { |
625 rects[0] = testRects[1]; | 630 rects[0] = testRects[1]; |
626 rects[1] = testRects[0]; | 631 rects[1] = testRects[0]; |
627 } | 632 } |
| 633 if (dirs) { |
| 634 dirs[0] = testDirs[1]; |
| 635 dirs[1] = testDirs[0]; |
| 636 } |
628 return true; | 637 return true; |
629 } | 638 } |
630 } | 639 } |
631 return false; | 640 return false; |
632 } | 641 } |
633 | 642 |
634 int SkPath::countPoints() const { | 643 int SkPath::countPoints() const { |
635 return fPathRef->countPoints(); | 644 return fPathRef->countPoints(); |
636 } | 645 } |
637 | 646 |
(...skipping 2322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2960 switch (this->getFillType()) { | 2969 switch (this->getFillType()) { |
2961 case SkPath::kEvenOdd_FillType: | 2970 case SkPath::kEvenOdd_FillType: |
2962 case SkPath::kInverseEvenOdd_FillType: | 2971 case SkPath::kInverseEvenOdd_FillType: |
2963 w &= 1; | 2972 w &= 1; |
2964 break; | 2973 break; |
2965 default: | 2974 default: |
2966 break; | 2975 break; |
2967 } | 2976 } |
2968 return SkToBool(w); | 2977 return SkToBool(w); |
2969 } | 2978 } |
OLD | NEW |