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

Side by Side Diff: gm/fontmgr.cpp

Issue 831113002: Cleanup: More override fixes - another round. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 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/filterindiabox.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 virtual SkString onShortName() { 71 virtual SkString onShortName() SK_OVERRIDE {
72 return fName; 72 return fName;
73 } 73 }
74 74
75 virtual SkISize onISize() { 75 virtual SkISize onISize() SK_OVERRIDE {
76 return SkISize::Make(1536, 768); 76 return SkISize::Make(1536, 768);
77 } 77 }
78 78
79 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 79 virtual void onDraw(SkCanvas* canvas) SK_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);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 133
134 class FontMgrMatchGM : public skiagm::GM { 134 class FontMgrMatchGM : public skiagm::GM {
135 SkAutoTUnref<SkFontMgr> fFM; 135 SkAutoTUnref<SkFontMgr> fFM;
136 136
137 public: 137 public:
138 FontMgrMatchGM() : fFM(SkFontMgr::RefDefault()) { 138 FontMgrMatchGM() : fFM(SkFontMgr::RefDefault()) {
139 SkGraphics::SetFontCacheLimit(16 * 1024 * 1024); 139 SkGraphics::SetFontCacheLimit(16 * 1024 * 1024);
140 } 140 }
141 141
142 protected: 142 protected:
143 virtual SkString onShortName() { 143 virtual SkString onShortName() SK_OVERRIDE {
144 return SkString("fontmgr_match"); 144 return SkString("fontmgr_match");
145 } 145 }
146 146
147 virtual SkISize onISize() { 147 virtual SkISize onISize() SK_OVERRIDE {
148 return SkISize::Make(640, 1024); 148 return SkISize::Make(640, 1024);
149 } 149 }
150 150
151 void iterateFamily(SkCanvas* canvas, const SkPaint& paint, 151 void iterateFamily(SkCanvas* canvas, const SkPaint& paint,
152 SkFontStyleSet* fset) { 152 SkFontStyleSet* fset) {
153 SkPaint p(paint); 153 SkPaint p(paint);
154 SkScalar y = 0; 154 SkScalar y = 0;
155 155
156 for (int j = 0; j < fset->count(); ++j) { 156 for (int j = 0; j < fset->count(); ++j) {
157 SkString sname; 157 SkString sname;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 fFM.reset(SkFontMgr::RefDefault()); 237 fFM.reset(SkFontMgr::RefDefault());
238 } 238 }
239 239
240 static void show_bounds(SkCanvas* canvas, const SkPaint& paint, SkScalar x, SkScalar y, 240 static void show_bounds(SkCanvas* canvas, const SkPaint& paint, SkScalar x, SkScalar y,
241 SkColor boundsColor) { 241 SkColor boundsColor) {
242 const char str[] = "jyHO[]{}@-_&%$"; 242 const char str[] = "jyHO[]{}@-_&%$";
243 243
244 for (int i = 0; str[i]; ++i) { 244 for (int i = 0; str[i]; ++i) {
245 canvas->drawText(&str[i], 1, x, y, paint); 245 canvas->drawText(&str[i], 1, x, y, paint);
246 } 246 }
247 247
248 SkRect r = paint.getFontBounds(); 248 SkRect r = paint.getFontBounds();
249 r.offset(x, y); 249 r.offset(x, y);
250 SkPaint p(paint); 250 SkPaint p(paint);
251 p.setColor(boundsColor); 251 p.setColor(boundsColor);
252 canvas->drawRect(r, p); 252 canvas->drawRect(r, p);
253 } 253 }
254 254
255 protected: 255 protected:
256 virtual SkString onShortName() { 256 virtual SkString onShortName() SK_OVERRIDE {
257 return fName; 257 return fName;
258 } 258 }
259 259
260 virtual SkISize onISize() { 260 virtual SkISize onISize() SK_OVERRIDE {
261 return SkISize::Make(1024, 850); 261 return SkISize::Make(1024, 850);
262 } 262 }
263 263
264 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 264 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
265 SkPaint paint; 265 SkPaint paint;
266 paint.setAntiAlias(true); 266 paint.setAntiAlias(true);
267 paint.setSubpixelText(true); 267 paint.setSubpixelText(true);
268 paint.setTextSize(100); 268 paint.setTextSize(100);
269 paint.setStyle(SkPaint::kStroke_Style); 269 paint.setStyle(SkPaint::kStroke_Style);
270 paint.setTextScaleX(fScaleX); 270 paint.setTextScaleX(fScaleX);
271 paint.setTextSkewX(fSkewX); 271 paint.setTextSkewX(fSkewX);
272 272
273 const SkColor boundsColors[2] = { SK_ColorRED, SK_ColorBLUE }; 273 const SkColor boundsColors[2] = { SK_ColorRED, SK_ColorBLUE };
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 321
322 DEF_GM( return SkNEW(FontMgrGM); ) 322 DEF_GM( return SkNEW(FontMgrGM); )
323 DEF_GM( return SkNEW(FontMgrMatchGM); ) 323 DEF_GM( return SkNEW(FontMgrMatchGM); )
324 DEF_GM( return SkNEW(FontMgrBoundsGM(1.0, 0)); ) 324 DEF_GM( return SkNEW(FontMgrBoundsGM(1.0, 0)); )
325 DEF_GM( return SkNEW(FontMgrBoundsGM(0.75, 0)); ) 325 DEF_GM( return SkNEW(FontMgrBoundsGM(0.75, 0)); )
326 DEF_GM( return SkNEW(FontMgrBoundsGM(1.0, -0.25)); ) 326 DEF_GM( return SkNEW(FontMgrBoundsGM(1.0, -0.25)); )
327 327
328 #ifdef SK_BUILD_FOR_WIN 328 #ifdef SK_BUILD_FOR_WIN
329 DEF_GM( return SkNEW_ARGS(FontMgrGM, (SkFontMgr_New_DirectWrite())); ) 329 DEF_GM( return SkNEW_ARGS(FontMgrGM, (SkFontMgr_New_DirectWrite())); )
330 #endif 330 #endif
OLDNEW
« no previous file with comments | « gm/filterindiabox.cpp ('k') | gm/fontscaler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698