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

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: Response to comments by reed 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') | tests/PathTest.cpp » ('J')
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 /** Paths are concatenated. */
707 kAppend_AddPathMode,
reed1 2014/02/07 17:13:06 /** * source path contours are added as new conto
708 /** Path is added by extending the last contour of the destination path
709 with the first contour of the source path.*/
710 kJoin_AddPathMode
711 };
712
705 /** Add a copy of src to the path, offset by (dx,dy) 713 /** Add a copy of src to the path, offset by (dx,dy)
706 @param src The path to add as a new contour 714 @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 715 @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 716 @param dx The amount to translate the path in Y as it is added
709 */ 717 */
710 void addPath(const SkPath& src, SkScalar dx, SkScalar dy); 718 void addPath(const SkPath& src, SkScalar dx, SkScalar dy,
719 AddPathMode mode = kAppend_AddPathMode);
711 720
712 /** Add a copy of src to the path 721 /** Add a copy of src to the path
713 */ 722 */
714 void addPath(const SkPath& src) { 723 void addPath(const SkPath& src, AddPathMode mode = kAppend_AddPathMode) {
715 SkMatrix m; 724 SkMatrix m;
716 m.reset(); 725 m.reset();
717 this->addPath(src, m); 726 this->addPath(src, m, mode);
718 } 727 }
719 728
720 /** Add a copy of src to the path, transformed by matrix 729 /** Add a copy of src to the path, transformed by matrix
721 @param src The path to add as a new contour 730 @param src The path to add as a new contour
731 @param matrix Transform applied to src
732 @param mode Determines how path is added
722 */ 733 */
723 void addPath(const SkPath& src, const SkMatrix& matrix); 734 void addPath(const SkPath& src, const SkMatrix& matrix, AddPathMode mode = k Append_AddPathMode);
724 735
725 /** 736 /**
726 * Same as addPath(), but reverses the src input 737 * Same as addPath(), but reverses the src input
727 */ 738 */
728 void reverseAddPath(const SkPath& src); 739 void reverseAddPath(const SkPath& src);
729 740
730 /** Offset the path by (dx,dy), returning true on success 741 /** Offset the path by (dx,dy), returning true on success
731 742
732 @param dx The amount in the X direction to offset the entire path 743 @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 744 @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 } 1035 }
1025 1036
1026 friend class SkAutoPathBoundsUpdate; 1037 friend class SkAutoPathBoundsUpdate;
1027 friend class SkAutoDisableOvalCheck; 1038 friend class SkAutoDisableOvalCheck;
1028 friend class SkAutoDisableDirectionCheck; 1039 friend class SkAutoDisableDirectionCheck;
1029 friend class SkBench_AddPathTest; // perf test reversePathTo 1040 friend class SkBench_AddPathTest; // perf test reversePathTo
1030 friend class PathTest_Private; // unit test reversePathTo 1041 friend class PathTest_Private; // unit test reversePathTo
1031 }; 1042 };
1032 1043
1033 #endif 1044 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkPath.cpp » ('j') | tests/PathTest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698