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

Side by Side Diff: samplecode/ClockFaceView.cpp

Issue 2063883002: Revert of Add samples to Viewer. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 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 | « gyp/viewer.gyp ('k') | samplecode/SampleAtlas.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 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
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 #include "SampleCode.h" 7 #include "SampleCode.h"
8 #include "SkView.h" 8 #include "SkView.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkReadBuffer.h" 10 #include "SkReadBuffer.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 #include "Sk2DPathEffect.h" 66 #include "Sk2DPathEffect.h"
67 67
68 class Dot2DPathEffect : public Sk2DPathEffect { 68 class Dot2DPathEffect : public Sk2DPathEffect {
69 public: 69 public:
70 Dot2DPathEffect(SkScalar radius, const SkMatrix& matrix, 70 Dot2DPathEffect(SkScalar radius, const SkMatrix& matrix,
71 SkTDArray<SkPoint>* pts) 71 SkTDArray<SkPoint>* pts)
72 : Sk2DPathEffect(matrix), fRadius(radius), fPts(pts) {} 72 : Sk2DPathEffect(matrix), fRadius(radius), fPts(pts) {}
73 73
74 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Dot2DPathEffect) 74 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Dot2DPathEffect)
75 class Registrar { 75
76 public:
77 Registrar() {
78 SkFlattenable::Register("Dot2DPathEffect",
79 Dot2DPathEffect::CreateProc,
80 Dot2DPathEffect::GetFlattenableType());
81 }
82 };
83 protected: 76 protected:
84 void begin(const SkIRect& uvBounds, SkPath* dst) const override { 77 void begin(const SkIRect& uvBounds, SkPath* dst) const override {
85 if (fPts) { 78 if (fPts) {
86 fPts->reset(); 79 fPts->reset();
87 } 80 }
88 this->INHERITED::begin(uvBounds, dst); 81 this->INHERITED::begin(uvBounds, dst);
89 } 82 }
90 83
91 virtual void next(const SkPoint& loc, int u, int v, 84 virtual void next(const SkPoint& loc, int u, int v,
92 SkPath* dst) const override { 85 SkPath* dst) const override {
93 if (fPts) { 86 if (fPts) {
94 *fPts->append() = loc; 87 *fPts->append() = loc;
95 } 88 }
96 dst->addCircle(loc.fX, loc.fY, fRadius); 89 dst->addCircle(loc.fX, loc.fY, fRadius);
97 } 90 }
98 91
99 void flatten(SkWriteBuffer& buffer) const override { 92 void flatten(SkWriteBuffer& buffer) const override {
100 buffer.writeMatrix(this->getMatrix()); 93 buffer.writeMatrix(this->getMatrix());
101 buffer.writeScalar(fRadius); 94 buffer.writeScalar(fRadius);
102 } 95 }
103 96
104 private: 97 private:
105 SkScalar fRadius; 98 SkScalar fRadius;
106 SkTDArray<SkPoint>* fPts; 99 SkTDArray<SkPoint>* fPts;
107 100
108 typedef Sk2DPathEffect INHERITED; 101 typedef Sk2DPathEffect INHERITED;
109 }; 102 };
110 103
111 static Dot2DPathEffect::Registrar gReg0;
112
113 sk_sp<SkFlattenable> Dot2DPathEffect::CreateProc(SkReadBuffer& buffer) { 104 sk_sp<SkFlattenable> Dot2DPathEffect::CreateProc(SkReadBuffer& buffer) {
114 SkMatrix matrix; 105 SkMatrix matrix;
115 buffer.readMatrix(&matrix); 106 buffer.readMatrix(&matrix);
116 return sk_make_sp<Dot2DPathEffect>(buffer.readScalar(), matrix, nullptr); 107 return sk_make_sp<Dot2DPathEffect>(buffer.readScalar(), matrix, nullptr);
117 } 108 }
118 109
119 class InverseFillPE : public SkPathEffect { 110 class InverseFillPE : public SkPathEffect {
120 public: 111 public:
121 InverseFillPE() {} 112 InverseFillPE() {}
122 virtual bool filterPath(SkPath* dst, const SkPath& src, 113 virtual bool filterPath(SkPath* dst, const SkPath& src,
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 } 247 }
257 248
258 private: 249 private:
259 typedef SkView INHERITED; 250 typedef SkView INHERITED;
260 }; 251 };
261 252
262 ////////////////////////////////////////////////////////////////////////////// 253 //////////////////////////////////////////////////////////////////////////////
263 254
264 static SkView* MyFactory() { return new ClockFaceView; } 255 static SkView* MyFactory() { return new ClockFaceView; }
265 static SkViewRegister reg(MyFactory); 256 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « gyp/viewer.gyp ('k') | samplecode/SampleAtlas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698