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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
497 } | 497 } |
498 if (result && isClosed) { | 498 if (result && isClosed) { |
499 *isClosed = autoClose; | 499 *isClosed = autoClose; |
500 } | 500 } |
501 if (result && direction) { | 501 if (result && direction) { |
502 *direction = firstDirection == ((lastDirection + 1) & 3) ? kCCW_Directio n : kCW_Direction; | 502 *direction = firstDirection == ((lastDirection + 1) & 3) ? kCCW_Directio n : kCW_Direction; |
503 } | 503 } |
504 return result; | 504 return result; |
505 } | 505 } |
506 | 506 |
507 SkPath::PathAsRect SkPath::asRect(Direction* direction) const { | |
508 bool isClosed = false; | |
509 return (PathAsRect) (isRect(&isClosed, direction) + isClosed); | |
reed1
2014/01/23 18:34:20
If we're going to be tricky about selecting which
caryclark
2014/01/23 19:03:23
Done.
| |
510 } | |
511 | |
507 bool SkPath::isRect(SkRect* rect) const { | 512 bool SkPath::isRect(SkRect* rect) const { |
508 SkDEBUGCODE(this->validate();) | 513 SkDEBUGCODE(this->validate();) |
509 int currVerb = 0; | 514 int currVerb = 0; |
510 const SkPoint* pts = fPathRef->points(); | 515 const SkPoint* pts = fPathRef->points(); |
511 bool result = isRectContour(false, &currVerb, &pts, NULL, NULL); | 516 bool result = isRectContour(false, &currVerb, &pts, NULL, NULL); |
512 if (result && rect) { | 517 if (result && rect) { |
513 *rect = getBounds(); | 518 *rect = getBounds(); |
514 } | 519 } |
515 return result; | 520 return result; |
516 } | 521 } |
(...skipping 2368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2885 switch (this->getFillType()) { | 2890 switch (this->getFillType()) { |
2886 case SkPath::kEvenOdd_FillType: | 2891 case SkPath::kEvenOdd_FillType: |
2887 case SkPath::kInverseEvenOdd_FillType: | 2892 case SkPath::kInverseEvenOdd_FillType: |
2888 w &= 1; | 2893 w &= 1; |
2889 break; | 2894 break; |
2890 default: | 2895 default: |
2891 break; | 2896 break; |
2892 } | 2897 } |
2893 return SkToBool(w); | 2898 return SkToBool(w); |
2894 } | 2899 } |
OLD | NEW |