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

Side by Side Diff: samplecode/SampleText.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/SampleSubpixelTranslate.cpp ('k') | samplecode/SampleTextAlpha.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 "SkView.h" 9 #include "SkView.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 public: 108 public:
109 TextSpeedView() { 109 TextSpeedView() {
110 fHints = 0; 110 fHints = 0;
111 fClickX = 0; 111 fClickX = 0;
112 112
113 test_breakText(); 113 test_breakText();
114 } 114 }
115 115
116 protected: 116 protected:
117 // overrides from SkEventSink 117 // overrides from SkEventSink
118 bool onQuery(SkEvent* evt) SK_OVERRIDE { 118 bool onQuery(SkEvent* evt) override {
119 if (SampleCode::TitleQ(*evt)) { 119 if (SampleCode::TitleQ(*evt)) {
120 SampleCode::TitleR(evt, "Text"); 120 SampleCode::TitleR(evt, "Text");
121 return true; 121 return true;
122 } 122 }
123 return this->INHERITED::onQuery(evt); 123 return this->INHERITED::onQuery(evt);
124 } 124 }
125 125
126 static void make_textstrip(SkBitmap* bm) { 126 static void make_textstrip(SkBitmap* bm) {
127 bm->allocPixels(SkImageInfo::Make(200, 18, kRGB_565_SkColorType, 127 bm->allocPixels(SkImageInfo::Make(200, 18, kRGB_565_SkColorType,
128 kOpaque_SkAlphaType)); 128 kOpaque_SkAlphaType));
129 bm->eraseColor(SK_ColorWHITE); 129 bm->eraseColor(SK_ColorWHITE);
130 130
131 SkCanvas canvas(*bm); 131 SkCanvas canvas(*bm);
132 SkPaint paint; 132 SkPaint paint;
133 const char* s = "Lorem ipsum dolor sit amet, consectetuer adipiscing eli t"; 133 const char* s = "Lorem ipsum dolor sit amet, consectetuer adipiscing eli t";
134 134
135 paint.setFlags(paint.getFlags() | SkPaint::kAntiAlias_Flag 135 paint.setFlags(paint.getFlags() | SkPaint::kAntiAlias_Flag
136 | SkPaint::kDevKernText_Flag); 136 | SkPaint::kDevKernText_Flag);
137 paint.setTextSize(SkIntToScalar(14)); 137 paint.setTextSize(SkIntToScalar(14));
138 canvas.drawText(s, strlen(s), SkIntToScalar(8), SkIntToScalar(14), paint ); 138 canvas.drawText(s, strlen(s), SkIntToScalar(8), SkIntToScalar(14), paint );
139 } 139 }
140 140
141 static void fill_pts(SkPoint pts[], size_t n, SkRandom* rand) { 141 static void fill_pts(SkPoint pts[], size_t n, SkRandom* rand) {
142 for (size_t i = 0; i < n; i++) 142 for (size_t i = 0; i < n; i++)
143 pts[i].set(rand->nextUScalar1() * 640, rand->nextUScalar1() * 480); 143 pts[i].set(rand->nextUScalar1() * 640, rand->nextUScalar1() * 480);
144 } 144 }
145 145
146 void onDrawContent(SkCanvas* canvas) SK_OVERRIDE { 146 void onDrawContent(SkCanvas* canvas) override {
147 SkAutoCanvasRestore restore(canvas, false); 147 SkAutoCanvasRestore restore(canvas, false);
148 { 148 {
149 SkRect r; 149 SkRect r;
150 r.set(0, 0, SkIntToScalar(1000), SkIntToScalar(20)); 150 r.set(0, 0, SkIntToScalar(1000), SkIntToScalar(20));
151 // canvas->saveLayer(&r, NULL, SkCanvas::kHasAlphaLayer_SaveFlag); 151 // canvas->saveLayer(&r, NULL, SkCanvas::kHasAlphaLayer_SaveFlag);
152 } 152 }
153 153
154 SkPaint paint; 154 SkPaint paint;
155 // const uint16_t glyphs[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,1 7,18,19 }; 155 // const uint16_t glyphs[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,1 7,18,19 };
156 int index = fHints % SK_ARRAY_COUNT(gHints); 156 int index = fHints % SK_ARRAY_COUNT(gHints);
(...skipping 22 matching lines...) Expand all
179 y += paint.getFontSpacing(); 179 y += paint.getFontSpacing();
180 DrawTheText(canvas, text, length, SkIntToScalar(20) + dx, y, pai nt, fClickX); 180 DrawTheText(canvas, text, length, SkIntToScalar(20) + dx, y, pai nt, fClickX);
181 } 181 }
182 } 182 }
183 if (gHints[index].fFlushCache) { 183 if (gHints[index].fFlushCache) {
184 // SkGraphics::SetFontCacheUsed(0); 184 // SkGraphics::SetFontCacheUsed(0);
185 } 185 }
186 } 186 }
187 187
188 virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, 188 virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y,
189 unsigned modi) SK_OVERRIDE { 189 unsigned modi) override {
190 fClickX = x; 190 fClickX = x;
191 this->inval(NULL); 191 this->inval(NULL);
192 return this->INHERITED::onFindClickHandler(x, y, modi); 192 return this->INHERITED::onFindClickHandler(x, y, modi);
193 } 193 }
194 194
195 bool onClick(Click* click) SK_OVERRIDE { 195 bool onClick(Click* click) override {
196 return this->INHERITED::onClick(click); 196 return this->INHERITED::onClick(click);
197 } 197 }
198 198
199 private: 199 private:
200 int fHints; 200 int fHints;
201 SkScalar fClickX; 201 SkScalar fClickX;
202 202
203 typedef SampleView INHERITED; 203 typedef SampleView INHERITED;
204 }; 204 };
205 205
206 ////////////////////////////////////////////////////////////////////////////// 206 //////////////////////////////////////////////////////////////////////////////
207 207
208 static SkView* MyFactory() { return new TextSpeedView; } 208 static SkView* MyFactory() { return new TextSpeedView; }
209 static SkViewRegister reg(MyFactory); 209 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleSubpixelTranslate.cpp ('k') | samplecode/SampleTextAlpha.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698