Mike Reed | 0ef539a | 2018-07-18 13:28:42 -0400 | [diff] [blame] | 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 | |
Mike Reed | 0ef539a | 2018-07-18 13:28:42 -0400 | [diff] [blame] | 17 | Factory getFactory() const override { return CreateProc; } |
| 18 | |
| 19 | protected: |
| 20 | void flatten(SkWriteBuffer&) const override; |
Mike Reed | 6d10f8b | 2018-08-16 13:22:16 -0400 | [diff] [blame] | 21 | bool onFilterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override; |
Mike Reed | 0ef539a | 2018-07-18 13:28:42 -0400 | [diff] [blame] | 22 | |
| 23 | private: |
| 24 | static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&); |
| 25 | friend class SkFlattenable::PrivateInitializer; |
| 26 | |
| 27 | sk_sp<SkPathEffect> fOne; |
| 28 | sk_sp<SkPathEffect> fTwo; |
| 29 | SkPathOp fOp; |
| 30 | |
| 31 | typedef SkPathEffect INHERITED; |
| 32 | }; |
| 33 | |
| 34 | class SkMatrixPE : public SkPathEffect { |
| 35 | public: |
| 36 | SkMatrixPE(const SkMatrix&); |
| 37 | |
Mike Reed | 0ef539a | 2018-07-18 13:28:42 -0400 | [diff] [blame] | 38 | Factory getFactory() const override { return CreateProc; } |
| 39 | |
| 40 | protected: |
| 41 | void flatten(SkWriteBuffer&) const override; |
Mike Reed | 6d10f8b | 2018-08-16 13:22:16 -0400 | [diff] [blame] | 42 | bool onFilterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override; |
Mike Reed | 0ef539a | 2018-07-18 13:28:42 -0400 | [diff] [blame] | 43 | |
| 44 | private: |
| 45 | static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&); |
| 46 | friend class SkFlattenable::PrivateInitializer; |
| 47 | |
| 48 | SkMatrix fMatrix; |
| 49 | |
| 50 | typedef SkPathEffect INHERITED; |
| 51 | }; |
| 52 | |
| 53 | class SkStrokePE : public SkPathEffect { |
| 54 | public: |
| 55 | SkStrokePE(SkScalar width, SkPaint::Join, SkPaint::Cap, SkScalar miter); |
| 56 | |
Mike Reed | 0ef539a | 2018-07-18 13:28:42 -0400 | [diff] [blame] | 57 | Factory getFactory() const override { return CreateProc; } |
| 58 | |
| 59 | protected: |
| 60 | void flatten(SkWriteBuffer&) const override; |
Mike Reed | 6d10f8b | 2018-08-16 13:22:16 -0400 | [diff] [blame] | 61 | bool onFilterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override; |
| 62 | // TODO: override onComputeFastBounds (I think) |
Mike Reed | 0ef539a | 2018-07-18 13:28:42 -0400 | [diff] [blame] | 63 | |
| 64 | private: |
| 65 | static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&); |
| 66 | friend class SkFlattenable::PrivateInitializer; |
| 67 | |
| 68 | SkScalar fWidth, |
| 69 | fMiter; |
| 70 | SkPaint::Join fJoin; |
| 71 | SkPaint::Cap fCap; |
| 72 | |
| 73 | typedef SkPathEffect INHERITED; |
| 74 | }; |
| 75 | |
| 76 | #endif |
| 77 | |