1/*
2 * Copyright 2018 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
8#ifndef SkOpPE_DEFINED
9#define SkOpPE_DEFINED
10
11#include "include/effects/SkOpPathEffect.h"
12
13class SkOpPE : public SkPathEffect {
14public:
15 SkOpPE(sk_sp<SkPathEffect> one, sk_sp<SkPathEffect> two, SkPathOp op);
16
17
18protected:
19 void flatten(SkWriteBuffer&) const override;
20 bool onFilterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override;
21
22private:
23 SK_FLATTENABLE_HOOKS(SkOpPE)
24
25 sk_sp<SkPathEffect> fOne;
26 sk_sp<SkPathEffect> fTwo;
27 SkPathOp fOp;
28
29 typedef SkPathEffect INHERITED;
30};
31
32class SkMatrixPE : public SkPathEffect {
33public:
34 SkMatrixPE(const SkMatrix&);
35
36protected:
37 void flatten(SkWriteBuffer&) const override;
38 bool onFilterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override;
39
40private:
41 SK_FLATTENABLE_HOOKS(SkMatrixPE)
42
43 SkMatrix fMatrix;
44
45 typedef SkPathEffect INHERITED;
46};
47
48class SkStrokePE : public SkPathEffect {
49public:
50 SkStrokePE(SkScalar width, SkPaint::Join, SkPaint::Cap, SkScalar miter);
51
52protected:
53 void flatten(SkWriteBuffer&) const override;
54 bool onFilterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override;
55 // TODO: override onComputeFastBounds (I think)
56
57private:
58 SK_FLATTENABLE_HOOKS(SkStrokePE)
59
60 SkScalar fWidth,
61 fMiter;
62 SkPaint::Join fJoin;
63 SkPaint::Cap fCap;
64
65 typedef SkPathEffect INHERITED;
66};
67
68#endif
69
70