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

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: Created 6 years, 5 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
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 26 matching lines...) Expand all
37 /** Low-level virtual called per span of locations in the u-direction. 37 /** Low-level virtual called per span of locations in the u-direction.
38 The default implementation calls next() repeatedly with each 38 The default implementation calls next() repeatedly with each
39 location. 39 location.
40 */ 40 */
41 virtual void nextSpan(int u, int v, int ucount, SkPath* dst) const; 41 virtual void nextSpan(int u, int v, int ucount, SkPath* dst) const;
42 42
43 const SkMatrix& getMatrix() const { return fMatrix; } 43 const SkMatrix& getMatrix() const { return fMatrix; }
44 44
45 // protected so that subclasses can call this during unflattening 45 // protected so that subclasses can call this during unflattening
46 explicit Sk2DPathEffect(const SkMatrix& mat); 46 explicit Sk2DPathEffect(const SkMatrix& mat);
47 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
47 explicit Sk2DPathEffect(SkReadBuffer&); 48 explicit Sk2DPathEffect(SkReadBuffer&);
49 #endif
48 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; 50 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
49 51
50 private: 52 private:
51 SkMatrix fMatrix, fInverse; 53 SkMatrix fMatrix, fInverse;
52 bool fMatrixIsInvertible; 54 bool fMatrixIsInvertible;
53 55
54 // illegal 56 // illegal
55 Sk2DPathEffect(const Sk2DPathEffect&); 57 Sk2DPathEffect(const Sk2DPathEffect&);
56 Sk2DPathEffect& operator=(const Sk2DPathEffect&); 58 Sk2DPathEffect& operator=(const Sk2DPathEffect&);
57 59
58 friend class Sk2DPathEffectBlitter; 60 friend class Sk2DPathEffectBlitter;
59 typedef SkPathEffect INHERITED; 61 typedef SkPathEffect INHERITED;
60 }; 62 };
61 63
62 class SK_API SkLine2DPathEffect : public Sk2DPathEffect { 64 class SK_API SkLine2DPathEffect : public Sk2DPathEffect {
63 public: 65 public:
64 static SkLine2DPathEffect* Create(SkScalar width, const SkMatrix& matrix) { 66 static SkLine2DPathEffect* Create(SkScalar width, const SkMatrix& matrix) {
65 return SkNEW_ARGS(SkLine2DPathEffect, (width, matrix)); 67 return SkNEW_ARGS(SkLine2DPathEffect, (width, matrix));
66 } 68 }
67 69
68 virtual bool filterPath(SkPath* dst, const SkPath& src, 70 virtual bool filterPath(SkPath* dst, const SkPath& src,
69 SkStrokeRec*, const SkRect*) const SK_OVERRIDE; 71 SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
70 72
71 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLine2DPathEffect) 73 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLine2DPathEffect)
72 74
73 protected: 75 protected:
74 SkLine2DPathEffect(SkScalar width, const SkMatrix& matrix) 76 SkLine2DPathEffect(SkScalar width, const SkMatrix& matrix)
75 : Sk2DPathEffect(matrix), fWidth(width) {} 77 : Sk2DPathEffect(matrix), fWidth(width) {}
78 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
76 explicit SkLine2DPathEffect(SkReadBuffer&); 79 explicit SkLine2DPathEffect(SkReadBuffer&);
80 #endif
77 81
78 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; 82 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
79 83
80 virtual void nextSpan(int u, int v, int ucount, SkPath*) const SK_OVERRIDE; 84 virtual void nextSpan(int u, int v, int ucount, SkPath*) const SK_OVERRIDE;
81 85
82 private: 86 private:
83 SkScalar fWidth; 87 SkScalar fWidth;
84 88
85 typedef Sk2DPathEffect INHERITED; 89 typedef Sk2DPathEffect INHERITED;
86 }; 90 };
87 91
88 class SK_API SkPath2DPathEffect : public Sk2DPathEffect { 92 class SK_API SkPath2DPathEffect : public Sk2DPathEffect {
89 public: 93 public:
90 /** 94 /**
91 * Stamp the specified path to fill the shape, using the matrix to define 95 * Stamp the specified path to fill the shape, using the matrix to define
92 * the latice. 96 * the latice.
93 */ 97 */
94 static SkPath2DPathEffect* Create(const SkMatrix& matrix, const SkPath& path ) { 98 static SkPath2DPathEffect* Create(const SkMatrix& matrix, const SkPath& path ) {
95 return SkNEW_ARGS(SkPath2DPathEffect, (matrix, path)); 99 return SkNEW_ARGS(SkPath2DPathEffect, (matrix, path));
96 } 100 }
97 101
98 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPath2DPathEffect) 102 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPath2DPathEffect)
99 103
100 protected: 104 protected:
101 SkPath2DPathEffect(const SkMatrix&, const SkPath&); 105 SkPath2DPathEffect(const SkMatrix&, const SkPath&);
106 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
102 explicit SkPath2DPathEffect(SkReadBuffer& buffer); 107 explicit SkPath2DPathEffect(SkReadBuffer& buffer);
108 #endif
103 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; 109 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
104 110
105 virtual void next(const SkPoint&, int u, int v, SkPath*) const SK_OVERRIDE; 111 virtual void next(const SkPoint&, int u, int v, SkPath*) const SK_OVERRIDE;
106 112
107 private: 113 private:
108 SkPath fPath; 114 SkPath fPath;
109 115
110 typedef Sk2DPathEffect INHERITED; 116 typedef Sk2DPathEffect INHERITED;
111 }; 117 };
112 118
113 #endif 119 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698