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

Side by Side Diff: samplecode/ClockFaceView.cpp

Issue 769953002: Remove SK_SUPPORT_LEGACY_DEEPFLATTENING. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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/SkXfermodeImageFilter.h ('k') | samplecode/SampleAll.cpp » ('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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkView.h" 9 #include "SkView.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 83 }
84 84
85 virtual void next(const SkPoint& loc, int u, int v, 85 virtual void next(const SkPoint& loc, int u, int v,
86 SkPath* dst) const SK_OVERRIDE { 86 SkPath* dst) const SK_OVERRIDE {
87 if (fPts) { 87 if (fPts) {
88 *fPts->append() = loc; 88 *fPts->append() = loc;
89 } 89 }
90 dst->addCircle(loc.fX, loc.fY, fRadius); 90 dst->addCircle(loc.fX, loc.fY, fRadius);
91 } 91 }
92 92
93 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
94 Dot2DPathEffect(SkReadBuffer& buffer) : INHERITED(buffer) {
95 fRadius = buffer.readScalar();
96 fPts = NULL;
97 }
98 #endif
99
100 virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE { 93 virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE {
101 buffer.writeMatrix(this->getMatrix()); 94 buffer.writeMatrix(this->getMatrix());
102 buffer.writeScalar(fRadius); 95 buffer.writeScalar(fRadius);
103 } 96 }
104 97
105 private: 98 private:
106 SkScalar fRadius; 99 SkScalar fRadius;
107 SkTDArray<SkPoint>* fPts; 100 SkTDArray<SkPoint>* fPts;
108 101
109 typedef Sk2DPathEffect INHERITED; 102 typedef Sk2DPathEffect INHERITED;
110 }; 103 };
111 104
112 SkFlattenable* Dot2DPathEffect::CreateProc(SkReadBuffer& buffer) { 105 SkFlattenable* Dot2DPathEffect::CreateProc(SkReadBuffer& buffer) {
113 SkMatrix matrix; 106 SkMatrix matrix;
114 buffer.readMatrix(&matrix); 107 buffer.readMatrix(&matrix);
115 return SkNEW_ARGS(Dot2DPathEffect, (buffer.readScalar(), matrix, NULL)); 108 return SkNEW_ARGS(Dot2DPathEffect, (buffer.readScalar(), matrix, NULL));
116 } 109 }
117 110
118 class InverseFillPE : public SkPathEffect { 111 class InverseFillPE : public SkPathEffect {
119 public: 112 public:
120 InverseFillPE() {} 113 InverseFillPE() {}
121 virtual bool filterPath(SkPath* dst, const SkPath& src, 114 virtual bool filterPath(SkPath* dst, const SkPath& src,
122 SkStrokeRec*, const SkRect*) const SK_OVERRIDE { 115 SkStrokeRec*, const SkRect*) const SK_OVERRIDE {
123 *dst = src; 116 *dst = src;
124 dst->setFillType(SkPath::kInverseWinding_FillType); 117 dst->setFillType(SkPath::kInverseWinding_FillType);
125 return true; 118 return true;
126 } 119 }
127 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(InverseFillPE) 120 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(InverseFillPE)
128 121
129 protected:
130 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
131 InverseFillPE(SkReadBuffer& buffer) : INHERITED(buffer) {}
132 #endif
133
134 private: 122 private:
135
136 typedef SkPathEffect INHERITED; 123 typedef SkPathEffect INHERITED;
137 }; 124 };
138 125
139 SkFlattenable* InverseFillPE::CreateProc(SkReadBuffer& buffer) { 126 SkFlattenable* InverseFillPE::CreateProc(SkReadBuffer& buffer) {
140 return SkNEW(InverseFillPE); 127 return SkNEW(InverseFillPE);
141 } 128 }
142 129
143 static SkPathEffect* makepe(float interp, SkTDArray<SkPoint>* pts) { 130 static SkPathEffect* makepe(float interp, SkTDArray<SkPoint>* pts) {
144 SkMatrix lattice; 131 SkMatrix lattice;
145 SkScalar rad = 3 + SkIntToScalar(4) * (1 - interp); 132 SkScalar rad = 3 + SkIntToScalar(4) * (1 - interp);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 } 246 }
260 247
261 private: 248 private:
262 typedef SkView INHERITED; 249 typedef SkView INHERITED;
263 }; 250 };
264 251
265 ////////////////////////////////////////////////////////////////////////////// 252 //////////////////////////////////////////////////////////////////////////////
266 253
267 static SkView* MyFactory() { return new ClockFaceView; } 254 static SkView* MyFactory() { return new ClockFaceView; }
268 static SkViewRegister reg(MyFactory); 255 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « include/effects/SkXfermodeImageFilter.h ('k') | samplecode/SampleAll.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698