OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef Sk1DPathEffect_DEFINED | 8 #ifndef Sk1DPathEffect_DEFINED |
9 #define Sk1DPathEffect_DEFINED | 9 #define Sk1DPathEffect_DEFINED |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 private: | 38 private: |
39 typedef SkPathEffect INHERITED; | 39 typedef SkPathEffect INHERITED; |
40 }; | 40 }; |
41 | 41 |
42 class SK_API SkPath1DPathEffect : public Sk1DPathEffect { | 42 class SK_API SkPath1DPathEffect : public Sk1DPathEffect { |
43 public: | 43 public: |
44 enum Style { | 44 enum Style { |
45 kTranslate_Style, // translate the shape to each position | 45 kTranslate_Style, // translate the shape to each position |
46 kRotate_Style, // rotate the shape about its center | 46 kRotate_Style, // rotate the shape about its center |
47 kMorph_Style, // transform each point, and turn lines into curves | 47 kMorph_Style, // transform each point, and turn lines into curves |
48 | |
49 kStyleCount | |
50 }; | 48 }; |
51 | 49 |
52 /** Dash by replicating the specified path. | 50 /** Dash by replicating the specified path. |
53 @param path The path to replicate (dash) | 51 @param path The path to replicate (dash) |
54 @param advance The space between instances of path | 52 @param advance The space between instances of path |
55 @param phase distance (mod advance) along path for its initial position | 53 @param phase distance (mod advance) along path for its initial position |
56 @param style how to transform path at each point (based on the current | 54 @param style how to transform path at each point (based on the current |
57 position and tangent) | 55 position and tangent) |
58 */ | 56 */ |
59 static SkPathEffect* Create(const SkPath& path, SkScalar advance, SkScalar p
hase, Style style) { | 57 static SkPathEffect* Create(const SkPath& path, SkScalar advance, SkScalar p
hase, Style); |
60 return new SkPath1DPathEffect(path, advance, phase, style); | |
61 } | |
62 | 58 |
63 virtual bool filterPath(SkPath*, const SkPath&, | 59 virtual bool filterPath(SkPath*, const SkPath&, |
64 SkStrokeRec*, const SkRect*) const override; | 60 SkStrokeRec*, const SkRect*) const override; |
65 | 61 |
66 SK_TO_STRING_OVERRIDE() | 62 SK_TO_STRING_OVERRIDE() |
67 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPath1DPathEffect) | 63 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPath1DPathEffect) |
68 | 64 |
69 protected: | 65 protected: |
70 SkPath1DPathEffect(const SkPath& path, SkScalar advance, SkScalar phase, Sty
le); | 66 SkPath1DPathEffect(const SkPath& path, SkScalar advance, SkScalar phase, Sty
le); |
71 void flatten(SkWriteBuffer&) const override; | 67 void flatten(SkWriteBuffer&) const override; |
72 | 68 |
73 // overrides from Sk1DPathEffect | 69 // overrides from Sk1DPathEffect |
74 SkScalar begin(SkScalar contourLength) const override; | 70 SkScalar begin(SkScalar contourLength) const override; |
75 SkScalar next(SkPath*, SkScalar, SkPathMeasure&) const override; | 71 SkScalar next(SkPath*, SkScalar, SkPathMeasure&) const override; |
76 | 72 |
77 private: | 73 private: |
78 SkPath fPath; // copied from constructor | 74 SkPath fPath; // copied from constructor |
79 SkScalar fAdvance; // copied from constructor | 75 SkScalar fAdvance; // copied from constructor |
80 SkScalar fInitialOffset; // computed from phase | 76 SkScalar fInitialOffset; // computed from phase |
81 Style fStyle; // copied from constructor | 77 Style fStyle; // copied from constructor |
82 | 78 |
83 typedef Sk1DPathEffect INHERITED; | 79 typedef Sk1DPathEffect INHERITED; |
84 }; | 80 }; |
85 | 81 |
86 #endif | 82 #endif |
OLD | NEW |