Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Side by Side Diff: include/core/SkPath.h

Issue 151353006: Adding new 'extend' mode to SkPath::addPath (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: handle cloased paths Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/core/SkPath.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 * this->moveTo(pts[0]); 695 * this->moveTo(pts[0]);
696 * for (int i = 1; i < count; ++i) { 696 * for (int i = 1; i < count; ++i) {
697 * this->lineTo(pts[i]); 697 * this->lineTo(pts[i]);
698 * } 698 * }
699 * if (close) { 699 * if (close) {
700 * this->close(); 700 * this->close();
701 * } 701 * }
702 */ 702 */
703 void addPoly(const SkPoint pts[], int count, bool close); 703 void addPoly(const SkPoint pts[], int count, bool close);
704 704
705 enum AddPathMode {
706 /** Source path contours are added as new contours.
707 */
708 kAppend_AddPathMode,
709 /** Path is added by extending the last contour of the destination path
710 with the first contour of the source path. If the last contour of
711 the destination path is closed, it will be pseudo-extended by
reed1 2014/02/10 21:03:14 lets assume dst and src each have only 1 contour
712 starting a new contour at the last point of the destination path
713 and extending it with the first contour of the source path. It
714 follows that if the first countour of the source path is closed,
715 the new extended contour will close on the last point of the
716 destination path.
717 */
718 kExtend_AddPathMode
719 };
720
705 /** Add a copy of src to the path, offset by (dx,dy) 721 /** Add a copy of src to the path, offset by (dx,dy)
706 @param src The path to add as a new contour 722 @param src The path to add as a new contour
707 @param dx The amount to translate the path in X as it is added 723 @param dx The amount to translate the path in X as it is added
708 @param dx The amount to translate the path in Y as it is added 724 @param dx The amount to translate the path in Y as it is added
709 */ 725 */
710 void addPath(const SkPath& src, SkScalar dx, SkScalar dy); 726 void addPath(const SkPath& src, SkScalar dx, SkScalar dy,
727 AddPathMode mode = kAppend_AddPathMode);
711 728
712 /** Add a copy of src to the path 729 /** Add a copy of src to the path
713 */ 730 */
714 void addPath(const SkPath& src) { 731 void addPath(const SkPath& src, AddPathMode mode = kAppend_AddPathMode) {
715 SkMatrix m; 732 SkMatrix m;
716 m.reset(); 733 m.reset();
717 this->addPath(src, m); 734 this->addPath(src, m, mode);
718 } 735 }
719 736
720 /** Add a copy of src to the path, transformed by matrix 737 /** Add a copy of src to the path, transformed by matrix
721 @param src The path to add as a new contour 738 @param src The path to add as a new contour
739 @param matrix Transform applied to src
740 @param mode Determines how path is added
722 */ 741 */
723 void addPath(const SkPath& src, const SkMatrix& matrix); 742 void addPath(const SkPath& src, const SkMatrix& matrix, AddPathMode mode = k Append_AddPathMode);
724 743
725 /** 744 /**
726 * Same as addPath(), but reverses the src input 745 * Same as addPath(), but reverses the src input
727 */ 746 */
728 void reverseAddPath(const SkPath& src); 747 void reverseAddPath(const SkPath& src);
729 748
730 /** Offset the path by (dx,dy), returning true on success 749 /** Offset the path by (dx,dy), returning true on success
731 750
732 @param dx The amount in the X direction to offset the entire path 751 @param dx The amount in the X direction to offset the entire path
733 @param dy The amount in the Y direction to offset the entire path 752 @param dy The amount in the Y direction to offset the entire path
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 } 1043 }
1025 1044
1026 friend class SkAutoPathBoundsUpdate; 1045 friend class SkAutoPathBoundsUpdate;
1027 friend class SkAutoDisableOvalCheck; 1046 friend class SkAutoDisableOvalCheck;
1028 friend class SkAutoDisableDirectionCheck; 1047 friend class SkAutoDisableDirectionCheck;
1029 friend class SkBench_AddPathTest; // perf test reversePathTo 1048 friend class SkBench_AddPathTest; // perf test reversePathTo
1030 friend class PathTest_Private; // unit test reversePathTo 1049 friend class PathTest_Private; // unit test reversePathTo
1031 }; 1050 };
1032 1051
1033 #endif 1052 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkPath.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698