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 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 * cheapComputDirection() and if that computed direction matches the | 557 * cheapComputDirection() and if that computed direction matches the |
558 * specified direction. If dir is kUnknown, returns true if the direction | 558 * specified direction. If dir is kUnknown, returns true if the direction |
559 * cannot be computed. | 559 * cannot be computed. |
560 */ | 560 */ |
561 bool cheapIsDirection(Direction dir) const { | 561 bool cheapIsDirection(Direction dir) const { |
562 Direction computedDir = kUnknown_Direction; | 562 Direction computedDir = kUnknown_Direction; |
563 (void)this->cheapComputeDirection(&computedDir); | 563 (void)this->cheapComputeDirection(&computedDir); |
564 return computedDir == dir; | 564 return computedDir == dir; |
565 } | 565 } |
566 | 566 |
567 enum PathAsRect { | |
568 /** The path can not draw the same as its bounds. */ | |
569 kNone_PathAsRect, | |
570 /** The path draws the same as its bounds when filled. */ | |
571 kFill_PathAsRect, | |
572 /** The path draws the same as its bounds when stroked or filled. */ | |
573 kStroke_PathAsRect, | |
574 }; | |
575 | |
576 /** Returns kFill_PathAsRect or kStroke_PathAsRect if drawing the path (eith
er filled or | |
577 stroked) will be equivalent to filling/stroking the path's bounding rect
. If | |
578 either is true, and direction is not null, sets the direction of the con
tour. If the | |
579 path is not drawn equivalent to a rect, returns kNone_PathAsRect and ign
ores direction. | |
580 | |
581 @param direction If not null, set to the contour's direction when it is
drawn as a rect | |
582 @return the path's PathAsRect type | |
583 */ | |
584 PathAsRect asRect(Direction* direction = NULL) const; | |
585 | |
586 /** | 567 /** |
587 * Returns true if the path specifies a rectangle. | 568 * Returns true if the path specifies a rectangle. |
588 * | 569 * |
589 * If this returns false, then all output parameters are ignored, and left | 570 * If this returns false, then all output parameters are ignored, and left |
590 * unchanged. If this returns true, then each of the output parameters | 571 * unchanged. If this returns true, then each of the output parameters |
591 * are checked for NULL. If they are not, they return their value. | 572 * are checked for NULL. If they are not, they return their value. |
592 * | 573 * |
593 * @param rect If not null, set to the bounds of the rectangle. | 574 * @param rect If not null, set to the bounds of the rectangle. |
594 * Note : this bounds may be smaller than the path's bounds, si
nce it is just | 575 * Note : this bounds may be smaller than the path's bounds, si
nce it is just |
595 * the bounds of the "drawable" parts of the path. e.g. a trail
ing MoveTo would | 576 * the bounds of the "drawable" parts of the path. e.g. a trail
ing MoveTo would |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 } | 1038 } |
1058 | 1039 |
1059 friend class SkAutoPathBoundsUpdate; | 1040 friend class SkAutoPathBoundsUpdate; |
1060 friend class SkAutoDisableOvalCheck; | 1041 friend class SkAutoDisableOvalCheck; |
1061 friend class SkAutoDisableDirectionCheck; | 1042 friend class SkAutoDisableDirectionCheck; |
1062 friend class SkBench_AddPathTest; // perf test reversePathTo | 1043 friend class SkBench_AddPathTest; // perf test reversePathTo |
1063 friend class PathTest_Private; // unit test reversePathTo | 1044 friend class PathTest_Private; // unit test reversePathTo |
1064 }; | 1045 }; |
1065 | 1046 |
1066 #endif | 1047 #endif |
OLD | NEW |