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

Side by Side Diff: gm/hairlines.cpp

Issue 806653007: Fix up all the easy virtual ... SK_OVERRIDE cases. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 11 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 | « gm/gradtext.cpp ('k') | gm/hairmodes.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 2013 Google Inc. 2 * Copyright 2013 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 "gm.h" 8 #include "gm.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkTArray.h" 10 #include "SkTArray.h"
11 11
12 namespace skiagm { 12 namespace skiagm {
13 13
14 class HairlinesGM : public GM { 14 class HairlinesGM : public GM {
15 protected: 15 protected:
16 virtual uint32_t onGetFlags() const SK_OVERRIDE { 16 uint32_t onGetFlags() const SK_OVERRIDE {
17 return kSkipTiled_Flag; 17 return kSkipTiled_Flag;
18 } 18 }
19 19
20 20
21 virtual SkString onShortName() SK_OVERRIDE { 21 SkString onShortName() SK_OVERRIDE {
22 return SkString("hairlines"); 22 return SkString("hairlines");
23 } 23 }
24 24
25 virtual SkISize onISize() SK_OVERRIDE { return SkISize::Make(1250, 1250); } 25 SkISize onISize() SK_OVERRIDE { return SkISize::Make(1250, 1250); }
26 26
27 virtual void onOnceBeforeDraw() SK_OVERRIDE { 27 void onOnceBeforeDraw() SK_OVERRIDE {
28 { 28 {
29 SkPath* lineAnglesPath = &fPaths.push_back(); 29 SkPath* lineAnglesPath = &fPaths.push_back();
30 enum { 30 enum {
31 kNumAngles = 15, 31 kNumAngles = 15,
32 kRadius = 40, 32 kRadius = 40,
33 }; 33 };
34 for (int i = 0; i < kNumAngles; ++i) { 34 for (int i = 0; i < kNumAngles; ++i) {
35 SkScalar angle = SK_ScalarPI * SkIntToScalar(i) / kNumAngles; 35 SkScalar angle = SK_ScalarPI * SkIntToScalar(i) / kNumAngles;
36 SkScalar x = kRadius * SkScalarCos(angle); 36 SkScalar x = kRadius * SkScalarCos(angle);
37 SkScalar y = kRadius * SkScalarSin(angle); 37 SkScalar y = kRadius * SkScalarSin(angle);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 157
158 sinV = SkScalarSinCos(SkDegreesToRadians(kStartAngle + kSweepAngle), &cosV); 158 sinV = SkScalarSinCos(SkDegreesToRadians(kStartAngle + kSweepAngle), &cosV);
159 159
160 SkPoint p1 = SkPoint::Make(kRad * cosV, kRad * sinV); 160 SkPoint p1 = SkPoint::Make(kRad * cosV, kRad * sinV);
161 161
162 bug->moveTo(p0); 162 bug->moveTo(p0);
163 bug->lineTo(p1); 163 bug->lineTo(p1);
164 } 164 }
165 } 165 }
166 166
167 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 167 void onDraw(SkCanvas* canvas) SK_OVERRIDE {
168 static const SkAlpha kAlphaValue[] = { 0xFF, 0x40 }; 168 static const SkAlpha kAlphaValue[] = { 0xFF, 0x40 };
169 static const SkScalar kWidths[] = { 0, 0.5f, 1.5f }; 169 static const SkScalar kWidths[] = { 0, 0.5f, 1.5f };
170 170
171 enum { 171 enum {
172 kMargin = 5, 172 kMargin = 5,
173 }; 173 };
174 int wrapX = canvas->getDeviceSize().fWidth - kMargin; 174 int wrapX = canvas->getDeviceSize().fWidth - kMargin;
175 175
176 SkScalar maxH = 0; 176 SkScalar maxH = 0;
177 canvas->translate(SkIntToScalar(kMargin), SkIntToScalar(kMargin)); 177 canvas->translate(SkIntToScalar(kMargin), SkIntToScalar(kMargin));
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 SkTArray<SkPath> fPaths; 219 SkTArray<SkPath> fPaths;
220 typedef GM INHERITED; 220 typedef GM INHERITED;
221 }; 221 };
222 222
223 ////////////////////////////////////////////////////////////////////////////// 223 //////////////////////////////////////////////////////////////////////////////
224 224
225 static GM* MyFactory(void*) { return new HairlinesGM; } 225 static GM* MyFactory(void*) { return new HairlinesGM; }
226 static GMRegistry reg(MyFactory); 226 static GMRegistry reg(MyFactory);
227 227
228 } 228 }
OLDNEW
« no previous file with comments | « gm/gradtext.cpp ('k') | gm/hairmodes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698