Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1639)

Side by Side Diff: include/effects/Sk2DPathEffect.h

Issue 395603002: Simplify flattening to just write enough to call the factory (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/effects/Sk1DPathEffect.h ('k') | include/effects/SkAvoidXfermode.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 21 matching lines...) Expand all
32 /** Low-level virtual called per span of locations in the u-direction. 32 /** Low-level virtual called per span of locations in the u-direction.
33 The default implementation calls next() repeatedly with each 33 The default implementation calls next() repeatedly with each
34 location. 34 location.
35 */ 35 */
36 virtual void nextSpan(int u, int v, int ucount, SkPath* dst) const; 36 virtual void nextSpan(int u, int v, int ucount, SkPath* dst) const;
37 37
38 const SkMatrix& getMatrix() const { return fMatrix; } 38 const SkMatrix& getMatrix() const { return fMatrix; }
39 39
40 // protected so that subclasses can call this during unflattening 40 // protected so that subclasses can call this during unflattening
41 explicit Sk2DPathEffect(const SkMatrix& mat); 41 explicit Sk2DPathEffect(const SkMatrix& mat);
42 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
42 explicit Sk2DPathEffect(SkReadBuffer&); 43 explicit Sk2DPathEffect(SkReadBuffer&);
44 #endif
43 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; 45 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
44 46
45 private: 47 private:
46 SkMatrix fMatrix, fInverse; 48 SkMatrix fMatrix, fInverse;
47 bool fMatrixIsInvertible; 49 bool fMatrixIsInvertible;
48 50
49 // illegal 51 // illegal
50 Sk2DPathEffect(const Sk2DPathEffect&); 52 Sk2DPathEffect(const Sk2DPathEffect&);
51 Sk2DPathEffect& operator=(const Sk2DPathEffect&); 53 Sk2DPathEffect& operator=(const Sk2DPathEffect&);
52 54
53 friend class Sk2DPathEffectBlitter; 55 friend class Sk2DPathEffectBlitter;
54 typedef SkPathEffect INHERITED; 56 typedef SkPathEffect INHERITED;
55 }; 57 };
56 58
57 class SK_API SkLine2DPathEffect : public Sk2DPathEffect { 59 class SK_API SkLine2DPathEffect : public Sk2DPathEffect {
58 public: 60 public:
59 static SkLine2DPathEffect* Create(SkScalar width, const SkMatrix& matrix) { 61 static SkLine2DPathEffect* Create(SkScalar width, const SkMatrix& matrix) {
60 return SkNEW_ARGS(SkLine2DPathEffect, (width, matrix)); 62 return SkNEW_ARGS(SkLine2DPathEffect, (width, matrix));
61 } 63 }
62 64
63 virtual bool filterPath(SkPath* dst, const SkPath& src, 65 virtual bool filterPath(SkPath* dst, const SkPath& src,
64 SkStrokeRec*, const SkRect*) const SK_OVERRIDE; 66 SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
65 67
66 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLine2DPathEffect) 68 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLine2DPathEffect)
67 69
68 protected: 70 protected:
69 SkLine2DPathEffect(SkScalar width, const SkMatrix& matrix) 71 SkLine2DPathEffect(SkScalar width, const SkMatrix& matrix)
70 : Sk2DPathEffect(matrix), fWidth(width) {} 72 : Sk2DPathEffect(matrix), fWidth(width) {}
73 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
71 explicit SkLine2DPathEffect(SkReadBuffer&); 74 explicit SkLine2DPathEffect(SkReadBuffer&);
75 #endif
72 76
73 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; 77 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
74 78
75 virtual void nextSpan(int u, int v, int ucount, SkPath*) const SK_OVERRIDE; 79 virtual void nextSpan(int u, int v, int ucount, SkPath*) const SK_OVERRIDE;
76 80
77 private: 81 private:
78 SkScalar fWidth; 82 SkScalar fWidth;
79 83
80 typedef Sk2DPathEffect INHERITED; 84 typedef Sk2DPathEffect INHERITED;
81 }; 85 };
82 86
83 class SK_API SkPath2DPathEffect : public Sk2DPathEffect { 87 class SK_API SkPath2DPathEffect : public Sk2DPathEffect {
84 public: 88 public:
85 /** 89 /**
86 * Stamp the specified path to fill the shape, using the matrix to define 90 * Stamp the specified path to fill the shape, using the matrix to define
87 * the latice. 91 * the latice.
88 */ 92 */
89 static SkPath2DPathEffect* Create(const SkMatrix& matrix, const SkPath& path ) { 93 static SkPath2DPathEffect* Create(const SkMatrix& matrix, const SkPath& path ) {
90 return SkNEW_ARGS(SkPath2DPathEffect, (matrix, path)); 94 return SkNEW_ARGS(SkPath2DPathEffect, (matrix, path));
91 } 95 }
92 96
93 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPath2DPathEffect) 97 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPath2DPathEffect)
94 98
95 protected: 99 protected:
96 SkPath2DPathEffect(const SkMatrix&, const SkPath&); 100 SkPath2DPathEffect(const SkMatrix&, const SkPath&);
101 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
97 explicit SkPath2DPathEffect(SkReadBuffer& buffer); 102 explicit SkPath2DPathEffect(SkReadBuffer& buffer);
103 #endif
98 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; 104 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
99 105
100 virtual void next(const SkPoint&, int u, int v, SkPath*) const SK_OVERRIDE; 106 virtual void next(const SkPoint&, int u, int v, SkPath*) const SK_OVERRIDE;
101 107
102 private: 108 private:
103 SkPath fPath; 109 SkPath fPath;
104 110
105 typedef Sk2DPathEffect INHERITED; 111 typedef Sk2DPathEffect INHERITED;
106 }; 112 };
107 113
108 #endif 114 #endif
OLDNEW
« no previous file with comments | « include/effects/Sk1DPathEffect.h ('k') | include/effects/SkAvoidXfermode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698