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 #ifndef SkPath_DEFINED | 10 #ifndef SkPath_DEFINED |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 * cheapComputDirection() and if that computed direction matches the | 548 * cheapComputDirection() and if that computed direction matches the |
549 * specified direction. If dir is kUnknown, returns true if the direction | 549 * specified direction. If dir is kUnknown, returns true if the direction |
550 * cannot be computed. | 550 * cannot be computed. |
551 */ | 551 */ |
552 bool cheapIsDirection(Direction dir) const { | 552 bool cheapIsDirection(Direction dir) const { |
553 Direction computedDir = kUnknown_Direction; | 553 Direction computedDir = kUnknown_Direction; |
554 (void)this->cheapComputeDirection(&computedDir); | 554 (void)this->cheapComputeDirection(&computedDir); |
555 return computedDir == dir; | 555 return computedDir == dir; |
556 } | 556 } |
557 | 557 |
| 558 enum PathAsRect { |
| 559 /** The path can not draw the same as its bounds. */ |
| 560 kNone_PathAsRect, |
| 561 /** The path draws the same as its bounds when stroked or filled. */ |
| 562 kStroke_PathAsRect, |
| 563 /** The path draws the same as its bounds when filled. */ |
| 564 kFill_PathAsRect, |
| 565 }; |
| 566 |
| 567 /** Returns kFill_PathAsRect or kStroke_PathAsRect if drawing the path (eith
er filled or |
| 568 stroked) will be equivalent to filling/stroking the path's bounding rect
. If |
| 569 either is true, and direction is not null, sets the direction of the con
tour. If the |
| 570 path is not drawn equivalent to a rect, returns kNone_PathAsRect and ign
ores direction. |
| 571 |
| 572 @param direction If not null, set to the contour's direction when it is
drawn as a rect |
| 573 @return the path's PathAsRect type |
| 574 */ |
| 575 PathAsRect asRect(Direction* direction = NULL) const; |
| 576 |
558 /** Returns true if the path specifies a rectangle. If so, and if isClosed i
s | 577 /** Returns true if the path specifies a rectangle. If so, and if isClosed i
s |
559 not null, set isClosed to true if the path is closed. Also, if returning
true | 578 not null, set isClosed to true if the path is closed. Also, if returning
true |
560 and direction is not null, return the rect direction. If the path does n
ot | 579 and direction is not null, return the rect direction. If the path does n
ot |
561 specify a rectangle, return false and ignore isClosed and direction. | 580 specify a rectangle, return false and ignore isClosed and direction. |
562 | 581 |
563 @param isClosed If not null, set to true if the path is closed | 582 @param isClosed If not null, set to true if the path is closed |
564 @param direction If not null, set to the rectangle's direction | 583 @param direction If not null, set to the rectangle's direction |
565 @return true if the path specifies a rectangle | 584 @return true if the path specifies a rectangle |
566 */ | 585 */ |
567 bool isRect(bool* isClosed, Direction* direction) const; | 586 bool isRect(bool* isClosed, Direction* direction) const; |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 friend class SkPathRef; // just for SerializationOffsets | 1033 friend class SkPathRef; // just for SerializationOffsets |
1015 #endif | 1034 #endif |
1016 friend class SkAutoPathBoundsUpdate; | 1035 friend class SkAutoPathBoundsUpdate; |
1017 friend class SkAutoDisableOvalCheck; | 1036 friend class SkAutoDisableOvalCheck; |
1018 friend class SkAutoDisableDirectionCheck; | 1037 friend class SkAutoDisableDirectionCheck; |
1019 friend class SkBench_AddPathTest; // perf test reversePathTo | 1038 friend class SkBench_AddPathTest; // perf test reversePathTo |
1020 friend class PathTest_Private; // unit test reversePathTo | 1039 friend class PathTest_Private; // unit test reversePathTo |
1021 }; | 1040 }; |
1022 | 1041 |
1023 #endif | 1042 #endif |
OLD | NEW |