• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "SkOpPathEffect.h"
12 
13 class SkOpPE : public SkPathEffect {
14 public:
15     SkOpPE(sk_sp<SkPathEffect> one, sk_sp<SkPathEffect> two, SkPathOp op);
16 
17 
18 protected:
19     void flatten(SkWriteBuffer&) const override;
20     bool onFilterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override;
21 
22 private:
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 
32 class SkMatrixPE : public SkPathEffect {
33 public:
34     SkMatrixPE(const SkMatrix&);
35 
36 protected:
37     void flatten(SkWriteBuffer&) const override;
38     bool onFilterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override;
39 
40 private:
41     SK_FLATTENABLE_HOOKS(SkMatrixPE)
42 
43     SkMatrix    fMatrix;
44 
45     typedef SkPathEffect INHERITED;
46 };
47 
48 class SkStrokePE : public SkPathEffect {
49 public:
50     SkStrokePE(SkScalar width, SkPaint::Join, SkPaint::Cap, SkScalar miter);
51 
52 protected:
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 
57 private:
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