| 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 17 matching lines...) Expand all Loading... |
| 279 @return the actual number of verbs in the path | 269 @return the actual number of verbs in the path |
| 280 */ | 270 */ |
| 281 int getVerbs(uint8_t verbs[], int max) const; | 271 int getVerbs(uint8_t verbs[], int max) const; |
| 282 | 272 |
| 283 //! Swap contents of this and other. Guaranteed not to throw | 273 //! Swap contents of this and other. Guaranteed not to throw |
| 284 void swap(SkPath& other); | 274 void swap(SkPath& other); |
| 285 | 275 |
| 286 /** Returns the bounds of the path's points. If the path contains 0 or 1 | 276 /** Returns the bounds of the path's points. If the path contains 0 or 1 |
| 287 points, the bounds is set to (0,0,0,0), and isEmpty() will return true. | 277 points, the bounds is set to (0,0,0,0), and isEmpty() will return true. |
| 288 Note: this bounds may be larger than the actual shape, since curves | 278 Note: this bounds may be larger than the actual shape, since curves |
| 289 do not extend as far as their control points. | 279 do not extend as far as their control points. Additionally this bound |
| 280 can contain trailing MoveTo points (cf. isRect). |
| 290 */ | 281 */ |
| 291 const SkRect& getBounds() const { | 282 const SkRect& getBounds() const { |
| 292 return fPathRef->getBounds(); | 283 return fPathRef->getBounds(); |
| 293 } | 284 } |
| 294 | 285 |
| 295 /** Calling this will, if the internal cache of the bounds is out of date, | 286 /** Calling this will, if the internal cache of the bounds is out of date, |
| 296 update it so that subsequent calls to getBounds will be instantaneous. | 287 update it so that subsequent calls to getBounds will be instantaneous. |
| 297 This also means that any copies or simple transformations of the path | 288 This also means that any copies or simple transformations of the path |
| 298 will inherit the cached bounds. | 289 will inherit the cached bounds. |
| 299 */ | 290 */ |
| (...skipping 285 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 | 576 /** 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 | 577 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 | 578 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. | 579 path is not drawn equivalent to a rect, returns kNone_PathAsRect and ign
ores direction. |
| 589 | 580 |
| 590 @param direction If not null, set to the contour's direction when it is
drawn as a rect | 581 @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 | 582 @return the path's PathAsRect type |
| 592 */ | 583 */ |
| 593 PathAsRect asRect(Direction* direction = NULL) const; | 584 PathAsRect asRect(Direction* direction = NULL) const; |
| 594 | 585 |
| 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 /** | 586 /** |
| 609 * Returns true if the path specifies a rectangle. | 587 * Returns true if the path specifies a rectangle. |
| 610 * | 588 * |
| 611 * If this returns false, then all output parameters are ignored, and left | 589 * If this returns false, then all output parameters are ignored, and left |
| 612 * unchanged. If this returns true, then each of the output parameters | 590 * unchanged. If this returns true, then each of the output parameters |
| 613 * are checked for NULL. If they are not, they return their value. | 591 * are checked for NULL. If they are not, they return their value. |
| 614 * | 592 * |
| 615 * @param rect If not null, set to the bounds of the rectangle | 593 * @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 |
| 595 * the bounds of the "drawable" parts of the path. e.g. a trail
ing MoveTo would |
| 596 * be ignored in this rect, but not by the path's bounds |
| 616 * @param isClosed If not null, set to true if the path is closed | 597 * @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 | 598 * @param direction If not null, set to the rectangle's direction |
| 618 * @return true if the path specifies a rectangle | 599 * @return true if the path specifies a rectangle |
| 619 */ | 600 */ |
| 620 bool isRect(SkRect* rect, bool* isClosed, Direction* direction) const; | 601 bool isRect(SkRect* rect, bool* isClosed = NULL, Direction* direction = NULL
) const; |
| 621 | 602 |
| 622 /** Returns true if the path specifies a pair of nested rectangles. If so, a
nd if | 603 /** 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 | 604 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 | 605 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 | 606 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 | 607 the path does not specify a pair of nested rectangles, return |
| 627 false and ignore rect and dirs. | 608 false and ignore rect and dirs. |
| 628 | 609 |
| 629 @param rect If not null, returns the path as a pair of nested rectangles | 610 @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 | 611 @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 } | 1057 } |
| 1077 | 1058 |
| 1078 friend class SkAutoPathBoundsUpdate; | 1059 friend class SkAutoPathBoundsUpdate; |
| 1079 friend class SkAutoDisableOvalCheck; | 1060 friend class SkAutoDisableOvalCheck; |
| 1080 friend class SkAutoDisableDirectionCheck; | 1061 friend class SkAutoDisableDirectionCheck; |
| 1081 friend class SkBench_AddPathTest; // perf test reversePathTo | 1062 friend class SkBench_AddPathTest; // perf test reversePathTo |
| 1082 friend class PathTest_Private; // unit test reversePathTo | 1063 friend class PathTest_Private; // unit test reversePathTo |
| 1083 }; | 1064 }; |
| 1084 | 1065 |
| 1085 #endif | 1066 #endif |
| OLD | NEW |