| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 /** Returns true if the filltype is one of the Inverse variants */ | 77 /** Returns true if the filltype is one of the Inverse variants */ |
| 78 bool isInverseFillType() const { return IsInverseFillType((FillType)fFillTyp
e); } | 78 bool isInverseFillType() const { return IsInverseFillType((FillType)fFillTyp
e); } |
| 79 | 79 |
| 80 /** | 80 /** |
| 81 * Toggle between inverse and normal filltypes. This reverse the return | 81 * Toggle between inverse and normal filltypes. This reverse the return |
| 82 * value of isInverseFillType() | 82 * value of isInverseFillType() |
| 83 */ | 83 */ |
| 84 void toggleInverseFillType() { | 84 void toggleInverseFillType() { |
| 85 fFillType ^= 2; | 85 fFillType ^= 2; |
| 86 } | 86 } |
| 87 | 87 |
| 88 enum Convexity { | 88 enum Convexity { |
| 89 kUnknown_Convexity, | 89 kUnknown_Convexity, |
| 90 kConvex_Convexity, | 90 kConvex_Convexity, |
| 91 kConcave_Convexity | 91 kConcave_Convexity |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 /** | 94 /** |
| 95 * Return the path's convexity, as stored in the path. If it is currently u
nknown, | 95 * Return the path's convexity, as stored in the path. If it is currently u
nknown, |
| 96 * then this function will attempt to compute the convexity (and cache the
result). | 96 * then this function will attempt to compute the convexity (and cache the
result). |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 this contour, to specify the 1st control point of a cubic curve | 439 this contour, to specify the 1st control point of a cubic curve |
| 440 @param dx2 The amount to add to the x-coordinate of the last point on | 440 @param dx2 The amount to add to the x-coordinate of the last point on |
| 441 this contour, to specify the 2nd control point of a cubic curve | 441 this contour, to specify the 2nd control point of a cubic curve |
| 442 @param dy2 The amount to add to the y-coordinate of the last point on | 442 @param dy2 The amount to add to the y-coordinate of the last point on |
| 443 this contour, to specify the 2nd control point of a cubic curve | 443 this contour, to specify the 2nd control point of a cubic curve |
| 444 @param dx3 The amount to add to the x-coordinate of the last point on | 444 @param dx3 The amount to add to the x-coordinate of the last point on |
| 445 this contour, to specify the end point of a cubic curve | 445 this contour, to specify the end point of a cubic curve |
| 446 @param dy3 The amount to add to the y-coordinate of the last point on | 446 @param dy3 The amount to add to the y-coordinate of the last point on |
| 447 this contour, to specify the end point of a cubic curve | 447 this contour, to specify the end point of a cubic curve |
| 448 */ | 448 */ |
| 449 void rCubicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, | 449 void rCubicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, |
| 450 SkScalar x3, SkScalar y3); | 450 SkScalar x3, SkScalar y3); |
| 451 | 451 |
| 452 /** Append the specified arc to the path as a new contour. If the start of | 452 /** Append the specified arc to the path as a new contour. If the start of |
| 453 the path is different from the path's current last point, then an | 453 the path is different from the path's current last point, then an |
| 454 automatic lineTo() is added to connect the current contour to the start | 454 automatic lineTo() is added to connect the current contour to the start |
| 455 of the arc. However, if the path is empty, then we call moveTo() with | 455 of the arc. However, if the path is empty, then we call moveTo() with |
| 456 the first point of the arc. The sweep angle is treated mod 360. | 456 the first point of the arc. The sweep angle is treated mod 360. |
| 457 | 457 |
| 458 @param oval The bounding oval defining the shape and size of the arc | 458 @param oval The bounding oval defining the shape and size of the arc |
| 459 @param startAngle Starting angle (in degrees) where the arc begins | 459 @param startAngle Starting angle (in degrees) where the arc begins |
| 460 @param sweepAngle Sweep angle (in degrees) measured clockwise. This is | 460 @param sweepAngle Sweep angle (in degrees) measured clockwise. This is |
| 461 treated mod 360. | 461 treated mod 360. |
| 462 @param forceMoveTo If true, always begin a new contour with the arc | 462 @param forceMoveTo If true, always begin a new contour with the arc |
| 463 */ | 463 */ |
| 464 void arcTo(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle, | 464 void arcTo(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle, |
| 465 bool forceMoveTo); | 465 bool forceMoveTo); |
| 466 | 466 |
| 467 /** Append a line and arc to the current path. This is the same as the | 467 /** Append a line and arc to the current path. This is the same as the |
| 468 PostScript call "arct". | 468 PostScript call "arct". |
| 469 */ | 469 */ |
| 470 void arcTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, | 470 void arcTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, |
| 471 SkScalar radius); | 471 SkScalar radius); |
| 472 | 472 |
| 473 /** Append a line and arc to the current path. This is the same as the | 473 /** Append a line and arc to the current path. This is the same as the |
| 474 PostScript call "arct". | 474 PostScript call "arct". |
| 475 */ | 475 */ |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 kQuad_SegmentMask = 1 << 1, | 771 kQuad_SegmentMask = 1 << 1, |
| 772 kConic_SegmentMask = 1 << 2, | 772 kConic_SegmentMask = 1 << 2, |
| 773 kCubic_SegmentMask = 1 << 3, | 773 kCubic_SegmentMask = 1 << 3, |
| 774 }; | 774 }; |
| 775 | 775 |
| 776 /** | 776 /** |
| 777 * Returns a mask, where each bit corresponding to a SegmentMask is | 777 * Returns a mask, where each bit corresponding to a SegmentMask is |
| 778 * set if the path contains 1 or more segments of that type. | 778 * set if the path contains 1 or more segments of that type. |
| 779 * Returns 0 for an empty path (no segments). | 779 * Returns 0 for an empty path (no segments). |
| 780 */ | 780 */ |
| 781 uint32_t getSegmentMasks() const { return fSegmentMask; } | 781 uint32_t getSegmentMasks() const { return fPathRef->getSegmentMasks(); } |
| 782 | 782 |
| 783 enum Verb { | 783 enum Verb { |
| 784 kMove_Verb, //!< iter.next returns 1 point | 784 kMove_Verb, //!< iter.next returns 1 point |
| 785 kLine_Verb, //!< iter.next returns 2 points | 785 kLine_Verb, //!< iter.next returns 2 points |
| 786 kQuad_Verb, //!< iter.next returns 3 points | 786 kQuad_Verb, //!< iter.next returns 3 points |
| 787 kConic_Verb, //!< iter.next returns 3 points + iter.conicWeight() | 787 kConic_Verb, //!< iter.next returns 3 points + iter.conicWeight() |
| 788 kCubic_Verb, //!< iter.next returns 4 points | 788 kCubic_Verb, //!< iter.next returns 4 points |
| 789 kClose_Verb, //!< iter.next returns 1 point (contour's moveTo pt) | 789 kClose_Verb, //!< iter.next returns 1 point (contour's moveTo pt) |
| 790 kDone_Verb, //!< iter.next returns 0 points | 790 kDone_Verb, //!< iter.next returns 0 points |
| 791 }; | 791 }; |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 kNewFormat_SerializationShift = 29, // requires 1 bit | 935 kNewFormat_SerializationShift = 29, // requires 1 bit |
| 936 #endif | 936 #endif |
| 937 kUnused1_SerializationShift = 28, // 1 free bit | 937 kUnused1_SerializationShift = 28, // 1 free bit |
| 938 kDirection_SerializationShift = 26, // requires 2 bits | 938 kDirection_SerializationShift = 26, // requires 2 bits |
| 939 kUnused2_SerializationShift = 25, // 1 free bit | 939 kUnused2_SerializationShift = 25, // 1 free bit |
| 940 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TO
O | 940 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TO
O |
| 941 kOldIsOval_SerializationShift = 24, // requires 1 bit | 941 kOldIsOval_SerializationShift = 24, // requires 1 bit |
| 942 #endif | 942 #endif |
| 943 kConvexity_SerializationShift = 16, // requires 8 bits | 943 kConvexity_SerializationShift = 16, // requires 8 bits |
| 944 kFillType_SerializationShift = 8, // requires 8 bits | 944 kFillType_SerializationShift = 8, // requires 8 bits |
| 945 kSegmentMask_SerializationShift = 0 // requires 4 bits | 945 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TO
O |
| 946 kOldSegmentMask_SerializationShift = 0 // requires 4 bits |
| 947 #endif |
| 946 }; | 948 }; |
| 947 | 949 |
| 948 SkAutoTUnref<SkPathRef> fPathRef; | 950 SkAutoTUnref<SkPathRef> fPathRef; |
| 949 | 951 |
| 950 int fLastMoveToIndex; | 952 int fLastMoveToIndex; |
| 951 uint8_t fFillType; | 953 uint8_t fFillType; |
| 952 uint8_t fSegmentMask; | |
| 953 mutable uint8_t fConvexity; | 954 mutable uint8_t fConvexity; |
| 954 mutable uint8_t fDirection; | 955 mutable uint8_t fDirection; |
| 955 #ifdef SK_BUILD_FOR_ANDROID | 956 #ifdef SK_BUILD_FOR_ANDROID |
| 956 const SkPath* fSourcePath; | 957 const SkPath* fSourcePath; |
| 957 #endif | 958 #endif |
| 958 | 959 |
| 959 /** Resets all fields other than fPathRef to their initial 'empty' values. | 960 /** Resets all fields other than fPathRef to their initial 'empty' values. |
| 960 * Assumes the caller has already emptied fPathRef. | 961 * Assumes the caller has already emptied fPathRef. |
| 961 * On Android increments fGenerationID without reseting it. | 962 * On Android increments fGenerationID without reseting it. |
| 962 */ | 963 */ |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1011 friend class SkPathRef; // just for SerializationOffsets | 1012 friend class SkPathRef; // just for SerializationOffsets |
| 1012 #endif | 1013 #endif |
| 1013 friend class SkAutoPathBoundsUpdate; | 1014 friend class SkAutoPathBoundsUpdate; |
| 1014 friend class SkAutoDisableOvalCheck; | 1015 friend class SkAutoDisableOvalCheck; |
| 1015 friend class SkAutoDisableDirectionCheck; | 1016 friend class SkAutoDisableDirectionCheck; |
| 1016 friend class SkBench_AddPathTest; // perf test reversePathTo | 1017 friend class SkBench_AddPathTest; // perf test reversePathTo |
| 1017 friend class PathTest_Private; // unit test reversePathTo | 1018 friend class PathTest_Private; // unit test reversePathTo |
| 1018 }; | 1019 }; |
| 1019 | 1020 |
| 1020 #endif | 1021 #endif |
| OLD | NEW |