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

Side by Side Diff: gm/stringart.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/spritebitmap.cpp ('k') | gm/strokefill.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 "SkPath.h" 10 #include "SkPath.h"
11 11
12 // Reproduces https://code.google.com/p/chromium/issues/detail?id=279014 12 // Reproduces https://code.google.com/p/chromium/issues/detail?id=279014
13 13
14 static const int kWidth = 640; 14 static const int kWidth = 640;
15 static const int kHeight = 480; 15 static const int kHeight = 480;
16 static const SkScalar kAngle = 0.305f; 16 static const SkScalar kAngle = 0.305f;
17 17
18 // Renders a string art shape. 18 // Renders a string art shape.
19 // The particular shape rendered can be controlled by adjusting kAngle, from 0 t o 1 19 // The particular shape rendered can be controlled by adjusting kAngle, from 0 t o 1
20 20
21 class StringArtGM : public skiagm::GM { 21 class StringArtGM : public skiagm::GM {
22 public: 22 public:
23 StringArtGM() {} 23 StringArtGM() {}
24 24
25 protected: 25 protected:
26 virtual uint32_t onGetFlags() const SK_OVERRIDE { 26 uint32_t onGetFlags() const SK_OVERRIDE {
27 return kSkipTiled_Flag; 27 return kSkipTiled_Flag;
28 } 28 }
29 29
30 virtual SkString onShortName() SK_OVERRIDE { 30 SkString onShortName() SK_OVERRIDE {
31 return SkString("stringart"); 31 return SkString("stringart");
32 } 32 }
33 33
34 virtual SkISize onISize() SK_OVERRIDE { 34 SkISize onISize() SK_OVERRIDE {
35 return SkISize::Make(kWidth, kHeight); 35 return SkISize::Make(kWidth, kHeight);
36 } 36 }
37 37
38 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 38 void onDraw(SkCanvas* canvas) SK_OVERRIDE {
39 SkScalar angle = kAngle*SK_ScalarPI + SkScalarHalf(SK_ScalarPI); 39 SkScalar angle = kAngle*SK_ScalarPI + SkScalarHalf(SK_ScalarPI);
40 SkScalar size = SkIntToScalar(SkMin32(kWidth, kHeight)); 40 SkScalar size = SkIntToScalar(SkMin32(kWidth, kHeight));
41 SkPoint center = SkPoint::Make(SkScalarHalf(kWidth), SkScalarHalf(kHeigh t)); 41 SkPoint center = SkPoint::Make(SkScalarHalf(kWidth), SkScalarHalf(kHeigh t));
42 SkScalar length = 5; 42 SkScalar length = 5;
43 SkScalar step = angle; 43 SkScalar step = angle;
44 44
45 SkPath path; 45 SkPath path;
46 path.moveTo(center); 46 path.moveTo(center);
47 47
48 while (length < (SkScalarHalf(size) - 10.f)) 48 while (length < (SkScalarHalf(size) - 10.f))
(...skipping 12 matching lines...) Expand all
61 paint.setColor(0xFF007700); 61 paint.setColor(0xFF007700);
62 62
63 canvas->drawPath(path, paint); 63 canvas->drawPath(path, paint);
64 } 64 }
65 65
66 private: 66 private:
67 typedef GM INHERITED; 67 typedef GM INHERITED;
68 }; 68 };
69 69
70 DEF_GM( return new StringArtGM; ) 70 DEF_GM( return new StringArtGM; )
OLDNEW
« no previous file with comments | « gm/spritebitmap.cpp ('k') | gm/strokefill.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698