| 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 19 matching lines...) Expand all Loading... |
| 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 SkDashPathEffect* Create(const SkScalar intervals[], int count, | 39 static SkDashPathEffect* Create(const SkScalar intervals[], int count, |
| 40 SkScalar phase, bool scaleToFit = false) { | 40 SkScalar phase) { |
| 41 return SkNEW_ARGS(SkDashPathEffect, (intervals, count, phase, scaleToFit
)); | 41 return SkNEW_ARGS(SkDashPathEffect, (intervals, count, phase)); |
| 42 } | 42 } |
| 43 virtual ~SkDashPathEffect(); | 43 virtual ~SkDashPathEffect(); |
| 44 | 44 |
| 45 virtual bool filterPath(SkPath* dst, const SkPath& src, | 45 virtual bool filterPath(SkPath* dst, const SkPath& src, |
| 46 SkStrokeRec*, const SkRect*) const SK_OVERRIDE; | 46 SkStrokeRec*, const SkRect*) const SK_OVERRIDE; |
| 47 | 47 |
| 48 virtual bool asPoints(PointData* results, const SkPath& src, | 48 virtual bool asPoints(PointData* results, const SkPath& src, |
| 49 const SkStrokeRec&, const SkMatrix&, | 49 const SkStrokeRec&, const SkMatrix&, |
| 50 const SkRect*) const SK_OVERRIDE; | 50 const SkRect*) const SK_OVERRIDE; |
| 51 | 51 |
| 52 virtual Factory getFactory() const SK_OVERRIDE; | 52 virtual Factory getFactory() const SK_OVERRIDE; |
| 53 | 53 |
| 54 static SkFlattenable* CreateProc(SkReadBuffer&); | 54 static SkFlattenable* CreateProc(SkReadBuffer&); |
| 55 | 55 |
| 56 protected: | 56 protected: |
| 57 SkDashPathEffect(SkReadBuffer&); | 57 SkDashPathEffect(SkReadBuffer&); |
| 58 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 58 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
| 59 | 59 |
| 60 #ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS | 60 #ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS |
| 61 public: | 61 public: |
| 62 #endif | 62 #endif |
| 63 SkDashPathEffect(const SkScalar intervals[], int count, SkScalar phase, | 63 SkDashPathEffect(const SkScalar intervals[], int count, SkScalar phase); |
| 64 bool scaleToFit = false); | |
| 65 | 64 |
| 66 private: | 65 private: |
| 67 SkScalar* fIntervals; | 66 SkScalar* fIntervals; |
| 68 int32_t fCount; | 67 int32_t fCount; |
| 69 // computed from phase | 68 // computed from phase |
| 70 SkScalar fInitialDashLength; | 69 SkScalar fInitialDashLength; |
| 71 int32_t fInitialDashIndex; | 70 int32_t fInitialDashIndex; |
| 72 SkScalar fIntervalLength; | 71 SkScalar fIntervalLength; |
| 73 bool fScaleToFit; | |
| 74 | 72 |
| 75 typedef SkPathEffect INHERITED; | 73 typedef SkPathEffect INHERITED; |
| 76 }; | 74 }; |
| 77 | 75 |
| 78 #endif | 76 #endif |
| OLD | NEW |