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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
232 } | 232 } |
233 | 233 |
234 /** | 234 /** |
235 * Returns true if the path specifies a single line (i.e. it contains just | 235 * Returns true if the path specifies a single line (i.e. it contains just |
236 * a moveTo and a lineTo). If so, and line[] is not null, it sets the 2 | 236 * a moveTo and a lineTo). If so, and line[] is not null, it sets the 2 |
237 * points in line[] to the end-points of the line. If the path is not a | 237 * points in line[] to the end-points of the line. If the path is not a |
238 * line, returns false and ignores line[]. | 238 * line, returns false and ignores line[]. |
239 */ | 239 */ |
240 bool isLine(SkPoint line[2]) const; | 240 bool isLine(SkPoint line[2]) const; |
241 | 241 |
242 /** Returns true if the path specifies a rectangle. If so, and if rect is | |
243 not null, set rect to the bounds of the path. If the path does not | |
244 specify a rectangle, return false and ignore rect. | |
245 | |
246 @param rect If not null, returns the bounds of the path if it specifies | |
247 a rectangle | |
248 @return true if the path specifies a rectangle | |
249 */ | |
250 bool isRect(SkRect* rect) const { return this->isRect(rect, NULL, NULL); } | |
251 | |
252 /** Return the number of points in the path | 242 /** Return the number of points in the path |
253 */ | 243 */ |
254 int countPoints() const; | 244 int countPoints() const; |
255 | 245 |
256 /** Return the point at the specified index. If the index is out of range | 246 /** Return the point at the specified index. If the index is out of range |
257 (i.e. is not 0 <= index < countPoints()) then the returned coordinates | 247 (i.e. is not 0 <= index < countPoints()) then the returned coordinates |
258 will be (0,0) | 248 will be (0,0) |
259 */ | 249 */ |
260 SkPoint getPoint(int index) const; | 250 SkPoint getPoint(int index) const; |
261 | 251 |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
585 /** Returns kFill_PathAsRect or kStroke_PathAsRect if drawing the path (eith er filled or | 575 /** Returns kFill_PathAsRect or kStroke_PathAsRect if drawing the path (eith er filled or |
586 stroked) will be equivalent to filling/stroking the path's bounding rect . If | 576 stroked) will be equivalent to filling/stroking the path's bounding rect . If |
587 either is true, and direction is not null, sets the direction of the con tour. If the | 577 either is true, and direction is not null, sets the direction of the con tour. If the |
588 path is not drawn equivalent to a rect, returns kNone_PathAsRect and ign ores direction. | 578 path is not drawn equivalent to a rect, returns kNone_PathAsRect and ign ores direction. |
589 | 579 |
590 @param direction If not null, set to the contour's direction when it is drawn as a rect | 580 @param direction If not null, set to the contour's direction when it is drawn as a rect |
591 @return the path's PathAsRect type | 581 @return the path's PathAsRect type |
592 */ | 582 */ |
593 PathAsRect asRect(Direction* direction = NULL) const; | 583 PathAsRect asRect(Direction* direction = NULL) const; |
594 | 584 |
595 /** Returns true if the path specifies a rectangle. If so, and if isClosed i s | |
596 not null, set isClosed to true if the path is closed. Also, if returning true | |
597 and direction is not null, return the rect direction. If the path does n ot | |
598 specify a rectangle, return false and ignore isClosed and direction. | |
599 | |
600 @param isClosed If not null, set to true if the path is closed | |
601 @param direction If not null, set to the rectangle's direction | |
602 @return true if the path specifies a rectangle | |
603 */ | |
604 bool isRect(bool* isClosed, Direction* direction) const { | |
605 return this->isRect(NULL, isClosed, direction); | |
606 } | |
607 | |
608 /** | 585 /** |
609 * Returns true if the path specifies a rectangle. | 586 * Returns true if the path specifies a rectangle. |
610 * | 587 * |
611 * If this returns false, then all output parameters are ignored, and left | 588 * If this returns false, then all output parameters are ignored, and left |
612 * unchanged. If this returns true, then each of the output parameters | 589 * unchanged. If this returns true, then each of the output parameters |
613 * are checked for NULL. If they are not, they return their value. | 590 * are checked for NULL. If they are not, they return their value. |
614 * | 591 * |
615 * @param rect If not null, set to the bounds of the rectangle | 592 * @param rect If not null, set to the bounds of the rectangle |
reed1
2015/01/05 17:03:20
rect: Note : this bounds may be smaller than the p
| |
616 * @param isClosed If not null, set to true if the path is closed | 593 * @param isClosed If not null, set to true if the path is closed |
617 * @param direction If not null, set to the rectangle's direction | 594 * @param direction If not null, set to the rectangle's direction |
618 * @return true if the path specifies a rectangle | 595 * @return true if the path specifies a rectangle |
619 */ | 596 */ |
620 bool isRect(SkRect* rect, bool* isClosed, Direction* direction) const; | 597 bool isRect(SkRect* rect, bool* isClosed = NULL, Direction* direction = NULL ) const; |
621 | 598 |
622 /** Returns true if the path specifies a pair of nested rectangles. If so, a nd if | 599 /** Returns true if the path specifies a pair of nested rectangles. If so, a nd if |
623 rect is not null, set rect[0] to the outer rectangle and rect[1] to the inner | 600 rect is not null, set rect[0] to the outer rectangle and rect[1] to the inner |
624 rectangle. If so, and dirs is not null, set dirs[0] to the direction of | 601 rectangle. If so, and dirs is not null, set dirs[0] to the direction of |
625 the outer rectangle and dirs[1] to the direction of the inner rectangle. If | 602 the outer rectangle and dirs[1] to the direction of the inner rectangle. If |
626 the path does not specify a pair of nested rectangles, return | 603 the path does not specify a pair of nested rectangles, return |
627 false and ignore rect and dirs. | 604 false and ignore rect and dirs. |
628 | 605 |
629 @param rect If not null, returns the path as a pair of nested rectangles | 606 @param rect If not null, returns the path as a pair of nested rectangles |
630 @param dirs If not null, returns the direction of the rects | 607 @param dirs If not null, returns the direction of the rects |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1076 } | 1053 } |
1077 | 1054 |
1078 friend class SkAutoPathBoundsUpdate; | 1055 friend class SkAutoPathBoundsUpdate; |
1079 friend class SkAutoDisableOvalCheck; | 1056 friend class SkAutoDisableOvalCheck; |
1080 friend class SkAutoDisableDirectionCheck; | 1057 friend class SkAutoDisableDirectionCheck; |
1081 friend class SkBench_AddPathTest; // perf test reversePathTo | 1058 friend class SkBench_AddPathTest; // perf test reversePathTo |
1082 friend class PathTest_Private; // unit test reversePathTo | 1059 friend class PathTest_Private; // unit test reversePathTo |
1083 }; | 1060 }; |
1084 | 1061 |
1085 #endif | 1062 #endif |
OLD | NEW |