SkPath.h revision 294dd7b3d7b55ba38881cd4cabb6636abda23eb9
1ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com
28a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com/*
3ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Copyright 2006 The Android Open Source Project
48a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com *
5ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Use of this source code is governed by a BSD-style license that can be
6ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * found in the LICENSE file.
78a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com */
88a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
9ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com
108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifndef SkPath_DEFINED
118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define SkPath_DEFINED
128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkMatrix.h"
148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkTDArray.h"
158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
16f5dbe2f00f853c6a1719924bdd0c33335a53423adjsollen@google.com#ifdef ANDROID
17f5dbe2f00f853c6a1719924bdd0c33335a53423adjsollen@google.com#define GEN_ID_INC              fGenerationID++
18f5dbe2f00f853c6a1719924bdd0c33335a53423adjsollen@google.com#define GEN_ID_PTR_INC(ptr)     ptr->fGenerationID++
19f5dbe2f00f853c6a1719924bdd0c33335a53423adjsollen@google.com#else
20f5dbe2f00f853c6a1719924bdd0c33335a53423adjsollen@google.com#define GEN_ID_INC
21f5dbe2f00f853c6a1719924bdd0c33335a53423adjsollen@google.com#define GEN_ID_PTR_INC(ptr)
22f5dbe2f00f853c6a1719924bdd0c33335a53423adjsollen@google.com#endif
23f5dbe2f00f853c6a1719924bdd0c33335a53423adjsollen@google.com
24739456585a0cc52b335cd1c0a9fc6b01782a7f89reed@google.comclass SkReader32;
25739456585a0cc52b335cd1c0a9fc6b01782a7f89reed@google.comclass SkWriter32;
268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass SkAutoPathBoundsUpdate;
278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass SkString;
288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com/** \class SkPath
308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    The SkPath class encapsulates compound (multiple contour) geometric paths
328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    consisting of straight line segments, quadratic curves, and cubic curves.
338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com*/
347ffb1b21abcc7bbed5a0fc711f6dd7b9dbb4f577ctguil@chromium.orgclass SK_API SkPath {
358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.compublic:
368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkPath();
378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkPath(const SkPath&);
388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    ~SkPath();
398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkPath& operator=(const SkPath&);
413abec1d7c38e9bd786fc6057f9608f3eeec98c86reed@android.com
423abec1d7c38e9bd786fc6057f9608f3eeec98c86reed@android.com    friend bool operator==(const SkPath&, const SkPath&);
433abec1d7c38e9bd786fc6057f9608f3eeec98c86reed@android.com    friend bool operator!=(const SkPath& a, const SkPath& b) {
443abec1d7c38e9bd786fc6057f9608f3eeec98c86reed@android.com        return !(a == b);
453abec1d7c38e9bd786fc6057f9608f3eeec98c86reed@android.com    }
468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    enum FillType {
488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        /** Specifies that "inside" is computed by a non-zero sum of signed
498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            edge crossings
508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        */
518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        kWinding_FillType,
528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        /** Specifies that "inside" is computed by an odd number of edge
538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            crossings
548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        */
558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        kEvenOdd_FillType,
568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        /** Same as Winding, but draws outside of the path, rather than inside
578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        */
588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        kInverseWinding_FillType,
598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        /** Same as EvenOdd, but draws outside of the path, rather than inside
608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com         */
618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        kInverseEvenOdd_FillType
628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    };
638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Return the path's fill type. This is used to define how "inside" is
658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        computed. The default value is kWinding_FillType.
668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @return the path's fill type
688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    FillType getFillType() const { return (FillType)fFillType; }
708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Set the path's fill type. This is used to define how "inside" is
728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        computed. The default value is kWinding_FillType.
738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param ft The new fill type for this path
758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
76f5dbe2f00f853c6a1719924bdd0c33335a53423adjsollen@google.com    void setFillType(FillType ft) {
77f5dbe2f00f853c6a1719924bdd0c33335a53423adjsollen@google.com        fFillType = SkToU8(ft);
78f5dbe2f00f853c6a1719924bdd0c33335a53423adjsollen@google.com        GEN_ID_INC;
79f5dbe2f00f853c6a1719924bdd0c33335a53423adjsollen@google.com    }
808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Returns true if the filltype is one of the Inverse variants */
828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    bool isInverseFillType() const { return (fFillType & 2) != 0; }
838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
84b54455e440e66e0b1c30954d226226f49aac26d6reed@google.com    /**
85b54455e440e66e0b1c30954d226226f49aac26d6reed@google.com     *  Toggle between inverse and normal filltypes. This reverse the return
86b54455e440e66e0b1c30954d226226f49aac26d6reed@google.com     *  value of isInverseFillType()
87b54455e440e66e0b1c30954d226226f49aac26d6reed@google.com     */
88f5dbe2f00f853c6a1719924bdd0c33335a53423adjsollen@google.com    void toggleInverseFillType() {
89f5dbe2f00f853c6a1719924bdd0c33335a53423adjsollen@google.com        fFillType ^= 2;
90f5dbe2f00f853c6a1719924bdd0c33335a53423adjsollen@google.com        GEN_ID_INC;
91f5dbe2f00f853c6a1719924bdd0c33335a53423adjsollen@google.com     }
928a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
9304863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com    enum Convexity {
9404863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com        kUnknown_Convexity,
9504863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com        kConvex_Convexity,
9604863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com        kConcave_Convexity
9704863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com    };
9804863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com
9904863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com    /**
100b54455e440e66e0b1c30954d226226f49aac26d6reed@google.com     *  Return the path's convexity, as stored in the path. If it is currently
101b54455e440e66e0b1c30954d226226f49aac26d6reed@google.com     *  unknown, and the computeIfUnknown bool is true, then this will first
102b54455e440e66e0b1c30954d226226f49aac26d6reed@google.com     *  call ComputeConvexity() and then return that (cached) value.
103b54455e440e66e0b1c30954d226226f49aac26d6reed@google.com     */
104b54455e440e66e0b1c30954d226226f49aac26d6reed@google.com    Convexity getConvexity() const {
105b54455e440e66e0b1c30954d226226f49aac26d6reed@google.com        if (kUnknown_Convexity == fConvexity) {
106b54455e440e66e0b1c30954d226226f49aac26d6reed@google.com            fConvexity = (uint8_t)ComputeConvexity(*this);
107b54455e440e66e0b1c30954d226226f49aac26d6reed@google.com        }
108b54455e440e66e0b1c30954d226226f49aac26d6reed@google.com        return (Convexity)fConvexity;
109b54455e440e66e0b1c30954d226226f49aac26d6reed@google.com    }
110b54455e440e66e0b1c30954d226226f49aac26d6reed@google.com
111b54455e440e66e0b1c30954d226226f49aac26d6reed@google.com    /**
112b54455e440e66e0b1c30954d226226f49aac26d6reed@google.com     *  Return the currently cached value for convexity, even if that is set to
113b54455e440e66e0b1c30954d226226f49aac26d6reed@google.com     *  kUnknown_Convexity. Note: getConvexity() will automatically call
114b54455e440e66e0b1c30954d226226f49aac26d6reed@google.com     *  ComputeConvexity and cache its return value if the current setting is
115b54455e440e66e0b1c30954d226226f49aac26d6reed@google.com     *  kUnknown.
11604863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com     */
117b54455e440e66e0b1c30954d226226f49aac26d6reed@google.com    Convexity getConvexityOrUnknown() const { return (Convexity)fConvexity; }
11804863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com
11904863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com    /**
12004863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com     *  Store a convexity setting in the path. There is no automatic check to
12104863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com     *  see if this value actually agress with the return value from
12204863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com     *  ComputeConvexity().
123b54455e440e66e0b1c30954d226226f49aac26d6reed@google.com     *
124b54455e440e66e0b1c30954d226226f49aac26d6reed@google.com     *  Note: even if this is set to a "known" value, if the path is later
125b54455e440e66e0b1c30954d226226f49aac26d6reed@google.com     *  changed (e.g. lineTo(), addRect(), etc.) then the cached value will be
126b54455e440e66e0b1c30954d226226f49aac26d6reed@google.com     *  reset to kUnknown_Convexity.
12704863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com     */
12804863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com    void setConvexity(Convexity);
12904863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com
13004863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com    /**
13104863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com     *  Compute the convexity of the specified path. This does not look at the
13204863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com     *  value stored in the path, but computes it directly from the path's data.
13304863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com     *
134b54455e440e66e0b1c30954d226226f49aac26d6reed@google.com     *  This never returns kUnknown_Convexity.
135b54455e440e66e0b1c30954d226226f49aac26d6reed@google.com     *
13604863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com     *  If there is more than one contour, this returns kConcave_Convexity.
137b54455e440e66e0b1c30954d226226f49aac26d6reed@google.com     *  If the contour is degenerate (e.g. there are fewer than 3 non-degenerate
138b54455e440e66e0b1c30954d226226f49aac26d6reed@google.com     *  segments), then this returns kConvex_Convexity.
13904863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com     *  The contour is treated as if it were closed, even if there is no kClose
14004863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com     *  verb.
1416b82d1adc6a4726e36674e468ff1157e0b75373freed@android.com     */
14204863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com    static Convexity ComputeConvexity(const SkPath&);
1436b82d1adc6a4726e36674e468ff1157e0b75373freed@android.com
14404863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com    /**
14504863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com     *  DEPRECATED: use getConvexity()
14604863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com     *  Returns true if the path is flagged as being convex. This is not a
14704863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com     *  confirmed by any analysis, it is just the value set earlier.
14804863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com     */
14904863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com    bool isConvex() const {
15004863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com        return kConvex_Convexity == this->getConvexity();
15104863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com    }
15204863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com
15304863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com    /**
15404863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com     *  DEPRECATED: use setConvexity()
15504863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com     *  Set the isConvex flag to true or false. Convex paths may draw faster if
15604863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com     *  this flag is set, though setting this to true on a path that is in fact
15704863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com     *  not convex can give undefined results when drawn. Paths default to
15804863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com     *  isConvex == false
1596b82d1adc6a4726e36674e468ff1157e0b75373freed@android.com     */
160f5dbe2f00f853c6a1719924bdd0c33335a53423adjsollen@google.com    void setIsConvex(bool isConvex) {
16104863fa14a44ddf85acbc6268690ebc3f0d1d6dbreed@google.com        this->setConvexity(isConvex ? kConvex_Convexity : kConcave_Convexity);
162f5dbe2f00f853c6a1719924bdd0c33335a53423adjsollen@google.com    }
1636b82d1adc6a4726e36674e468ff1157e0b75373freed@android.com
1648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Clear any lines and curves from the path, making it empty. This frees up
1658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        internal storage associated with those segments.
1666b82d1adc6a4726e36674e468ff1157e0b75373freed@android.com        This does NOT change the fill-type setting nor isConvex
1678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
1688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void reset();
1698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
1708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Similar to reset(), in that all lines and curves are removed from the
1718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        path. However, any internal storage for those lines/curves is retained,
1728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        making reuse of the path potentially faster.
1736b82d1adc6a4726e36674e468ff1157e0b75373freed@android.com        This does NOT change the fill-type setting nor isConvex
1748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
1758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void rewind();
1768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
1778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Returns true if the path is empty (contains no lines or curves)
1788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
1798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @return true if the path is empty (contains no lines or curves)
1808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
1818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    bool isEmpty() const;
1828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
1838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Returns true if the path specifies a rectangle. If so, and if rect is
1848a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        not null, set rect to the bounds of the path. If the path does not
1858a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        specify a rectangle, return false and ignore rect.
1868a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
1878a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param rect If not null, returns the bounds of the path if it specifies
1888a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                    a rectangle
1898a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @return true if the path specifies a rectangle
1908a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
1918a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    bool isRect(SkRect* rect) const;
1928a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
193d3aa4ff7a564953dff9a15ff03fd42eebf64569freed@android.com    /** Return the number of points in the path
194d3aa4ff7a564953dff9a15ff03fd42eebf64569freed@android.com     */
195d3aa4ff7a564953dff9a15ff03fd42eebf64569freed@android.com    int countPoints() const {
196d3aa4ff7a564953dff9a15ff03fd42eebf64569freed@android.com        return this->getPoints(NULL, 0);
197d3aa4ff7a564953dff9a15ff03fd42eebf64569freed@android.com    }
198d3aa4ff7a564953dff9a15ff03fd42eebf64569freed@android.com
199d3aa4ff7a564953dff9a15ff03fd42eebf64569freed@android.com    /** Return the point at the specified index. If the index is out of range
200d3aa4ff7a564953dff9a15ff03fd42eebf64569freed@android.com         (i.e. is not 0 <= index < countPoints()) then the returned coordinates
201d3aa4ff7a564953dff9a15ff03fd42eebf64569freed@android.com         will be (0,0)
202d3aa4ff7a564953dff9a15ff03fd42eebf64569freed@android.com     */
203d3aa4ff7a564953dff9a15ff03fd42eebf64569freed@android.com    SkPoint getPoint(int index) const;
204d3aa4ff7a564953dff9a15ff03fd42eebf64569freed@android.com
2058a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Returns the number of points in the path. Up to max points are copied.
2068a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
2078a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param points If not null, receives up to max points
2088a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param max The maximum number of points to copy into points
2098a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @return the actual number of points in the path
2108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
2118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    int getPoints(SkPoint points[], int max) const;
2128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
2138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    //! Swap contents of this and other. Guaranteed not to throw
2148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void swap(SkPath& other);
2158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
216d252db03d9650013b545ef9781fe993c07f8f314reed@android.com    /** Returns the bounds of the path's points. If the path contains 0 or 1
217d252db03d9650013b545ef9781fe993c07f8f314reed@android.com        points, the bounds is set to (0,0,0,0), and isEmpty() will return true.
218d252db03d9650013b545ef9781fe993c07f8f314reed@android.com        Note: this bounds may be larger than the actual shape, since curves
219d252db03d9650013b545ef9781fe993c07f8f314reed@android.com        do not extend as far as their control points.
220d252db03d9650013b545ef9781fe993c07f8f314reed@android.com    */
221d252db03d9650013b545ef9781fe993c07f8f314reed@android.com    const SkRect& getBounds() const {
222d252db03d9650013b545ef9781fe993c07f8f314reed@android.com        if (fBoundsIsDirty) {
223d252db03d9650013b545ef9781fe993c07f8f314reed@android.com            this->computeBounds();
224d252db03d9650013b545ef9781fe993c07f8f314reed@android.com        }
225d252db03d9650013b545ef9781fe993c07f8f314reed@android.com        return fBounds;
226d252db03d9650013b545ef9781fe993c07f8f314reed@android.com    }
2278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
2288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Calling this will, if the internal cache of the bounds is out of date,
229d252db03d9650013b545ef9781fe993c07f8f314reed@android.com        update it so that subsequent calls to getBounds will be instanteous.
2308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        This also means that any copies or simple transformations of the path
2318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        will inherit the cached bounds.
232d252db03d9650013b545ef9781fe993c07f8f314reed@android.com     */
233d252db03d9650013b545ef9781fe993c07f8f314reed@android.com    void updateBoundsCache() const {
234d252db03d9650013b545ef9781fe993c07f8f314reed@android.com        // for now, just calling getBounds() is sufficient
235d252db03d9650013b545ef9781fe993c07f8f314reed@android.com        this->getBounds();
236d252db03d9650013b545ef9781fe993c07f8f314reed@android.com    }
2378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
2388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    //  Construction methods
2398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
2408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Hint to the path to prepare for adding more points. This can allow the
2418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        path to more efficiently grow its storage.
2428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
2438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param extraPtCount The number of extra points the path should
2448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                            preallocate for.
2458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
2468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void incReserve(unsigned extraPtCount);
2478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
2488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Set the beginning of the next contour to the point (x,y).
2498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
2508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param x    The x-coordinate of the start of a new contour
2518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param y    The y-coordinate of the start of a new contour
2528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
2538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void moveTo(SkScalar x, SkScalar y);
2548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
2558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Set the beginning of the next contour to the point
2568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
2578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param p    The start of a new contour
2588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
2598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void moveTo(const SkPoint& p) {
2608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        this->moveTo(p.fX, p.fY);
2618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
2628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
2638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Set the beginning of the next contour relative to the last point on the
2648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        previous contour. If there is no previous contour, this is treated the
2658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        same as moveTo().
2668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
2678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param dx   The amount to add to the x-coordinate of the end of the
2688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                    previous contour, to specify the start of a new contour
2698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param dy   The amount to add to the y-coordinate of the end of the
2708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                    previous contour, to specify the start of a new contour
2718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
2728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void rMoveTo(SkScalar dx, SkScalar dy);
2738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
2748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Add a line from the last point to the specified point (x,y). If no
2758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        moveTo() call has been made for this contour, the first point is
2768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        automatically set to (0,0).
2778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
2788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param x    The x-coordinate of the end of a line
2798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param y    The y-coordinate of the end of a line
2808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
2818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void lineTo(SkScalar x, SkScalar y);
2828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
2838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Add a line from the last point to the specified point. If no moveTo()
2848a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        call has been made for this contour, the first point is automatically
2858a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        set to (0,0).
2868a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
2878a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param p    The end of a line
2888a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
2898a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void lineTo(const SkPoint& p) {
2908a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        this->lineTo(p.fX, p.fY);
2918a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
2928a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
2938a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Same as lineTo, but the coordinates are considered relative to the last
2948a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        point on this contour. If there is no previous point, then a moveTo(0,0)
2958a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        is inserted automatically.
2968a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
2978a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param dx   The amount to add to the x-coordinate of the previous point
2988a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                    on this contour, to specify a line
2998a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param dy   The amount to add to the y-coordinate of the previous point
3008a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                    on this contour, to specify a line
3018a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
3028a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void rLineTo(SkScalar dx, SkScalar dy);
3038a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
3048a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Add a quadratic bezier from the last point, approaching control point
3058a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        (x1,y1), and ending at (x2,y2). If no moveTo() call has been made for
3068a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        this contour, the first point is automatically set to (0,0).
3078a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
3088a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param x1   The x-coordinate of the control point on a quadratic curve
3098a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param y1   The y-coordinate of the control point on a quadratic curve
3108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param x2   The x-coordinate of the end point on a quadratic curve
3118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param y2   The y-coordinate of the end point on a quadratic curve
3128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
3138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void quadTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2);
3148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
3158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Add a quadratic bezier from the last point, approaching control point
3168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        p1, and ending at p2. If no moveTo() call has been made for this
3178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        contour, the first point is automatically set to (0,0).
3188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
3198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param p1   The control point on a quadratic curve
3208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param p2   The end point on a quadratic curve
3218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
3228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void quadTo(const SkPoint& p1, const SkPoint& p2) {
3238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        this->quadTo(p1.fX, p1.fY, p2.fX, p2.fY);
3248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
3258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
3268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Same as quadTo, but the coordinates are considered relative to the last
3278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        point on this contour. If there is no previous point, then a moveTo(0,0)
3288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        is inserted automatically.
3298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
3308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param dx1   The amount to add to the x-coordinate of the last point on
3318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                this contour, to specify the control point of a quadratic curve
3328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param dy1   The amount to add to the y-coordinate of the last point on
3338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                this contour, to specify the control point of a quadratic curve
3348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param dx2   The amount to add to the x-coordinate of the last point on
3358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                     this contour, to specify the end point of a quadratic curve
3368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param dy2   The amount to add to the y-coordinate of the last point on
3378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                     this contour, to specify the end point of a quadratic curve
3388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
3398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void rQuadTo(SkScalar dx1, SkScalar dy1, SkScalar dx2, SkScalar dy2);
3408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
3418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Add a cubic bezier from the last point, approaching control points
3428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        (x1,y1) and (x2,y2), and ending at (x3,y3). If no moveTo() call has been
3438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        made for this contour, the first point is automatically set to (0,0).
3448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
3458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param x1   The x-coordinate of the 1st control point on a cubic curve
3468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param y1   The y-coordinate of the 1st control point on a cubic curve
3478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param x2   The x-coordinate of the 2nd control point on a cubic curve
3488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param y2   The y-coordinate of the 2nd control point on a cubic curve
3498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param x3   The x-coordinate of the end point on a cubic curve
3508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param y3   The y-coordinate of the end point on a cubic curve
3518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
3528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void cubicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2,
3538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                 SkScalar x3, SkScalar y3);
3548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
3558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Add a cubic bezier from the last point, approaching control points p1
3568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        and p2, and ending at p3. If no moveTo() call has been made for this
3578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        contour, the first point is automatically set to (0,0).
3588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
3598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param p1   The 1st control point on a cubic curve
3608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param p2   The 2nd control point on a cubic curve
3618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param p3   The end point on a cubic curve
3628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
3638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void cubicTo(const SkPoint& p1, const SkPoint& p2, const SkPoint& p3) {
3648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        this->cubicTo(p1.fX, p1.fY, p2.fX, p2.fY, p3.fX, p3.fY);
3658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
3668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
3678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Same as cubicTo, but the coordinates are considered relative to the
3688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        current point on this contour. If there is no previous point, then a
3698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        moveTo(0,0) is inserted automatically.
3708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
3718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param dx1   The amount to add to the x-coordinate of the last point on
3728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                this contour, to specify the 1st control point of a cubic curve
3738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param dy1   The amount to add to the y-coordinate of the last point on
3748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                this contour, to specify the 1st control point of a cubic curve
3758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param dx2   The amount to add to the x-coordinate of the last point on
3768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                this contour, to specify the 2nd control point of a cubic curve
3778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param dy2   The amount to add to the y-coordinate of the last point on
3788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                this contour, to specify the 2nd control point of a cubic curve
3798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param dx3   The amount to add to the x-coordinate of the last point on
3808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                     this contour, to specify the end point of a cubic curve
3818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param dy3   The amount to add to the y-coordinate of the last point on
3828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                     this contour, to specify the end point of a cubic curve
3838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
3848a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void    rCubicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2,
3858a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                     SkScalar x3, SkScalar y3);
3868a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
3878a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Append the specified arc to the path as a new contour. If the start of
3888a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        the path is different from the path's current last point, then an
3898a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        automatic lineTo() is added to connect the current contour to the start
3908a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        of the arc. However, if the path is empty, then we call moveTo() with
3918a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        the first point of the arc. The sweep angle is treated mod 360.
3928a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
3938a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param oval The bounding oval defining the shape and size of the arc
3948a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param startAngle Starting angle (in degrees) where the arc begins
3958a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param sweepAngle Sweep angle (in degrees) measured clockwise. This is
3968a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                          treated mod 360.
3978a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param forceMoveTo If true, always begin a new contour with the arc
3988a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
3998a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void    arcTo(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle,
4008a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                  bool forceMoveTo);
4018a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
4028a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Append a line and arc to the current path. This is the same as the
4038a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        PostScript call "arct".
4048a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
4058a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void arcTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2,
4068a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com               SkScalar radius);
4078a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
4088a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Append a line and arc to the current path. This is the same as the
4098a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        PostScript call "arct".
4108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
4118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void arcTo(const SkPoint p1, const SkPoint p2, SkScalar radius) {
4128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        this->arcTo(p1.fX, p1.fY, p2.fX, p2.fY, radius);
4138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
4148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
4158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Close the current contour. If the current point is not equal to the
4168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        first point of the contour, a line segment is automatically added.
4178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
4188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void close();
4198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
4208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    enum Direction {
4218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        /** clockwise direction for adding closed contours */
4228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        kCW_Direction,
4238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        /** counter-clockwise direction for adding closed contours */
4248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        kCCW_Direction
4258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    };
4268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
4278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Add a closed rectangle contour to the path
4288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param rect The rectangle to add as a closed contour to the path
4298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param dir  The direction to wind the rectangle's contour
4308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
4318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void    addRect(const SkRect& rect, Direction dir = kCW_Direction);
4328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
4338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Add a closed rectangle contour to the path
4348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
4358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param left     The left side of a rectangle to add as a closed contour
4368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                        to the path
4378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param top      The top of a rectangle to add as a closed contour to the
4388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                        path
4398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param right    The right side of a rectangle to add as a closed contour
4408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                        to the path
4418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param bottom   The bottom of a rectangle to add as a closed contour to
4428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                        the path
4438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param dir      The direction to wind the rectangle's contour
4448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
4458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void addRect(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom,
4468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                 Direction dir = kCW_Direction);
4478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
4488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Add a closed oval contour to the path
4498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
4508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param oval The bounding oval to add as a closed contour to the path
4518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param dir  The direction to wind the oval's contour
4528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
4538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void addOval(const SkRect& oval, Direction dir = kCW_Direction);
4548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
4558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Add a closed circle contour to the path
4568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
4578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param x        The x-coordinate of the center of a circle to add as a
4588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                        closed contour to the path
4598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param y        The y-coordinate of the center of a circle to add as a
4608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                        closed contour to the path
4618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param radius   The radius of a circle to add as a closed contour to the
4628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                        path
4638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param dir      The direction to wind the circle's contour
4648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
4658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void addCircle(SkScalar x, SkScalar y, SkScalar radius,
4668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                   Direction dir = kCW_Direction);
4678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
4688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Add the specified arc to the path as a new contour.
4698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
4708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param oval The bounds of oval used to define the size of the arc
4718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param startAngle Starting angle (in degrees) where the arc begins
4728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param sweepAngle Sweep angle (in degrees) measured clockwise
4738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
4748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void addArc(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle);
4758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
4768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Add a closed round-rectangle contour to the path
4778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param rect The bounds of a round-rectangle to add as a closed contour
4788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param rx   The x-radius of the rounded corners on the round-rectangle
4798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param ry   The y-radius of the rounded corners on the round-rectangle
4808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param dir  The direction to wind the round-rectangle's contour
4818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
4828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void    addRoundRect(const SkRect& rect, SkScalar rx, SkScalar ry,
4838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                         Direction dir = kCW_Direction);
4848a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
4858a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Add a closed round-rectangle contour to the path. Each corner receives
4868a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        two radius values [X, Y]. The corners are ordered top-left, top-right,
4878a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        bottom-right, bottom-left.
4888a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param rect The bounds of a round-rectangle to add as a closed contour
4898a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param radii Array of 8 scalars, 4 [X,Y] pairs for each corner
4908a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param dir  The direction to wind the round-rectangle's contour
4918a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        */
4928a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void addRoundRect(const SkRect& rect, const SkScalar radii[],
4938a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                      Direction dir = kCW_Direction);
4948a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
4958a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Add a copy of src to the path, offset by (dx,dy)
4968a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param src  The path to add as a new contour
4978a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param dx   The amount to translate the path in X as it is added
4988a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param dx   The amount to translate the path in Y as it is added
4998a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
5008a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void    addPath(const SkPath& src, SkScalar dx, SkScalar dy);
5018a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
5028a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Add a copy of src to the path
5038a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
5048a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void addPath(const SkPath& src) {
5058a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        SkMatrix m;
5068a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        m.reset();
5078a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        this->addPath(src, m);
5088a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
5098a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
5108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Add a copy of src to the path, transformed by matrix
5118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param src  The path to add as a new contour
5128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
5138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void addPath(const SkPath& src, const SkMatrix& matrix);
5148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
5158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Offset the path by (dx,dy), returning true on success
5168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
5178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param dx   The amount in the X direction to offset the entire path
5188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param dy   The amount in the Y direction to offset the entire path
5198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param dst  The translated path is written here
5208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
5218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void offset(SkScalar dx, SkScalar dy, SkPath* dst) const;
5228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
5238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Offset the path by (dx,dy), returning true on success
5248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
5258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param dx   The amount in the X direction to offset the entire path
5268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param dy   The amount in the Y direction to offset the entire path
5278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
5288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void offset(SkScalar dx, SkScalar dy) {
5298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        this->offset(dx, dy, this);
5308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
5318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
5328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Transform the points in this path by matrix, and write the answer into
5338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        dst.
5348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
5358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param matrix   The matrix to apply to the path
5368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param dst      The transformed path is written here
5378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
5388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void transform(const SkMatrix& matrix, SkPath* dst) const;
5398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
5408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Transform the points in this path by matrix
5418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
5428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param matrix The matrix to apply to the path
5438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
5448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void transform(const SkMatrix& matrix) {
5458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        this->transform(matrix, this);
5468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
5478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
5488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Return the last point on the path. If no points have been added, (0,0)
549294dd7b3d7b55ba38881cd4cabb6636abda23eb9reed@google.com        is returned. If there are no points, this returns false, otherwise it
550294dd7b3d7b55ba38881cd4cabb6636abda23eb9reed@google.com        returns true.
5518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
5528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param lastPt   The last point on the path is returned here
5538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
554294dd7b3d7b55ba38881cd4cabb6636abda23eb9reed@google.com    bool getLastPt(SkPoint* lastPt) const;
5558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
5568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Set the last point on the path. If no points have been added,
5578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        moveTo(x,y) is automatically called.
5588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
5598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param x    The new x-coordinate for the last point
5608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param y    The new y-coordinate for the last point
5618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
5628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void setLastPt(SkScalar x, SkScalar y);
5638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
5648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Set the last point on the path. If no points have been added, moveTo(p)
5658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        is automatically called.
5668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
5678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        @param p    The new location for the last point
5688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
5698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void setLastPt(const SkPoint& p) {
5708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        this->setLastPt(p.fX, p.fY);
5718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
5728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
57310296ccb6a63c65b2e60733a929bf15d8bf94309reed@google.com    enum SegmentMask {
57410296ccb6a63c65b2e60733a929bf15d8bf94309reed@google.com        kLine_SegmentMask   = 1 << 0,
57510296ccb6a63c65b2e60733a929bf15d8bf94309reed@google.com        kQuad_SegmentMask   = 1 << 1,
57610296ccb6a63c65b2e60733a929bf15d8bf94309reed@google.com        kCubic_SegmentMask  = 1 << 2
57710296ccb6a63c65b2e60733a929bf15d8bf94309reed@google.com    };
57810296ccb6a63c65b2e60733a929bf15d8bf94309reed@google.com
57910296ccb6a63c65b2e60733a929bf15d8bf94309reed@google.com    /**
58010296ccb6a63c65b2e60733a929bf15d8bf94309reed@google.com     *  Returns a mask, where each bit corresponding to a SegmentMask is
58110296ccb6a63c65b2e60733a929bf15d8bf94309reed@google.com     *  set if the path contains 1 or more segments of that type.
58210296ccb6a63c65b2e60733a929bf15d8bf94309reed@google.com     *  Returns 0 for an empty path (no segments).
58310296ccb6a63c65b2e60733a929bf15d8bf94309reed@google.com     */
58410296ccb6a63c65b2e60733a929bf15d8bf94309reed@google.com    uint32_t getSegmentMasks() const { return fSegmentMask; }
58510296ccb6a63c65b2e60733a929bf15d8bf94309reed@google.com
5868a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    enum Verb {
5878a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        kMove_Verb,     //!< iter.next returns 1 point
5888a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        kLine_Verb,     //!< iter.next returns 2 points
5898a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        kQuad_Verb,     //!< iter.next returns 3 points
5908a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        kCubic_Verb,    //!< iter.next returns 4 points
591b3b8dfa31326c51dab8b5ed569e19ee715582d1bbsalomon@google.com        kClose_Verb,    //!< iter.next returns 1 point (contour's moveTo pt)
5928a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        kDone_Verb      //!< iter.next returns 0 points
5938a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    };
5948a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
5958a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Iterate through all of the segments (lines, quadratics, cubics) of
5968a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        each contours in a path.
5978a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
5987ffb1b21abcc7bbed5a0fc711f6dd7b9dbb4f577ctguil@chromium.org    class SK_API Iter {
5998a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    public:
6008a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                Iter();
6018a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                Iter(const SkPath&, bool forceClose);
6028a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
6038a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        void setPath(const SkPath&, bool forceClose);
6048a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
6058a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        /** Return the next verb in this iteration of the path. When all
6068a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            segments have been visited, return kDone_Verb.
6078a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
6088a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            @param  pts The points representing the current verb and/or segment
6098a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            @return The verb for the current segment
6108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        */
6118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        Verb next(SkPoint pts[4]);
6128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
6138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        /** If next() returns kLine_Verb, then this query returns true if the
6148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            line was the result of a close() command (i.e. the end point is the
6158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            initial moveto for this contour). If next() returned a different
6168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            verb, this returns an undefined value.
6178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
6188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            @return If the last call to next() returned kLine_Verb, return true
6198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                    if it was the result of an explicit close command.
6208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        */
6218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        bool isCloseLine() const { return SkToBool(fCloseLine); }
6228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
6238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        /** Returns true if the current contour is closed (has a kClose_Verb)
6248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com            @return true if the current contour is closed (has a kClose_Verb)
6258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        */
6268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        bool isClosedContour() const;
6278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
6288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    private:
6298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        const SkPoint*  fPts;
6308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        const uint8_t*  fVerbs;
6318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        const uint8_t*  fVerbStop;
6328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        SkPoint         fMoveTo;
6338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        SkPoint         fLastPt;
6348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        SkBool8         fForceClose;
6358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        SkBool8         fNeedClose;
6368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        SkBool8         fNeedMoveTo;
6378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        SkBool8         fCloseLine;
6388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
6398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        bool cons_moveTo(SkPoint pts[1]);
6408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        Verb autoClose(SkPoint pts[2]);
6418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    };
6428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
6438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void dump(bool forceClose, const char title[] = NULL) const;
644e522ca5d5f249bd51a00cb68bb051f811d0a9e85reed@android.com    void dump() const;
6458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
646739456585a0cc52b335cd1c0a9fc6b01782a7f89reed@google.com    void flatten(SkWriter32&) const;
647739456585a0cc52b335cd1c0a9fc6b01782a7f89reed@google.com    void unflatten(SkReader32&);
6488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
649f5dbe2f00f853c6a1719924bdd0c33335a53423adjsollen@google.com#ifdef ANDROID
650f5dbe2f00f853c6a1719924bdd0c33335a53423adjsollen@google.com    uint32_t getGenerationID() const;
651f5dbe2f00f853c6a1719924bdd0c33335a53423adjsollen@google.com#endif
652f5dbe2f00f853c6a1719924bdd0c33335a53423adjsollen@google.com
6538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkDEBUGCODE(void validate() const;)
6548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
6558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comprivate:
6568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkTDArray<SkPoint>  fPts;
6578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkTDArray<uint8_t>  fVerbs;
658d252db03d9650013b545ef9781fe993c07f8f314reed@android.com    mutable SkRect      fBounds;
6598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    uint8_t             fFillType;
66010296ccb6a63c65b2e60733a929bf15d8bf94309reed@google.com    uint8_t             fSegmentMask;
66110296ccb6a63c65b2e60733a929bf15d8bf94309reed@google.com    mutable uint8_t     fBoundsIsDirty;
662b54455e440e66e0b1c30954d226226f49aac26d6reed@google.com    mutable uint8_t     fConvexity;
663f5dbe2f00f853c6a1719924bdd0c33335a53423adjsollen@google.com#ifdef ANDROID
664f5dbe2f00f853c6a1719924bdd0c33335a53423adjsollen@google.com    uint32_t            fGenerationID;
665f5dbe2f00f853c6a1719924bdd0c33335a53423adjsollen@google.com#endif
6668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
667d252db03d9650013b545ef9781fe993c07f8f314reed@android.com    // called, if dirty, by getBounds()
668d252db03d9650013b545ef9781fe993c07f8f314reed@android.com    void computeBounds() const;
669d252db03d9650013b545ef9781fe993c07f8f314reed@android.com
6708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    friend class Iter;
6718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void cons_moveto();
6728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
6738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    friend class SkPathStroker;
6748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /*  Append the first contour of path, ignoring path's initial point. If no
6758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        moveTo() call has been made for this contour, the first point is
6768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        automatically set to (0,0).
6778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
6788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void pathTo(const SkPath& path);
6798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
6808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /*  Append, in reverse order, the first contour of path, ignoring path's
6818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        last point. If no moveTo() call has been made for this contour, the
6828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        first point is automatically set to (0,0).
6838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
6848a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void reversePathTo(const SkPath&);
6858a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
6868a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    friend const SkPoint* sk_get_path_points(const SkPath&, int index);
6878a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    friend class SkAutoPathBoundsUpdate;
6888a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com};
6898a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
6908a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif
6918a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
692