caryclark@google.com | 07393ca | 2013-04-08 11:47:37 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2012 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | #ifndef SkPathWriter_DEFINED |
| 8 | #define SkPathWriter_DEFINED |
| 9 | |
| 10 | #include "SkPath.h" |
| 11 | |
| 12 | class SkPathWriter { |
| 13 | public: |
| 14 | SkPathWriter(SkPath& path); |
| 15 | void close(); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 16 | void conicTo(const SkPoint& pt1, const SkPoint& pt2, SkScalar weight); |
caryclark@google.com | 07393ca | 2013-04-08 11:47:37 +0000 | [diff] [blame] | 17 | void cubicTo(const SkPoint& pt1, const SkPoint& pt2, const SkPoint& pt3); |
| 18 | void deferredLine(const SkPoint& pt); |
| 19 | void deferredMove(const SkPoint& pt); |
| 20 | void deferredMoveLine(const SkPoint& pt); |
| 21 | bool hasMove() const; |
| 22 | void init(); |
| 23 | bool isClosed() const; |
caryclark@google.com | a5e5592 | 2013-05-07 18:51:31 +0000 | [diff] [blame] | 24 | bool isEmpty() const { return fEmpty; } |
caryclark@google.com | 07393ca | 2013-04-08 11:47:37 +0000 | [diff] [blame] | 25 | void lineTo(); |
| 26 | const SkPath* nativePath() const; |
| 27 | void nudge(); |
| 28 | void quadTo(const SkPoint& pt1, const SkPoint& pt2); |
| 29 | bool someAssemblyRequired() const; |
skia.committer@gmail.com | 3284017 | 2013-04-09 07:01:27 +0000 | [diff] [blame] | 30 | |
caryclark@google.com | 07393ca | 2013-04-08 11:47:37 +0000 | [diff] [blame] | 31 | private: |
| 32 | bool changedSlopes(const SkPoint& pt) const; |
| 33 | void moveTo(); |
skia.committer@gmail.com | 3284017 | 2013-04-09 07:01:27 +0000 | [diff] [blame] | 34 | |
caryclark@google.com | 07393ca | 2013-04-08 11:47:37 +0000 | [diff] [blame] | 35 | SkPath* fPathPtr; |
| 36 | SkPoint fDefer[2]; |
| 37 | SkPoint fFirstPt; |
| 38 | int fCloses; |
| 39 | int fMoves; |
| 40 | bool fEmpty; |
| 41 | bool fHasMove; |
| 42 | bool fMoved; |
| 43 | }; |
| 44 | |
caryclark@google.com | 07393ca | 2013-04-08 11:47:37 +0000 | [diff] [blame] | 45 | #endif /* defined(__PathOps__SkPathWriter__) */ |