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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 { | 507 SkPath::PathAsRect SkPath::asRect(Direction* direction) const { |
508 SK_COMPILE_ASSERT(0 == kNone_PathAsRect, path_as_rect_mismatch); | 508 SK_COMPILE_ASSERT(0 == kNone_PathAsRect, path_as_rect_mismatch); |
509 SK_COMPILE_ASSERT(1 == kStroke_PathAsRect, path_as_rect_mismatch); | 509 SK_COMPILE_ASSERT(1 == kFill_PathAsRect, path_as_rect_mismatch); |
510 SK_COMPILE_ASSERT(2 == kFill_PathAsRect, path_as_rect_mismatch); | 510 SK_COMPILE_ASSERT(2 == kStroke_PathAsRect, path_as_rect_mismatch); |
511 bool isClosed = false; | 511 bool isClosed = false; |
512 return (PathAsRect) (isRect(&isClosed, direction) + isClosed); | 512 return (PathAsRect) (isRect(&isClosed, direction) + isClosed); |
yunchao
2014/02/08 07:10:48
kFill_PathAsRect is added for those non-closed pat
| |
513 } | 513 } |
514 | 514 |
515 bool SkPath::isRect(SkRect* rect) const { | 515 bool SkPath::isRect(SkRect* rect) const { |
516 SkDEBUGCODE(this->validate();) | 516 SkDEBUGCODE(this->validate();) |
517 int currVerb = 0; | 517 int currVerb = 0; |
518 const SkPoint* pts = fPathRef->points(); | 518 const SkPoint* pts = fPathRef->points(); |
519 bool result = isRectContour(false, &currVerb, &pts, NULL, NULL); | 519 bool result = isRectContour(false, &currVerb, &pts, NULL, NULL); |
520 if (result && rect) { | 520 if (result && rect) { |
521 *rect = getBounds(); | 521 *rect = getBounds(); |
522 } | 522 } |
(...skipping 2358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2881 switch (this->getFillType()) { | 2881 switch (this->getFillType()) { |
2882 case SkPath::kEvenOdd_FillType: | 2882 case SkPath::kEvenOdd_FillType: |
2883 case SkPath::kInverseEvenOdd_FillType: | 2883 case SkPath::kInverseEvenOdd_FillType: |
2884 w &= 1; | 2884 w &= 1; |
2885 break; | 2885 break; |
2886 default: | 2886 default: |
2887 break; | 2887 break; |
2888 } | 2888 } |
2889 return SkToBool(w); | 2889 return SkToBool(w); |
2890 } | 2890 } |
OLD | NEW |