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

Side by Side Diff: samplecode/SampleTextOnPath.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, 8 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/SampleTextAlpha.cpp ('k') | samplecode/SampleUnpremul.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkBlurMask.h" 9 #include "SkBlurMask.h"
10 #include "SkBlurDrawLooper.h" 10 #include "SkBlurDrawLooper.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 matrix.postTranslate(pathLen, 0); 87 matrix.postTranslate(pathLen, 0);
88 canvas->drawTextOnPath(text, len, path, &matrix, paint); 88 canvas->drawTextOnPath(text, len, path, &matrix, paint);
89 } 89 }
90 90
91 class TextOnPathView : public SampleView { 91 class TextOnPathView : public SampleView {
92 public: 92 public:
93 SkPath fPath; 93 SkPath fPath;
94 SkScalar fHOffset; 94 SkScalar fHOffset;
95 95
96 protected: 96 protected:
97 void onOnceBeforeDraw() SK_OVERRIDE { 97 void onOnceBeforeDraw() override {
98 SkRect r; 98 SkRect r;
99 r.set(SkIntToScalar(100), SkIntToScalar(100), 99 r.set(SkIntToScalar(100), SkIntToScalar(100),
100 SkIntToScalar(300), SkIntToScalar(300)); 100 SkIntToScalar(300), SkIntToScalar(300));
101 fPath.addOval(r); 101 fPath.addOval(r);
102 fPath.offset(SkIntToScalar(-50), SkIntToScalar(-50)); 102 fPath.offset(SkIntToScalar(-50), SkIntToScalar(-50));
103 103
104 fHOffset = SkIntToScalar(50); 104 fHOffset = SkIntToScalar(50);
105 } 105 }
106 106
107 // overrides from SkEventSink 107 // overrides from SkEventSink
108 bool onQuery(SkEvent* evt) SK_OVERRIDE { 108 bool onQuery(SkEvent* evt) override {
109 if (SampleCode::TitleQ(*evt)) { 109 if (SampleCode::TitleQ(*evt)) {
110 SampleCode::TitleR(evt, "Text On Path"); 110 SampleCode::TitleR(evt, "Text On Path");
111 return true; 111 return true;
112 } 112 }
113 return this->INHERITED::onQuery(evt); 113 return this->INHERITED::onQuery(evt);
114 } 114 }
115 115
116 void onDrawContent(SkCanvas* canvas) SK_OVERRIDE { 116 void onDrawContent(SkCanvas* canvas) override {
117 SkPaint paint; 117 SkPaint paint;
118 paint.setAntiAlias(true); 118 paint.setAntiAlias(true);
119 paint.setTextSize(SkIntToScalar(48)); 119 paint.setTextSize(SkIntToScalar(48));
120 120
121 const char* text = "Hamburgefons"; 121 const char* text = "Hamburgefons";
122 size_t len = strlen(text); 122 size_t len = strlen(text);
123 123
124 for (int j = 0; j < REPEAT_COUNT; j++) { 124 for (int j = 0; j < REPEAT_COUNT; j++) {
125 SkScalar x = fHOffset; 125 SkScalar x = fHOffset;
126 126
(...skipping 17 matching lines...) Expand all
144 canvas->translate(SkIntToScalar(275), 0); 144 canvas->translate(SkIntToScalar(275), 0);
145 textStrokePath(canvas); 145 textStrokePath(canvas);
146 146
147 canvas->translate(SkIntToScalar(-275), SkIntToScalar(250)); 147 canvas->translate(SkIntToScalar(-275), SkIntToScalar(250));
148 textPathMatrix(canvas); 148 textPathMatrix(canvas);
149 149
150 if (REPEAT_COUNT > 1) 150 if (REPEAT_COUNT > 1)
151 this->inval(NULL); 151 this->inval(NULL);
152 } 152 }
153 153
154 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) SK_ OVERRIDE { 154 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) ove rride {
155 fHints += 1; 155 fHints += 1;
156 this->inval(NULL); 156 this->inval(NULL);
157 return this->INHERITED::onFindClickHandler(x, y, modi); 157 return this->INHERITED::onFindClickHandler(x, y, modi);
158 } 158 }
159 159
160 bool onClick(Click* click) SK_OVERRIDE { 160 bool onClick(Click* click) override {
161 return this->INHERITED::onClick(click); 161 return this->INHERITED::onClick(click);
162 } 162 }
163 163
164 private: 164 private:
165 int fHints; 165 int fHints;
166 typedef SampleView INHERITED; 166 typedef SampleView INHERITED;
167 }; 167 };
168 168
169 ////////////////////////////////////////////////////////////////////////////// 169 //////////////////////////////////////////////////////////////////////////////
170 170
171 static SkView* MyFactory() { 171 static SkView* MyFactory() {
172 return new TextOnPathView; 172 return new TextOnPathView;
173 } 173 }
174 174
175 static SkViewRegister reg(MyFactory); 175 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleTextAlpha.cpp ('k') | samplecode/SampleUnpremul.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698