blob: 820ddc52b6f366e4633ec42c73fdb7e36979e735 [file] [log] [blame]
caryclark@google.com07393ca2013-04-08 11:47:37 +00001/*
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
12class SkPathWriter {
13public:
14 SkPathWriter(SkPath& path);
15 void close();
caryclark1049f122015-04-20 08:31:59 -070016 void conicTo(const SkPoint& pt1, const SkPoint& pt2, SkScalar weight);
caryclark@google.com07393ca2013-04-08 11:47:37 +000017 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.coma5e55922013-05-07 18:51:31 +000024 bool isEmpty() const { return fEmpty; }
caryclark@google.com07393ca2013-04-08 11:47:37 +000025 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.com32840172013-04-09 07:01:27 +000030
caryclark@google.com07393ca2013-04-08 11:47:37 +000031private:
32 bool changedSlopes(const SkPoint& pt) const;
33 void moveTo();
skia.committer@gmail.com32840172013-04-09 07:01:27 +000034
caryclark@google.com07393ca2013-04-08 11:47:37 +000035 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.com07393ca2013-04-08 11:47:37 +000045#endif /* defined(__PathOps__SkPathWriter__) */