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

Side by Side Diff: gm/fontmgr.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 | « gm/fontcache.cpp ('k') | gm/fontscaler.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 "SkFontMgr.h" 10 #include "SkFontMgr.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 fName.set("fontmgr_iter"); 61 fName.set("fontmgr_iter");
62 if (fontMgr) { 62 if (fontMgr) {
63 fName.append("_factory"); 63 fName.append("_factory");
64 fFM.reset(fontMgr); 64 fFM.reset(fontMgr);
65 } else { 65 } else {
66 fFM.reset(SkFontMgr::RefDefault()); 66 fFM.reset(SkFontMgr::RefDefault());
67 } 67 }
68 } 68 }
69 69
70 protected: 70 protected:
71 SkString onShortName() SK_OVERRIDE { 71 SkString onShortName() override {
72 return fName; 72 return fName;
73 } 73 }
74 74
75 SkISize onISize() SK_OVERRIDE { 75 SkISize onISize() override {
76 return SkISize::Make(1536, 768); 76 return SkISize::Make(1536, 768);
77 } 77 }
78 78
79 void onDraw(SkCanvas* canvas) SK_OVERRIDE { 79 void onDraw(SkCanvas* canvas) override {
80 SkScalar y = 20; 80 SkScalar y = 20;
81 SkPaint paint; 81 SkPaint paint;
82 paint.setAntiAlias(true); 82 paint.setAntiAlias(true);
83 paint.setLCDRenderText(true); 83 paint.setLCDRenderText(true);
84 paint.setSubpixelText(true); 84 paint.setSubpixelText(true);
85 paint.setTextSize(17); 85 paint.setTextSize(17);
86 86
87 SkFontMgr* fm = fFM; 87 SkFontMgr* fm = fFM;
88 int count = SkMin32(fm->countFamilies(), MAX_FAMILIES); 88 int count = SkMin32(fm->countFamilies(), MAX_FAMILIES);
89 89
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 class FontMgrMatchGM : public skiagm::GM { 124 class FontMgrMatchGM : public skiagm::GM {
125 SkAutoTUnref<SkFontMgr> fFM; 125 SkAutoTUnref<SkFontMgr> fFM;
126 126
127 public: 127 public:
128 FontMgrMatchGM() : fFM(SkFontMgr::RefDefault()) { 128 FontMgrMatchGM() : fFM(SkFontMgr::RefDefault()) {
129 SkGraphics::SetFontCacheLimit(16 * 1024 * 1024); 129 SkGraphics::SetFontCacheLimit(16 * 1024 * 1024);
130 } 130 }
131 131
132 protected: 132 protected:
133 SkString onShortName() SK_OVERRIDE { 133 SkString onShortName() override {
134 return SkString("fontmgr_match"); 134 return SkString("fontmgr_match");
135 } 135 }
136 136
137 SkISize onISize() SK_OVERRIDE { 137 SkISize onISize() override {
138 return SkISize::Make(640, 1024); 138 return SkISize::Make(640, 1024);
139 } 139 }
140 140
141 void iterateFamily(SkCanvas* canvas, const SkPaint& paint, 141 void iterateFamily(SkCanvas* canvas, const SkPaint& paint,
142 SkFontStyleSet* fset) { 142 SkFontStyleSet* fset) {
143 SkPaint p(paint); 143 SkPaint p(paint);
144 SkScalar y = 0; 144 SkScalar y = 0;
145 145
146 for (int j = 0; j < fset->count(); ++j) { 146 for (int j = 0; j < fset->count(); ++j) {
147 SkString sname; 147 SkString sname;
(...skipping 21 matching lines...) Expand all
169 SkString str; 169 SkString str;
170 str.printf("request [%d %d]", fs.weight(), fs.width()); 170 str.printf("request [%d %d]", fs.weight(), fs.width());
171 p.setTypeface(face)->unref(); 171 p.setTypeface(face)->unref();
172 (void)drawString(canvas, str, 0, y, p); 172 (void)drawString(canvas, str, 0, y, p);
173 y += 24; 173 y += 24;
174 } 174 }
175 } 175 }
176 } 176 }
177 } 177 }
178 178
179 void onDraw(SkCanvas* canvas) SK_OVERRIDE { 179 void onDraw(SkCanvas* canvas) override {
180 SkPaint paint; 180 SkPaint paint;
181 paint.setAntiAlias(true); 181 paint.setAntiAlias(true);
182 paint.setLCDRenderText(true); 182 paint.setLCDRenderText(true);
183 paint.setSubpixelText(true); 183 paint.setSubpixelText(true);
184 paint.setTextSize(17); 184 paint.setTextSize(17);
185 185
186 static const char* gNames[] = { 186 static const char* gNames[] = {
187 "Helvetica Neue", "Arial" 187 "Helvetica Neue", "Arial"
188 }; 188 };
189 189
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 } 230 }
231 231
232 SkRect r = paint.getFontBounds(); 232 SkRect r = paint.getFontBounds();
233 r.offset(x, y); 233 r.offset(x, y);
234 SkPaint p(paint); 234 SkPaint p(paint);
235 p.setColor(boundsColor); 235 p.setColor(boundsColor);
236 canvas->drawRect(r, p); 236 canvas->drawRect(r, p);
237 } 237 }
238 238
239 protected: 239 protected:
240 SkString onShortName() SK_OVERRIDE { 240 SkString onShortName() override {
241 return fName; 241 return fName;
242 } 242 }
243 243
244 SkISize onISize() SK_OVERRIDE { 244 SkISize onISize() override {
245 return SkISize::Make(1024, 850); 245 return SkISize::Make(1024, 850);
246 } 246 }
247 247
248 void onDraw(SkCanvas* canvas) SK_OVERRIDE { 248 void onDraw(SkCanvas* canvas) override {
249 SkPaint paint; 249 SkPaint paint;
250 paint.setAntiAlias(true); 250 paint.setAntiAlias(true);
251 paint.setSubpixelText(true); 251 paint.setSubpixelText(true);
252 paint.setTextSize(100); 252 paint.setTextSize(100);
253 paint.setStyle(SkPaint::kStroke_Style); 253 paint.setStyle(SkPaint::kStroke_Style);
254 paint.setTextScaleX(fScaleX); 254 paint.setTextScaleX(fScaleX);
255 paint.setTextSkewX(fSkewX); 255 paint.setTextSkewX(fSkewX);
256 256
257 const SkColor boundsColors[2] = { SK_ColorRED, SK_ColorBLUE }; 257 const SkColor boundsColors[2] = { SK_ColorRED, SK_ColorBLUE };
258 258
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 295
296 DEF_GM( return SkNEW(FontMgrGM); ) 296 DEF_GM( return SkNEW(FontMgrGM); )
297 DEF_GM( return SkNEW(FontMgrMatchGM); ) 297 DEF_GM( return SkNEW(FontMgrMatchGM); )
298 DEF_GM( return SkNEW(FontMgrBoundsGM(1.0, 0)); ) 298 DEF_GM( return SkNEW(FontMgrBoundsGM(1.0, 0)); )
299 DEF_GM( return SkNEW(FontMgrBoundsGM(0.75, 0)); ) 299 DEF_GM( return SkNEW(FontMgrBoundsGM(0.75, 0)); )
300 DEF_GM( return SkNEW(FontMgrBoundsGM(1.0, -0.25)); ) 300 DEF_GM( return SkNEW(FontMgrBoundsGM(1.0, -0.25)); )
301 301
302 #ifdef SK_BUILD_FOR_WIN 302 #ifdef SK_BUILD_FOR_WIN
303 DEF_GM( return SkNEW_ARGS(FontMgrGM, (SkFontMgr_New_DirectWrite())); ) 303 DEF_GM( return SkNEW_ARGS(FontMgrGM, (SkFontMgr_New_DirectWrite())); )
304 #endif 304 #endif
OLDNEW
« no previous file with comments | « gm/fontcache.cpp ('k') | gm/fontscaler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698