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

Side by Side Diff: samplecode/SampleAnimBlur.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/SampleAll.cpp ('k') | samplecode/SampleApp.h » ('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 2012 Google Inc. 2 * Copyright 2012 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 "SkBlurMaskFilter.h" 10 #include "SkBlurMaskFilter.h"
(...skipping 10 matching lines...) Expand all
21 amplitude = SK_ScalarHalf * amplitude; 21 amplitude = SK_ScalarHalf * amplitude;
22 return amplitude * SkDoubleToScalar(sin(t)) + amplitude; 22 return amplitude * SkDoubleToScalar(sin(t)) + amplitude;
23 } 23 }
24 24
25 class AnimBlurView : public SampleView { 25 class AnimBlurView : public SampleView {
26 public: 26 public:
27 AnimBlurView() : fBlurSigma(0), fCircleRadius(100) {} 27 AnimBlurView() : fBlurSigma(0), fCircleRadius(100) {}
28 28
29 protected: 29 protected:
30 // overrides from SkEventSink 30 // overrides from SkEventSink
31 bool onQuery(SkEvent* evt) SK_OVERRIDE { 31 bool onQuery(SkEvent* evt) override {
32 if (SampleCode::TitleQ(*evt)) { 32 if (SampleCode::TitleQ(*evt)) {
33 SampleCode::TitleR(evt, "AnimBlur"); 33 SampleCode::TitleR(evt, "AnimBlur");
34 return true; 34 return true;
35 } 35 }
36 return this->INHERITED::onQuery(evt); 36 return this->INHERITED::onQuery(evt);
37 } 37 }
38 38
39 void onDrawContent(SkCanvas* canvas) SK_OVERRIDE { 39 void onDrawContent(SkCanvas* canvas) override {
40 static const SkBlurStyle gStyles[] = { 40 static const SkBlurStyle gStyles[] = {
41 kNormal_SkBlurStyle, 41 kNormal_SkBlurStyle,
42 kInner_SkBlurStyle, 42 kInner_SkBlurStyle,
43 kSolid_SkBlurStyle, 43 kSolid_SkBlurStyle,
44 kOuter_SkBlurStyle, 44 kOuter_SkBlurStyle,
45 }; 45 };
46 SkRandom random; 46 SkRandom random;
47 47
48 for (size_t i = 0; i < SK_ARRAY_COUNT(gStyles); ++i) { 48 for (size_t i = 0; i < SK_ARRAY_COUNT(gStyles); ++i) {
49 SkMaskFilter* mf = SkBlurMaskFilter::Create( 49 SkMaskFilter* mf = SkBlurMaskFilter::Create(
50 gStyles[i], 50 gStyles[i],
51 fBlurSigma, 51 fBlurSigma,
52 SkBlurMaskFilter::kHighQuality_BlurFlag); 52 SkBlurMaskFilter::kHighQuality_BlurFlag);
53 SkPaint paint; 53 SkPaint paint;
54 SkSafeUnref(paint.setMaskFilter(mf)); 54 SkSafeUnref(paint.setMaskFilter(mf));
55 paint.setColor(random.nextU() | 0xff000000); 55 paint.setColor(random.nextU() | 0xff000000);
56 canvas->drawCircle(200 * SK_Scalar1 + 400 * (i % 2) * SK_Scalar1, 56 canvas->drawCircle(200 * SK_Scalar1 + 400 * (i % 2) * SK_Scalar1,
57 200 * SK_Scalar1 + i / 2 * 400 * SK_Scalar1, 57 200 * SK_Scalar1 + i / 2 * 400 * SK_Scalar1,
58 fCircleRadius, paint); 58 fCircleRadius, paint);
59 } 59 }
60 } 60 }
61 61
62 bool onAnimate(const SkAnimTimer& timer) SK_OVERRIDE { 62 bool onAnimate(const SkAnimTimer& timer) override {
63 fBlurSigma = get_anim_sin(timer.secs(), 100, 4, 5); 63 fBlurSigma = get_anim_sin(timer.secs(), 100, 4, 5);
64 fCircleRadius = 3 + get_anim_sin(timer.secs(), 150, 25, 3); 64 fCircleRadius = 3 + get_anim_sin(timer.secs(), 150, 25, 3);
65 return true; 65 return true;
66 } 66 }
67 67
68 private: 68 private:
69 SkScalar fBlurSigma, fCircleRadius; 69 SkScalar fBlurSigma, fCircleRadius;
70 70
71 typedef SampleView INHERITED; 71 typedef SampleView INHERITED;
72 }; 72 };
73 73
74 ////////////////////////////////////////////////////////////////////////////// 74 //////////////////////////////////////////////////////////////////////////////
75 75
76 static SkView* MyFactory() { return new AnimBlurView; } 76 static SkView* MyFactory() { return new AnimBlurView; }
77 static SkViewRegister reg(MyFactory); 77 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleAll.cpp ('k') | samplecode/SampleApp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698