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 SkPathEffect_DEFINED
118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define SkPathEffect_DEFINED
128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkFlattenable.h"
14629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com#include "SkPath.h"
15629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com#include "SkPoint.h"
16629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com#include "SkRect.h"
175f74cf8c49701f514b69dc6f1a8b5c0ffd78af0asugoi@google.com#include "SkStrokeRec.h"
18629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com#include "SkTDArray.h"
198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass SkPath;
218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com/** \class SkPathEffect
238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkPathEffect is the base class for objects in the SkPaint that affect
258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    the geometry of a drawing primitive before it is transformed by the
268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    canvas' matrix and drawn.
278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    Dashing is implemented as a subclass of SkPathEffect.
298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com*/
307ffb1b21abcc7bbed5a0fc711f6dd7b9dbb4f577ctguil@chromium.orgclass SK_API SkPathEffect : public SkFlattenable {
318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.compublic:
320456e0b7b85060e9b9597ce414c4c2b19aff4f58robertphillips@google.com    SK_DECLARE_INST_COUNT(SkPathEffect)
330456e0b7b85060e9b9597ce414c4c2b19aff4f58robertphillips@google.com
34fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com    /**
35fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com     *  Given a src path (input) and a stroke-rec (input and output), apply
36fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com     *  this effect to the src path, returning the new path in dst, and return
37fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com     *  true. If this effect cannot be applied, return false and ignore dst
38fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com     *  and stroke-rec.
39fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com     *
40fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com     *  The stroke-rec specifies the initial request for stroking (if any).
41fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com     *  The effect can treat this as input only, or it can choose to change
42fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com     *  the rec as well. For example, the effect can decide to change the
43fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com     *  stroke's width or join, or the effect can change the rec from stroke
44fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com     *  to fill (or fill to stroke) in addition to returning a new (dst) path.
45fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com     *
46fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com     *  If this method returns true, the caller will apply (as needed) the
47fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com     *  resulting stroke-rec to dst and then draw.
48fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com     */
49548a1f321011292359ef163f78c8a1d4871b3b7freed@google.com    virtual bool filterPath(SkPath* dst, const SkPath& src,
504bbdeac58cc928dc66296bde3bd06e78070d96b7reed@google.com                            SkStrokeRec*, const SkRect* cullR) const = 0;
518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
52e4f10a70807166484e5a6303a5cd0034e5e87abareed@google.com    /**
53e4f10a70807166484e5a6303a5cd0034e5e87abareed@google.com     *  Compute a conservative bounds for its effect, given the src bounds.
54e4f10a70807166484e5a6303a5cd0034e5e87abareed@google.com     *  The baseline implementation just assigns src to dst.
55e4f10a70807166484e5a6303a5cd0034e5e87abareed@google.com     */
56548a1f321011292359ef163f78c8a1d4871b3b7freed@google.com    virtual void computeFastBounds(SkRect* dst, const SkRect& src) const;
57e4f10a70807166484e5a6303a5cd0034e5e87abareed@google.com
58629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com    /** \class PointData
59629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com
60629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com        PointData aggregates all the information needed to draw the point
61687c57c7d5a17549f63e0b15208db18b220e2a91skia.committer@gmail.com        primitives returned by an 'asPoints' call.
62629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com    */
63629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com    class PointData {
64629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com    public:
65629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com        PointData()
66935ad026826fb7d31d562ff7326b84ec3a827456robertphillips@google.com            : fFlags(0)
67935ad026826fb7d31d562ff7326b84ec3a827456robertphillips@google.com            , fPoints(NULL)
68935ad026826fb7d31d562ff7326b84ec3a827456robertphillips@google.com            , fNumPoints(0) {
69629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com            fSize.set(SK_Scalar1, SK_Scalar1);
70687c57c7d5a17549f63e0b15208db18b220e2a91skia.committer@gmail.com            // 'asPoints' needs to initialize/fill-in 'fClipRect' if it sets
71629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com            // the kUseClip flag
72629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com        };
73935ad026826fb7d31d562ff7326b84ec3a827456robertphillips@google.com        ~PointData() {
74935ad026826fb7d31d562ff7326b84ec3a827456robertphillips@google.com            delete [] fPoints;
75935ad026826fb7d31d562ff7326b84ec3a827456robertphillips@google.com        }
76629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com
77629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com        // TODO: consider using passed-in flags to limit the work asPoints does.
78629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com        // For example, a kNoPath flag could indicate don't bother generating
79629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com        // stamped solutions.
80629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com
81629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com        // Currently none of these flags are supported.
82629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com        enum PointFlags {
83629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com            kCircles_PointFlag            = 0x01,   // draw points as circles (instead of rects)
84629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com            kUsePath_PointFlag            = 0x02,   // draw points as stamps of the returned path
85629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com            kUseClip_PointFlag            = 0x04,   // apply 'fClipRect' before drawing the points
86629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com        };
87629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com
88629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com        uint32_t           fFlags;      // flags that impact the drawing of the points
89935ad026826fb7d31d562ff7326b84ec3a827456robertphillips@google.com        SkPoint*           fPoints;     // the center point of each generated point
90935ad026826fb7d31d562ff7326b84ec3a827456robertphillips@google.com        int                fNumPoints;  // number of points in fPoints
91629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com        SkVector           fSize;       // the size to draw the points
92629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com        SkRect             fClipRect;   // clip required to draw the points (if kUseClip is set)
93629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com        SkPath             fPath;       // 'stamp' to be used at each point (if kUsePath is set)
946d87557278052c131957e5d6e093d3a675162d22robertphillips@google.com
956d87557278052c131957e5d6e093d3a675162d22robertphillips@google.com        SkPath             fFirst;      // If not empty, contains geometry for first point
966d87557278052c131957e5d6e093d3a675162d22robertphillips@google.com        SkPath             fLast;       // If not empty, contains geometry for last point
97629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com    };
98629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com
99629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com    /**
100629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com     *  Does applying this path effect to 'src' yield a set of points? If so,
101629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com     *  optionally return the points in 'results'.
102629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com     */
103687c57c7d5a17549f63e0b15208db18b220e2a91skia.committer@gmail.com    virtual bool asPoints(PointData* results, const SkPath& src,
1044bbdeac58cc928dc66296bde3bd06e78070d96b7reed@google.com                          const SkStrokeRec&, const SkMatrix&,
1054bbdeac58cc928dc66296bde3bd06e78070d96b7reed@google.com                          const SkRect* cullR) const;
106629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com
107aec143824c9be4e4af6e2cb7cce3d2d2268c0b15commit-bot@chromium.org    /**
108aec143824c9be4e4af6e2cb7cce3d2d2268c0b15commit-bot@chromium.org     *  If the PathEffect can be represented as a dash pattern, asADash will return kDash_DashType
109aec143824c9be4e4af6e2cb7cce3d2d2268c0b15commit-bot@chromium.org     *  and None otherwise. If a non NULL info is passed in, the various DashInfo will be filled
110aec143824c9be4e4af6e2cb7cce3d2d2268c0b15commit-bot@chromium.org     *  in if the PathEffect can be a dash pattern. If passed in info has an fCount equal or
111aec143824c9be4e4af6e2cb7cce3d2d2268c0b15commit-bot@chromium.org     *  greater to that of the effect, it will memcpy the values of the dash intervals into the
112aec143824c9be4e4af6e2cb7cce3d2d2268c0b15commit-bot@chromium.org     *  info. Thus the general approach will be call asADash once with default info to get DashType
113aec143824c9be4e4af6e2cb7cce3d2d2268c0b15commit-bot@chromium.org     *  and fCount. If effect can be represented as a dash pattern, allocate space for the intervals
114aec143824c9be4e4af6e2cb7cce3d2d2268c0b15commit-bot@chromium.org     *  in info, then call asADash again with the same info and the intervals will get copied in.
115aec143824c9be4e4af6e2cb7cce3d2d2268c0b15commit-bot@chromium.org     */
116aec143824c9be4e4af6e2cb7cce3d2d2268c0b15commit-bot@chromium.org
117aec143824c9be4e4af6e2cb7cce3d2d2268c0b15commit-bot@chromium.org    enum DashType {
118aec143824c9be4e4af6e2cb7cce3d2d2268c0b15commit-bot@chromium.org        kNone_DashType, //!< ignores the info parameter
119aec143824c9be4e4af6e2cb7cce3d2d2268c0b15commit-bot@chromium.org        kDash_DashType, //!< fills in all of the info parameter
120aec143824c9be4e4af6e2cb7cce3d2d2268c0b15commit-bot@chromium.org    };
121aec143824c9be4e4af6e2cb7cce3d2d2268c0b15commit-bot@chromium.org
122aec143824c9be4e4af6e2cb7cce3d2d2268c0b15commit-bot@chromium.org    struct DashInfo {
123aec143824c9be4e4af6e2cb7cce3d2d2268c0b15commit-bot@chromium.org        DashInfo() : fIntervals(NULL), fCount(0), fPhase(0) {}
124aec143824c9be4e4af6e2cb7cce3d2d2268c0b15commit-bot@chromium.org
125aec143824c9be4e4af6e2cb7cce3d2d2268c0b15commit-bot@chromium.org        SkScalar*   fIntervals;         //!< Length of on/off intervals for dashed lines
126aec143824c9be4e4af6e2cb7cce3d2d2268c0b15commit-bot@chromium.org                                        //   Even values represent ons, and odds offs
127aec143824c9be4e4af6e2cb7cce3d2d2268c0b15commit-bot@chromium.org        int32_t     fCount;             //!< Number of intervals in the dash. Should be even number
128aec143824c9be4e4af6e2cb7cce3d2d2268c0b15commit-bot@chromium.org        SkScalar    fPhase;             //!< Offset into the dashed interval pattern
129aec143824c9be4e4af6e2cb7cce3d2d2268c0b15commit-bot@chromium.org                                        //   mod the sum of all intervals
130aec143824c9be4e4af6e2cb7cce3d2d2268c0b15commit-bot@chromium.org    };
131aec143824c9be4e4af6e2cb7cce3d2d2268c0b15commit-bot@chromium.org
132aec143824c9be4e4af6e2cb7cce3d2d2268c0b15commit-bot@chromium.org    virtual DashType asADash(DashInfo* info) const;
133aec143824c9be4e4af6e2cb7cce3d2d2268c0b15commit-bot@chromium.org
134c0b7e10c6a68f59e1653e6c18e6bc954b3c3f0cfcommit-bot@chromium.org    SK_DEFINE_FLATTENABLE_TYPE(SkPathEffect)
135c0b7e10c6a68f59e1653e6c18e6bc954b3c3f0cfcommit-bot@chromium.org
136ba28d03e94dc221d6a803bf2a84a420b9159255cdjsollen@google.comprotected:
1370a2bf90dccba3bde188e0386a7f0c60e6dde1ae9commit-bot@chromium.org    SkPathEffect() {}
1389fa60daad4d5f54c0dbe3dbcc7608a8f6d721187reed#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
1398b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org    SkPathEffect(SkReadBuffer& buffer) : INHERITED(buffer) {}
1409fa60daad4d5f54c0dbe3dbcc7608a8f6d721187reed#endif
141ba28d03e94dc221d6a803bf2a84a420b9159255cdjsollen@google.com
1428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comprivate:
1438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // illegal
1448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkPathEffect(const SkPathEffect&);
1458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkPathEffect& operator=(const SkPathEffect&);
146ba28d03e94dc221d6a803bf2a84a420b9159255cdjsollen@google.com
147ba28d03e94dc221d6a803bf2a84a420b9159255cdjsollen@google.com    typedef SkFlattenable INHERITED;
1488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com};
1498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
1508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com/** \class SkPairPathEffect
1518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
1528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    Common baseclass for Compose and Sum. This subclass manages two pathEffects,
1538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    including flattening them. It does nothing in filterPath, and is only useful
1548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    for managing the lifetimes of its two arguments.
1558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com*/
1568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass SkPairPathEffect : public SkPathEffect {
1578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.compublic:
1588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    virtual ~SkPairPathEffect();
1598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
1608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comprotected:
1610a2bf90dccba3bde188e0386a7f0c60e6dde1ae9commit-bot@chromium.org    SkPairPathEffect(SkPathEffect* pe0, SkPathEffect* pe1);
1629fa60daad4d5f54c0dbe3dbcc7608a8f6d721187reed#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
1638b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org    SkPairPathEffect(SkReadBuffer&);
1649fa60daad4d5f54c0dbe3dbcc7608a8f6d721187reed#endif
1659fa60daad4d5f54c0dbe3dbcc7608a8f6d721187reed
1668b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org    virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
16754924243c1b65b3ee6d8fa064b50a9b1bb2a19a5djsollen@google.com
1688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // these are visible to our subclasses
1698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkPathEffect* fPE0, *fPE1;
170fbfcd5602128ec010c82cb733c9cdc0a3254f9f3rmistry@google.com
1718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comprivate:
1728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    typedef SkPathEffect INHERITED;
1738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com};
1748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
1758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com/** \class SkComposePathEffect
1768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
1778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    This subclass of SkPathEffect composes its two arguments, to create
1788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    a compound pathEffect.
1798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com*/
1808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass SkComposePathEffect : public SkPairPathEffect {
1818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.compublic:
1828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Construct a pathEffect whose effect is to apply first the inner pathEffect
1838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        and the the outer pathEffect (e.g. outer(inner(path)))
1848a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        The reference counts for outer and inner are both incremented in the constructor,
1858a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        and decremented in the destructor.
1868a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
1870a2bf90dccba3bde188e0386a7f0c60e6dde1ae9commit-bot@chromium.org    static SkComposePathEffect* Create(SkPathEffect* outer, SkPathEffect* inner) {
1880a2bf90dccba3bde188e0386a7f0c60e6dde1ae9commit-bot@chromium.org        return SkNEW_ARGS(SkComposePathEffect, (outer, inner));
1890a2bf90dccba3bde188e0386a7f0c60e6dde1ae9commit-bot@chromium.org    }
1908a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
191548a1f321011292359ef163f78c8a1d4871b3b7freed@google.com    virtual bool filterPath(SkPath* dst, const SkPath& src,
1924bbdeac58cc928dc66296bde3bd06e78070d96b7reed@google.com                            SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
1938a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
194ba28d03e94dc221d6a803bf2a84a420b9159255cdjsollen@google.com    SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposePathEffect)
1958a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
19654924243c1b65b3ee6d8fa064b50a9b1bb2a19a5djsollen@google.comprotected:
1970a2bf90dccba3bde188e0386a7f0c60e6dde1ae9commit-bot@chromium.org    SkComposePathEffect(SkPathEffect* outer, SkPathEffect* inner)
1980a2bf90dccba3bde188e0386a7f0c60e6dde1ae9commit-bot@chromium.org        : INHERITED(outer, inner) {}
1999fa60daad4d5f54c0dbe3dbcc7608a8f6d721187reed
2009fa60daad4d5f54c0dbe3dbcc7608a8f6d721187reed#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
201bd0be25074e53a6d1abc284562568c9745191984commit-bot@chromium.org    explicit SkComposePathEffect(SkReadBuffer& buffer) : INHERITED(buffer) {}
2029fa60daad4d5f54c0dbe3dbcc7608a8f6d721187reed#endif
2030a2bf90dccba3bde188e0386a7f0c60e6dde1ae9commit-bot@chromium.org
20454924243c1b65b3ee6d8fa064b50a9b1bb2a19a5djsollen@google.comprivate:
2058a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // illegal
2068a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkComposePathEffect(const SkComposePathEffect&);
2078a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkComposePathEffect& operator=(const SkComposePathEffect&);
208fbfcd5602128ec010c82cb733c9cdc0a3254f9f3rmistry@google.com
2098a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    typedef SkPairPathEffect INHERITED;
2108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com};
2118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
2128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com/** \class SkSumPathEffect
2138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
2148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    This subclass of SkPathEffect applies two pathEffects, one after the other.
2158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    Its filterPath() returns true if either of the effects succeeded.
2168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com*/
2178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass SkSumPathEffect : public SkPairPathEffect {
2188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.compublic:
2198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    /** Construct a pathEffect whose effect is to apply two effects, in sequence.
2208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        (e.g. first(path) + second(path))
2218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        The reference counts for first and second are both incremented in the constructor,
2228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        and decremented in the destructor.
2238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    */
2240a2bf90dccba3bde188e0386a7f0c60e6dde1ae9commit-bot@chromium.org    static SkSumPathEffect* Create(SkPathEffect* first, SkPathEffect* second) {
2250a2bf90dccba3bde188e0386a7f0c60e6dde1ae9commit-bot@chromium.org        return SkNEW_ARGS(SkSumPathEffect, (first, second));
2260a2bf90dccba3bde188e0386a7f0c60e6dde1ae9commit-bot@chromium.org    }
2278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
228548a1f321011292359ef163f78c8a1d4871b3b7freed@google.com    virtual bool filterPath(SkPath* dst, const SkPath& src,
2294bbdeac58cc928dc66296bde3bd06e78070d96b7reed@google.com                            SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
2308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
231ba28d03e94dc221d6a803bf2a84a420b9159255cdjsollen@google.com    SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSumPathEffect)
2328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
23354924243c1b65b3ee6d8fa064b50a9b1bb2a19a5djsollen@google.comprotected:
2340a2bf90dccba3bde188e0386a7f0c60e6dde1ae9commit-bot@chromium.org    SkSumPathEffect(SkPathEffect* first, SkPathEffect* second)
2350a2bf90dccba3bde188e0386a7f0c60e6dde1ae9commit-bot@chromium.org        : INHERITED(first, second) {}
2369fa60daad4d5f54c0dbe3dbcc7608a8f6d721187reed
2379fa60daad4d5f54c0dbe3dbcc7608a8f6d721187reed#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
238bd0be25074e53a6d1abc284562568c9745191984commit-bot@chromium.org    explicit SkSumPathEffect(SkReadBuffer& buffer) : INHERITED(buffer) {}
2399fa60daad4d5f54c0dbe3dbcc7608a8f6d721187reed#endif
2400a2bf90dccba3bde188e0386a7f0c60e6dde1ae9commit-bot@chromium.org
24154924243c1b65b3ee6d8fa064b50a9b1bb2a19a5djsollen@google.comprivate:
2428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // illegal
2438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkSumPathEffect(const SkSumPathEffect&);
2448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkSumPathEffect& operator=(const SkSumPathEffect&);
2458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
2468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    typedef SkPairPathEffect INHERITED;
2478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com};
2488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
2498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif
250