| 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 Sk2DPathEffect_DEFINED | 8 #ifndef Sk2DPathEffect_DEFINED |
| 9 #define Sk2DPathEffect_DEFINED | 9 #define Sk2DPathEffect_DEFINED |
| 10 | 10 |
| 11 #include "SkPath.h" | 11 #include "SkPath.h" |
| 12 #include "SkPathEffect.h" | 12 #include "SkPathEffect.h" |
| 13 #include "SkMatrix.h" | 13 #include "SkMatrix.h" |
| 14 | 14 |
| 15 class SK_API Sk2DPathEffect : public SkPathEffect { | 15 class SK_API Sk2DPathEffect : public SkPathEffect { |
| 16 public: | 16 public: |
| 17 bool filterPath(SkPath*, const SkPath&, SkStrokeRec*, const SkRect*) const S
K_OVERRIDE; | 17 bool filterPath(SkPath*, const SkPath&, SkStrokeRec*, const SkRect*) const o
verride; |
| 18 | 18 |
| 19 protected: | 19 protected: |
| 20 /** New virtual, to be overridden by subclasses. | 20 /** New virtual, to be overridden by subclasses. |
| 21 This is called once from filterPath, and provides the | 21 This is called once from filterPath, and provides the |
| 22 uv parameter bounds for the path. Subsequent calls to | 22 uv parameter bounds for the path. Subsequent calls to |
| 23 next() will receive u and v values within these bounds, | 23 next() will receive u and v values within these bounds, |
| 24 and then a call to end() will signal the end of processing. | 24 and then a call to end() will signal the end of processing. |
| 25 */ | 25 */ |
| 26 virtual void begin(const SkIRect& uvBounds, SkPath* dst) const; | 26 virtual void begin(const SkIRect& uvBounds, SkPath* dst) const; |
| 27 virtual void next(const SkPoint& loc, int u, int v, SkPath* dst) const; | 27 virtual void next(const SkPoint& loc, int u, int v, SkPath* dst) const; |
| 28 virtual void end(SkPath* dst) const; | 28 virtual void end(SkPath* dst) const; |
| 29 | 29 |
| 30 /** Low-level virtual called per span of locations in the u-direction. | 30 /** Low-level virtual called per span of locations in the u-direction. |
| 31 The default implementation calls next() repeatedly with each | 31 The default implementation calls next() repeatedly with each |
| 32 location. | 32 location. |
| 33 */ | 33 */ |
| 34 virtual void nextSpan(int u, int v, int ucount, SkPath* dst) const; | 34 virtual void nextSpan(int u, int v, int ucount, SkPath* dst) const; |
| 35 | 35 |
| 36 const SkMatrix& getMatrix() const { return fMatrix; } | 36 const SkMatrix& getMatrix() const { return fMatrix; } |
| 37 | 37 |
| 38 // protected so that subclasses can call this during unflattening | 38 // protected so that subclasses can call this during unflattening |
| 39 explicit Sk2DPathEffect(const SkMatrix& mat); | 39 explicit Sk2DPathEffect(const SkMatrix& mat); |
| 40 void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 40 void flatten(SkWriteBuffer&) const override; |
| 41 | 41 |
| 42 SK_TO_STRING_OVERRIDE() | 42 SK_TO_STRING_OVERRIDE() |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 SkMatrix fMatrix, fInverse; | 45 SkMatrix fMatrix, fInverse; |
| 46 bool fMatrixIsInvertible; | 46 bool fMatrixIsInvertible; |
| 47 | 47 |
| 48 // illegal | 48 // illegal |
| 49 Sk2DPathEffect(const Sk2DPathEffect&); | 49 Sk2DPathEffect(const Sk2DPathEffect&); |
| 50 Sk2DPathEffect& operator=(const Sk2DPathEffect&); | 50 Sk2DPathEffect& operator=(const Sk2DPathEffect&); |
| 51 | 51 |
| 52 friend class Sk2DPathEffectBlitter; | 52 friend class Sk2DPathEffectBlitter; |
| 53 typedef SkPathEffect INHERITED; | 53 typedef SkPathEffect INHERITED; |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 class SK_API SkLine2DPathEffect : public Sk2DPathEffect { | 56 class SK_API SkLine2DPathEffect : public Sk2DPathEffect { |
| 57 public: | 57 public: |
| 58 static SkLine2DPathEffect* Create(SkScalar width, const SkMatrix& matrix) { | 58 static SkLine2DPathEffect* Create(SkScalar width, const SkMatrix& matrix) { |
| 59 return SkNEW_ARGS(SkLine2DPathEffect, (width, matrix)); | 59 return SkNEW_ARGS(SkLine2DPathEffect, (width, matrix)); |
| 60 } | 60 } |
| 61 | 61 |
| 62 virtual bool filterPath(SkPath* dst, const SkPath& src, | 62 virtual bool filterPath(SkPath* dst, const SkPath& src, |
| 63 SkStrokeRec*, const SkRect*) const SK_OVERRIDE; | 63 SkStrokeRec*, const SkRect*) const override; |
| 64 | 64 |
| 65 SK_TO_STRING_OVERRIDE() | 65 SK_TO_STRING_OVERRIDE() |
| 66 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLine2DPathEffect) | 66 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLine2DPathEffect) |
| 67 | 67 |
| 68 protected: | 68 protected: |
| 69 SkLine2DPathEffect(SkScalar width, const SkMatrix& matrix) | 69 SkLine2DPathEffect(SkScalar width, const SkMatrix& matrix) |
| 70 : Sk2DPathEffect(matrix), fWidth(width) {} | 70 : Sk2DPathEffect(matrix), fWidth(width) {} |
| 71 void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 71 void flatten(SkWriteBuffer&) const override; |
| 72 | 72 |
| 73 void nextSpan(int u, int v, int ucount, SkPath*) const SK_OVERRIDE; | 73 void nextSpan(int u, int v, int ucount, SkPath*) const override; |
| 74 | 74 |
| 75 private: | 75 private: |
| 76 SkScalar fWidth; | 76 SkScalar fWidth; |
| 77 | 77 |
| 78 typedef Sk2DPathEffect INHERITED; | 78 typedef Sk2DPathEffect INHERITED; |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 class SK_API SkPath2DPathEffect : public Sk2DPathEffect { | 81 class SK_API SkPath2DPathEffect : public Sk2DPathEffect { |
| 82 public: | 82 public: |
| 83 /** | 83 /** |
| 84 * Stamp the specified path to fill the shape, using the matrix to define | 84 * Stamp the specified path to fill the shape, using the matrix to define |
| 85 * the latice. | 85 * the latice. |
| 86 */ | 86 */ |
| 87 static SkPath2DPathEffect* Create(const SkMatrix& matrix, const SkPath& path
) { | 87 static SkPath2DPathEffect* Create(const SkMatrix& matrix, const SkPath& path
) { |
| 88 return SkNEW_ARGS(SkPath2DPathEffect, (matrix, path)); | 88 return SkNEW_ARGS(SkPath2DPathEffect, (matrix, path)); |
| 89 } | 89 } |
| 90 | 90 |
| 91 SK_TO_STRING_OVERRIDE() | 91 SK_TO_STRING_OVERRIDE() |
| 92 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPath2DPathEffect) | 92 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPath2DPathEffect) |
| 93 | 93 |
| 94 protected: | 94 protected: |
| 95 SkPath2DPathEffect(const SkMatrix&, const SkPath&); | 95 SkPath2DPathEffect(const SkMatrix&, const SkPath&); |
| 96 void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 96 void flatten(SkWriteBuffer&) const override; |
| 97 | 97 |
| 98 void next(const SkPoint&, int u, int v, SkPath*) const SK_OVERRIDE; | 98 void next(const SkPoint&, int u, int v, SkPath*) const override; |
| 99 | 99 |
| 100 private: | 100 private: |
| 101 SkPath fPath; | 101 SkPath fPath; |
| 102 | 102 |
| 103 typedef Sk2DPathEffect INHERITED; | 103 typedef Sk2DPathEffect INHERITED; |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 #endif | 106 #endif |
| OLD | NEW |