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

Side by Side Diff: samplecode/SampleDegenerateTwoPtRadials.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/SampleCode.h ('k') | samplecode/SampleFatBits.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 27 matching lines...) Expand all
38 38
39 39
40 class DegenerateTwoPtRadialsView : public SampleView { 40 class DegenerateTwoPtRadialsView : public SampleView {
41 public: 41 public:
42 DegenerateTwoPtRadialsView() { 42 DegenerateTwoPtRadialsView() {
43 fTime = 0; 43 fTime = 0;
44 this->setBGColor(0xFFDDDDDD); 44 this->setBGColor(0xFFDDDDDD);
45 } 45 }
46 46
47 protected: 47 protected:
48 bool onQuery(SkEvent* evt) SK_OVERRIDE { 48 bool onQuery(SkEvent* evt) override {
49 if (SampleCode::TitleQ(*evt)) { 49 if (SampleCode::TitleQ(*evt)) {
50 SampleCode::TitleR(evt, "DegenerateTwoPtRadials"); 50 SampleCode::TitleR(evt, "DegenerateTwoPtRadials");
51 return true; 51 return true;
52 } 52 }
53 return this->INHERITED::onQuery(evt); 53 return this->INHERITED::onQuery(evt);
54 } 54 }
55 55
56 void onDrawContent(SkCanvas* canvas) SK_OVERRIDE { 56 void onDrawContent(SkCanvas* canvas) override {
57 SkScalar delta = fTime / 15.f; 57 SkScalar delta = fTime / 15.f;
58 int intPart = SkScalarFloorToInt(delta); 58 int intPart = SkScalarFloorToInt(delta);
59 delta = delta - SK_Scalar1 * intPart; 59 delta = delta - SK_Scalar1 * intPart;
60 if (intPart % 2) { 60 if (intPart % 2) {
61 delta = SK_Scalar1 - delta; 61 delta = SK_Scalar1 - delta;
62 } 62 }
63 delta -= SK_ScalarHalf; 63 delta -= SK_ScalarHalf;
64 static const int DELTA_SCALE = 500; 64 static const int DELTA_SCALE = 500;
65 delta /= DELTA_SCALE; 65 delta /= DELTA_SCALE;
66 66
67 SkScalar w = SK_Scalar1 * 500; 67 SkScalar w = SK_Scalar1 * 500;
68 SkScalar h = SK_Scalar1 * 500; 68 SkScalar h = SK_Scalar1 * 500;
69 SkScalar l = SK_Scalar1 * 100; 69 SkScalar l = SK_Scalar1 * 100;
70 SkScalar t = SK_Scalar1 * 100; 70 SkScalar t = SK_Scalar1 * 100;
71 draw_gradient2(canvas, SkRect::MakeXYWH(l, t, w, h), delta); 71 draw_gradient2(canvas, SkRect::MakeXYWH(l, t, w, h), delta);
72 SkString txt; 72 SkString txt;
73 txt.appendf("gap at \"tangent\" pt = %f", SkScalarToFloat(delta)); 73 txt.appendf("gap at \"tangent\" pt = %f", SkScalarToFloat(delta));
74 SkPaint paint; 74 SkPaint paint;
75 paint.setAntiAlias(true); 75 paint.setAntiAlias(true);
76 paint.setColor(SK_ColorBLACK); 76 paint.setColor(SK_ColorBLACK);
77 canvas->drawText(txt.c_str(), txt.size(), l + w/2 + w*DELTA_SCALE*delta, t + h + SK_Scalar1 * 10, paint); 77 canvas->drawText(txt.c_str(), txt.size(), l + w/2 + w*DELTA_SCALE*delta, t + h + SK_Scalar1 * 10, paint);
78 } 78 }
79 79
80 bool onAnimate(const SkAnimTimer& timer) SK_OVERRIDE { 80 bool onAnimate(const SkAnimTimer& timer) override {
81 fTime = SkDoubleToScalar(timer.secs() / 15); 81 fTime = SkDoubleToScalar(timer.secs() / 15);
82 return true; 82 return true;
83 } 83 }
84 84
85 private: 85 private:
86 SkScalar fTime; 86 SkScalar fTime;
87 typedef SampleView INHERITED; 87 typedef SampleView INHERITED;
88 }; 88 };
89 89
90 ////////////////////////////////////////////////////////////////////////////// 90 //////////////////////////////////////////////////////////////////////////////
91 91
92 static SkView* MyFactory() { return new DegenerateTwoPtRadialsView; } 92 static SkView* MyFactory() { return new DegenerateTwoPtRadialsView; }
93 static SkViewRegister reg(MyFactory); 93 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleCode.h ('k') | samplecode/SampleFatBits.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698