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

Side by Side Diff: samplecode/SamplePathEffects.cpp

Issue 1037793002: C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: git cl web Created 5 years, 9 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 | « samplecode/SamplePathClip.cpp ('k') | samplecode/SamplePathFuzz.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 7
8 #include "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkAnimTimer.h" 9 #include "SkAnimTimer.h"
10 #include "SkView.h" 10 #include "SkView.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 class PathEffectView : public SampleView { 92 class PathEffectView : public SampleView {
93 SkPath fPath; 93 SkPath fPath;
94 SkPoint fClickPt; 94 SkPoint fClickPt;
95 SkScalar fPhase; 95 SkScalar fPhase;
96 96
97 public: 97 public:
98 PathEffectView() : fPhase(0) { 98 PathEffectView() : fPhase(0) {
99 } 99 }
100 100
101 protected: 101 protected:
102 void onOnceBeforeDraw() SK_OVERRIDE { 102 void onOnceBeforeDraw() override {
103 SkRandom rand; 103 SkRandom rand;
104 int steps = 20; 104 int steps = 20;
105 SkScalar dist = SkIntToScalar(400); 105 SkScalar dist = SkIntToScalar(400);
106 SkScalar x = SkIntToScalar(20); 106 SkScalar x = SkIntToScalar(20);
107 SkScalar y = SkIntToScalar(50); 107 SkScalar y = SkIntToScalar(50);
108 108
109 fPath.moveTo(x, y); 109 fPath.moveTo(x, y);
110 for (int i = 0; i < steps; i++) { 110 for (int i = 0; i < steps; i++) {
111 x += dist/steps; 111 x += dist/steps;
112 SkScalar tmpY = y + SkIntToScalar(rand.nextS() % 25); 112 SkScalar tmpY = y + SkIntToScalar(rand.nextS() % 25);
(...skipping 10 matching lines...) Expand all
123 SkIntToScalar(100), SkIntToScalar(60)); 123 SkIntToScalar(100), SkIntToScalar(60));
124 oval.offset(x, 0); 124 oval.offset(x, 0);
125 fPath.addRoundRect(oval, SkIntToScalar(8), SkIntToScalar(8)); 125 fPath.addRoundRect(oval, SkIntToScalar(8), SkIntToScalar(8));
126 } 126 }
127 127
128 fClickPt.set(SkIntToScalar(200), SkIntToScalar(200)); 128 fClickPt.set(SkIntToScalar(200), SkIntToScalar(200));
129 129
130 this->setBGColor(0xFFDDDDDD); 130 this->setBGColor(0xFFDDDDDD);
131 } 131 }
132 132
133 bool onQuery(SkEvent* evt) SK_OVERRIDE { 133 bool onQuery(SkEvent* evt) override {
134 if (SampleCode::TitleQ(*evt)) { 134 if (SampleCode::TitleQ(*evt)) {
135 SampleCode::TitleR(evt, "PathEffects"); 135 SampleCode::TitleR(evt, "PathEffects");
136 return true; 136 return true;
137 } 137 }
138 return this->INHERITED::onQuery(evt); 138 return this->INHERITED::onQuery(evt);
139 } 139 }
140 140
141 void onDrawContent(SkCanvas* canvas) SK_OVERRIDE { 141 void onDrawContent(SkCanvas* canvas) override {
142 SkPaint paint; 142 SkPaint paint;
143 143
144 canvas->translate(0, 50); 144 canvas->translate(0, 50);
145 145
146 paint.setColor(SK_ColorBLUE); 146 paint.setColor(SK_ColorBLUE);
147 paint.setPathEffect(make_pe(2, fPhase))->unref(); 147 paint.setPathEffect(make_pe(2, fPhase))->unref();
148 canvas->drawPath(fPath, paint); 148 canvas->drawPath(fPath, paint);
149 149
150 canvas->translate(0, 50); 150 canvas->translate(0, 50);
151 151
152 paint.setARGB(0xFF, 0, 0xBB, 0); 152 paint.setARGB(0xFF, 0, 0xBB, 0);
153 paint.setPathEffect(make_pe(3, fPhase))->unref(); 153 paint.setPathEffect(make_pe(3, fPhase))->unref();
154 canvas->drawPath(fPath, paint); 154 canvas->drawPath(fPath, paint);
155 155
156 canvas->translate(0, 50); 156 canvas->translate(0, 50);
157 157
158 paint.setARGB(0xFF, 0, 0, 0); 158 paint.setARGB(0xFF, 0, 0, 0);
159 paint.setPathEffect(make_warp_pe(fPhase))->unref(); 159 paint.setPathEffect(make_warp_pe(fPhase))->unref();
160 TestRastBuilder testRastBuilder; 160 TestRastBuilder testRastBuilder;
161 paint.setRasterizer(testRastBuilder.detachRasterizer())->unref(); 161 paint.setRasterizer(testRastBuilder.detachRasterizer())->unref();
162 canvas->drawPath(fPath, paint); 162 canvas->drawPath(fPath, paint);
163 } 163 }
164 164
165 bool onAnimate(const SkAnimTimer& timer) SK_OVERRIDE { 165 bool onAnimate(const SkAnimTimer& timer) override {
166 fPhase = timer.scaled(40); 166 fPhase = timer.scaled(40);
167 return true; 167 return true;
168 } 168 }
169 169
170 private: 170 private:
171 typedef SampleView INHERITED; 171 typedef SampleView INHERITED;
172 }; 172 };
173 173
174 ////////////////////////////////////////////////////////////////////////////// 174 //////////////////////////////////////////////////////////////////////////////
175 175
176 static SkView* MyFactory() { return new PathEffectView; } 176 static SkView* MyFactory() { return new PathEffectView; }
177 static SkViewRegister reg(MyFactory); 177 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SamplePathClip.cpp ('k') | samplecode/SamplePathFuzz.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698