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 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 } | 580 } |
581 if (result && isClosed) { | 581 if (result && isClosed) { |
582 *isClosed = autoClose; | 582 *isClosed = autoClose; |
583 } | 583 } |
584 if (result && direction) { | 584 if (result && direction) { |
585 *direction = firstDirection == ((lastDirection + 1) & 3) ? kCCW_Directio
n : kCW_Direction; | 585 *direction = firstDirection == ((lastDirection + 1) & 3) ? kCCW_Directio
n : kCW_Direction; |
586 } | 586 } |
587 return result; | 587 return result; |
588 } | 588 } |
589 | 589 |
590 bool SkPath::isRect(SkRect* rect) const { | 590 bool SkPath::isRect(SkRect* rect, bool* isClosed, Direction* direction) const { |
591 SkDEBUGCODE(this->validate();) | 591 SkDEBUGCODE(this->validate();) |
592 int currVerb = 0; | 592 int currVerb = 0; |
593 const SkPoint* pts = fPathRef->points(); | 593 const SkPoint* pts = fPathRef->points(); |
594 bool result = isRectContour(false, &currVerb, &pts, NULL, NULL); | 594 const SkPoint* first = pts; |
595 if (result && rect) { | 595 if (!this->isRectContour(false, &currVerb, &pts, isClosed, direction)) { |
596 *rect = getBounds(); | 596 return false; |
597 } | 597 } |
598 return result; | 598 |
599 } | 599 if (rect) { |
600 | 600 rect->set(first, SkToS32(pts - first)); |
601 bool SkPath::isRect(bool* isClosed, Direction* direction) const { | 601 } |
602 SkDEBUGCODE(this->validate();) | 602 return true; |
603 int currVerb = 0; | |
604 const SkPoint* pts = fPathRef->points(); | |
605 return isRectContour(false, &currVerb, &pts, isClosed, direction); | |
606 } | 603 } |
607 | 604 |
608 bool SkPath::isNestedRects(SkRect rects[2], Direction dirs[2]) const { | 605 bool SkPath::isNestedRects(SkRect rects[2], Direction dirs[2]) const { |
609 SkDEBUGCODE(this->validate();) | 606 SkDEBUGCODE(this->validate();) |
610 int currVerb = 0; | 607 int currVerb = 0; |
611 const SkPoint* pts = fPathRef->points(); | 608 const SkPoint* pts = fPathRef->points(); |
612 const SkPoint* first = pts; | 609 const SkPoint* first = pts; |
613 Direction testDirs[2]; | 610 Direction testDirs[2]; |
614 if (!isRectContour(true, &currVerb, &pts, NULL, &testDirs[0])) { | 611 if (!isRectContour(true, &currVerb, &pts, NULL, &testDirs[0])) { |
615 return false; | 612 return false; |
(...skipping 2439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3055 switch (this->getFillType()) { | 3052 switch (this->getFillType()) { |
3056 case SkPath::kEvenOdd_FillType: | 3053 case SkPath::kEvenOdd_FillType: |
3057 case SkPath::kInverseEvenOdd_FillType: | 3054 case SkPath::kInverseEvenOdd_FillType: |
3058 w &= 1; | 3055 w &= 1; |
3059 break; | 3056 break; |
3060 default: | 3057 default: |
3061 break; | 3058 break; |
3062 } | 3059 } |
3063 return SkToBool(w); | 3060 return SkToBool(w); |
3064 } | 3061 } |
OLD | NEW |