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();
16     void conicTo(const SkPoint& pt1, const SkPoint& pt2, SkScalar weight);
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;
isEmpty()24     bool isEmpty() const { return fEmpty; }
25     void lineTo();
26     const SkPath* nativePath() const;
27     void nudge();
28     void quadTo(const SkPoint& pt1, const SkPoint& pt2);
29     bool someAssemblyRequired() const;
30 
31 private:
32     bool changedSlopes(const SkPoint& pt) const;
33     void moveTo();
34 
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 
45 #endif /* defined(__PathOps__SkPathWriter__) */
46