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 SkDashPathEffect_DEFINED | 8 #ifndef SkDashPathEffect_DEFINED |
9 #define SkDashPathEffect_DEFINED | 9 #define SkDashPathEffect_DEFINED |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 10 pixels on | 29 10 pixels on |
30 20 pixels off | 30 20 pixels off |
31 10 pixels on | 31 10 pixels on |
32 20 pixels off | 32 20 pixels off |
33 ... | 33 ... |
34 A phase of -5, 25, 55, 85, etc. would all result in the same path, | 34 A phase of -5, 25, 55, 85, etc. would all result in the same path, |
35 because the sum of all the intervals is 30. | 35 because the sum of all the intervals is 30. |
36 | 36 |
37 Note: only affects stroked paths. | 37 Note: only affects stroked paths. |
38 */ | 38 */ |
39 static SkPathEffect* Create(const SkScalar intervals[], int count, SkScalar
phase) { | 39 static SkPathEffect* Create(const SkScalar intervals[], int count, SkScalar
phase); |
40 return new SkDashPathEffect(intervals, count, phase); | |
41 } | |
42 virtual ~SkDashPathEffect(); | |
43 | 40 |
44 virtual bool filterPath(SkPath* dst, const SkPath& src, | 41 virtual bool filterPath(SkPath* dst, const SkPath& src, |
45 SkStrokeRec*, const SkRect*) const override; | 42 SkStrokeRec*, const SkRect*) const override; |
46 | 43 |
47 virtual bool asPoints(PointData* results, const SkPath& src, | 44 virtual bool asPoints(PointData* results, const SkPath& src, |
48 const SkStrokeRec&, const SkMatrix&, | 45 const SkStrokeRec&, const SkMatrix&, |
49 const SkRect*) const override; | 46 const SkRect*) const override; |
50 | 47 |
51 DashType asADash(DashInfo* info) const override; | 48 DashType asADash(DashInfo* info) const override; |
52 | 49 |
53 SK_TO_STRING_OVERRIDE() | 50 SK_TO_STRING_OVERRIDE() |
54 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDashPathEffect) | 51 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDashPathEffect) |
55 | 52 |
56 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK | 53 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
57 bool exposedInAndroidJavaAPI() const override { return true; } | 54 bool exposedInAndroidJavaAPI() const override { return true; } |
58 #endif | 55 #endif |
59 | 56 |
60 protected: | 57 protected: |
| 58 virtual ~SkDashPathEffect(); |
61 SkDashPathEffect(const SkScalar intervals[], int count, SkScalar phase); | 59 SkDashPathEffect(const SkScalar intervals[], int count, SkScalar phase); |
62 void flatten(SkWriteBuffer&) const override; | 60 void flatten(SkWriteBuffer&) const override; |
63 | 61 |
64 private: | 62 private: |
65 SkScalar* fIntervals; | 63 SkScalar* fIntervals; |
66 int32_t fCount; | 64 int32_t fCount; |
67 SkScalar fPhase; | 65 SkScalar fPhase; |
68 // computed from phase | 66 // computed from phase |
| 67 |
69 SkScalar fInitialDashLength; | 68 SkScalar fInitialDashLength; |
70 int32_t fInitialDashIndex; | 69 int32_t fInitialDashIndex; |
71 SkScalar fIntervalLength; | 70 SkScalar fIntervalLength; |
72 | 71 |
73 typedef SkPathEffect INHERITED; | 72 typedef SkPathEffect INHERITED; |
74 }; | 73 }; |
75 | 74 |
76 #endif | 75 #endif |
OLD | NEW |