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

Side by Side Diff: samplecode/ClockFaceView.cpp

Issue 768183002: Revert of 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
93 virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE { 100 virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE {
94 buffer.writeMatrix(this->getMatrix()); 101 buffer.writeMatrix(this->getMatrix());
95 buffer.writeScalar(fRadius); 102 buffer.writeScalar(fRadius);
96 } 103 }
97 104
98 private: 105 private:
99 SkScalar fRadius; 106 SkScalar fRadius;
100 SkTDArray<SkPoint>* fPts; 107 SkTDArray<SkPoint>* fPts;
101 108
102 typedef Sk2DPathEffect INHERITED; 109 typedef Sk2DPathEffect INHERITED;
103 }; 110 };
104 111
105 SkFlattenable* Dot2DPathEffect::CreateProc(SkReadBuffer& buffer) { 112 SkFlattenable* Dot2DPathEffect::CreateProc(SkReadBuffer& buffer) {
106 SkMatrix matrix; 113 SkMatrix matrix;
107 buffer.readMatrix(&matrix); 114 buffer.readMatrix(&matrix);
108 return SkNEW_ARGS(Dot2DPathEffect, (buffer.readScalar(), matrix, NULL)); 115 return SkNEW_ARGS(Dot2DPathEffect, (buffer.readScalar(), matrix, NULL));
109 } 116 }
110 117
111 class InverseFillPE : public SkPathEffect { 118 class InverseFillPE : public SkPathEffect {
112 public: 119 public:
113 InverseFillPE() {} 120 InverseFillPE() {}
114 virtual bool filterPath(SkPath* dst, const SkPath& src, 121 virtual bool filterPath(SkPath* dst, const SkPath& src,
115 SkStrokeRec*, const SkRect*) const SK_OVERRIDE { 122 SkStrokeRec*, const SkRect*) const SK_OVERRIDE {
116 *dst = src; 123 *dst = src;
117 dst->setFillType(SkPath::kInverseWinding_FillType); 124 dst->setFillType(SkPath::kInverseWinding_FillType);
118 return true; 125 return true;
119 } 126 }
120 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(InverseFillPE) 127 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(InverseFillPE)
121 128
129 protected:
130 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
131 InverseFillPE(SkReadBuffer& buffer) : INHERITED(buffer) {}
132 #endif
133
122 private: 134 private:
135
123 typedef SkPathEffect INHERITED; 136 typedef SkPathEffect INHERITED;
124 }; 137 };
125 138
126 SkFlattenable* InverseFillPE::CreateProc(SkReadBuffer& buffer) { 139 SkFlattenable* InverseFillPE::CreateProc(SkReadBuffer& buffer) {
127 return SkNEW(InverseFillPE); 140 return SkNEW(InverseFillPE);
128 } 141 }
129 142
130 static SkPathEffect* makepe(float interp, SkTDArray<SkPoint>* pts) { 143 static SkPathEffect* makepe(float interp, SkTDArray<SkPoint>* pts) {
131 SkMatrix lattice; 144 SkMatrix lattice;
132 SkScalar rad = 3 + SkIntToScalar(4) * (1 - interp); 145 SkScalar rad = 3 + SkIntToScalar(4) * (1 - interp);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 } 259 }
247 260
248 private: 261 private:
249 typedef SkView INHERITED; 262 typedef SkView INHERITED;
250 }; 263 };
251 264
252 ////////////////////////////////////////////////////////////////////////////// 265 //////////////////////////////////////////////////////////////////////////////
253 266
254 static SkView* MyFactory() { return new ClockFaceView; } 267 static SkView* MyFactory() { return new ClockFaceView; }
255 static SkViewRegister reg(MyFactory); 268 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