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

Unified 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: Added test and fix for empty path case 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkPath.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkPath.h
diff --git a/include/core/SkPath.h b/include/core/SkPath.h
index dd7a672cdd4456862fa3d2715177c18a20c35668..f4dd377d618d9aea952e3441dae35746a38d6d79 100644
--- a/include/core/SkPath.h
+++ b/include/core/SkPath.h
@@ -702,25 +702,41 @@ public:
*/
void addPoly(const SkPoint pts[], int count, bool close);
+ enum AddPathMode {
+ /** Source path contours are added as new contours.
+ */
+ kAppend_AddPathMode,
+ /** Path is added by extending the last contour of the destination path
+ with the first contour of the source path. If the last contour of
+ the destination path is closed, then it will not be extended.
+ Instead, the start of source path will be extended by a straight
+ line to the end point of the destination path.
+ */
+ kExtend_AddPathMode
+ };
+
/** Add a copy of src to the path, offset by (dx,dy)
@param src The path to add as a new contour
@param dx The amount to translate the path in X as it is added
@param dx The amount to translate the path in Y as it is added
*/
- void addPath(const SkPath& src, SkScalar dx, SkScalar dy);
+ void addPath(const SkPath& src, SkScalar dx, SkScalar dy,
+ AddPathMode mode = kAppend_AddPathMode);
/** Add a copy of src to the path
*/
- void addPath(const SkPath& src) {
+ void addPath(const SkPath& src, AddPathMode mode = kAppend_AddPathMode) {
SkMatrix m;
m.reset();
- this->addPath(src, m);
+ this->addPath(src, m, mode);
}
/** Add a copy of src to the path, transformed by matrix
@param src The path to add as a new contour
+ @param matrix Transform applied to src
+ @param mode Determines how path is added
*/
- void addPath(const SkPath& src, const SkMatrix& matrix);
+ void addPath(const SkPath& src, const SkMatrix& matrix, AddPathMode mode = kAppend_AddPathMode);
/**
* Same as addPath(), but reverses the src input
« 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