| 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 |
| 11 #include "SkPathEffect.h" | 11 #include "SkPathEffect.h" |
| 12 #include "SkPath.h" | 12 #include "SkPath.h" |
| 13 | 13 |
| 14 class SkPathMeasure; | 14 class SkPathMeasure; |
| 15 | 15 |
| 16 // This class is not exported to java. | 16 // This class is not exported to java. |
| 17 class SK_API Sk1DPathEffect : public SkPathEffect { | 17 class SK_API Sk1DPathEffect : public SkPathEffect { |
| 18 public: | 18 public: |
| 19 virtual bool filterPath(SkPath* dst, const SkPath& src, | 19 virtual bool filterPath(SkPath* dst, const SkPath& src, |
| 20 SkStrokeRec*, const SkRect*) const SK_OVERRIDE; | 20 SkStrokeRec*, const SkRect*) const override; |
| 21 | 21 |
| 22 protected: | 22 protected: |
| 23 /** Called at the start of each contour, returns the initial offset | 23 /** Called at the start of each contour, returns the initial offset |
| 24 into that contour. | 24 into that contour. |
| 25 */ | 25 */ |
| 26 virtual SkScalar begin(SkScalar contourLength) const = 0; | 26 virtual SkScalar begin(SkScalar contourLength) const = 0; |
| 27 /** Called with the current distance along the path, with the current matrix | 27 /** Called with the current distance along the path, with the current matrix |
| 28 for the point/tangent at the specified distance. | 28 for the point/tangent at the specified distance. |
| 29 Return the distance to travel for the next call. If return <= 0, then th
at | 29 Return the distance to travel for the next call. If return <= 0, then th
at |
| 30 contour is done. | 30 contour is done. |
| 31 */ | 31 */ |
| 32 virtual SkScalar next(SkPath* dst, SkScalar dist, SkPathMeasure&) const = 0; | 32 virtual SkScalar next(SkPath* dst, SkScalar dist, SkPathMeasure&) const = 0; |
| 33 | 33 |
| 34 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK | 34 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
| 35 bool exposedInAndroidJavaAPI() const SK_OVERRIDE { return true; } | 35 bool exposedInAndroidJavaAPI() const override { return true; } |
| 36 #endif | 36 #endif |
| 37 | 37 |
| 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 | 48 |
| 49 kStyleCount | 49 kStyleCount |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 /** Dash by replicating the specified path. | 52 /** Dash by replicating the specified path. |
| 53 @param path The path to replicate (dash) | 53 @param path The path to replicate (dash) |
| 54 @param advance The space between instances of path | 54 @param advance The space between instances of path |
| 55 @param phase distance (mod advance) along path for its initial position | 55 @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 | 56 @param style how to transform path at each point (based on the current |
| 57 position and tangent) | 57 position and tangent) |
| 58 */ | 58 */ |
| 59 static SkPath1DPathEffect* Create(const SkPath& path, SkScalar advance, SkSc
alar phase, | 59 static SkPath1DPathEffect* Create(const SkPath& path, SkScalar advance, SkSc
alar phase, |
| 60 Style style) { | 60 Style style) { |
| 61 return SkNEW_ARGS(SkPath1DPathEffect, (path, advance, phase, style)); | 61 return SkNEW_ARGS(SkPath1DPathEffect, (path, advance, phase, style)); |
| 62 } | 62 } |
| 63 | 63 |
| 64 virtual bool filterPath(SkPath*, const SkPath&, | 64 virtual bool filterPath(SkPath*, const SkPath&, |
| 65 SkStrokeRec*, const SkRect*) const SK_OVERRIDE; | 65 SkStrokeRec*, const SkRect*) const override; |
| 66 | 66 |
| 67 SK_TO_STRING_OVERRIDE() | 67 SK_TO_STRING_OVERRIDE() |
| 68 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPath1DPathEffect) | 68 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPath1DPathEffect) |
| 69 | 69 |
| 70 protected: | 70 protected: |
| 71 SkPath1DPathEffect(const SkPath& path, SkScalar advance, SkScalar phase, Sty
le); | 71 SkPath1DPathEffect(const SkPath& path, SkScalar advance, SkScalar phase, Sty
le); |
| 72 void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 72 void flatten(SkWriteBuffer&) const override; |
| 73 | 73 |
| 74 // overrides from Sk1DPathEffect | 74 // overrides from Sk1DPathEffect |
| 75 SkScalar begin(SkScalar contourLength) const SK_OVERRIDE; | 75 SkScalar begin(SkScalar contourLength) const override; |
| 76 SkScalar next(SkPath*, SkScalar, SkPathMeasure&) const SK_OVERRIDE; | 76 SkScalar next(SkPath*, SkScalar, SkPathMeasure&) const override; |
| 77 | 77 |
| 78 private: | 78 private: |
| 79 SkPath fPath; // copied from constructor | 79 SkPath fPath; // copied from constructor |
| 80 SkScalar fAdvance; // copied from constructor | 80 SkScalar fAdvance; // copied from constructor |
| 81 SkScalar fInitialOffset; // computed from phase | 81 SkScalar fInitialOffset; // computed from phase |
| 82 Style fStyle; // copied from constructor | 82 Style fStyle; // copied from constructor |
| 83 | 83 |
| 84 typedef Sk1DPathEffect INHERITED; | 84 typedef Sk1DPathEffect INHERITED; |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 #endif | 87 #endif |
| OLD | NEW |