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

Side by Side Diff: gm/typeface.cpp

Issue 806653007: Fix up all the easy virtual ... SK_OVERRIDE cases. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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/tilemodes_scaled.cpp ('k') | gm/variedtext.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 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 "gm.h" 8 #include "gm.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkString.h" 10 #include "SkString.h"
(...skipping 18 matching lines...) Expand all
29 } 29 }
30 30
31 virtual ~TypefaceGM() { 31 virtual ~TypefaceGM() {
32 for (size_t i = 0; i < SK_ARRAY_COUNT(gFaces); i++) { 32 for (size_t i = 0; i < SK_ARRAY_COUNT(gFaces); i++) {
33 SkSafeUnref(fFaces[i]); 33 SkSafeUnref(fFaces[i]);
34 } 34 }
35 delete [] fFaces; 35 delete [] fFaces;
36 } 36 }
37 37
38 protected: 38 protected:
39 virtual SkString onShortName() SK_OVERRIDE { 39 SkString onShortName() SK_OVERRIDE {
40 return SkString("typeface"); 40 return SkString("typeface");
41 } 41 }
42 42
43 virtual SkISize onISize() SK_OVERRIDE { 43 SkISize onISize() SK_OVERRIDE {
44 return SkISize::Make(640, 480); 44 return SkISize::Make(640, 480);
45 } 45 }
46 46
47 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 47 void onDraw(SkCanvas* canvas) SK_OVERRIDE {
48 SkString text("Typefaces are fun!"); 48 SkString text("Typefaces are fun!");
49 SkScalar y = 0; 49 SkScalar y = 0;
50 50
51 SkPaint paint; 51 SkPaint paint;
52 paint.setAntiAlias(true); 52 paint.setAntiAlias(true);
53 for (int i = 0; i < (int)SK_ARRAY_COUNT(gFaces); i++) { 53 for (int i = 0; i < (int)SK_ARRAY_COUNT(gFaces); i++) {
54 this->drawWithFace(text, i, y, paint, canvas); 54 this->drawWithFace(text, i, y, paint, canvas);
55 } 55 }
56 // Now go backwards 56 // Now go backwards
57 for (int i = SK_ARRAY_COUNT(gFaces) - 1; i >= 0; i--) { 57 for (int i = SK_ARRAY_COUNT(gFaces) - 1; i >= 0; i--) {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 } 164 }
165 } 165 }
166 166
167 virtual ~TypefaceStylesGM() { 167 virtual ~TypefaceStylesGM() {
168 for (int i = 0; i < gFaceStylesCount; i++) { 168 for (int i = 0; i < gFaceStylesCount; i++) {
169 SkSafeUnref(fFaces[i]); 169 SkSafeUnref(fFaces[i]);
170 } 170 }
171 } 171 }
172 172
173 protected: 173 protected:
174 virtual SkString onShortName() SK_OVERRIDE { 174 SkString onShortName() SK_OVERRIDE {
175 SkString name("typefacestyles"); 175 SkString name("typefacestyles");
176 if (fApplyKerning) { 176 if (fApplyKerning) {
177 name.append("_kerning"); 177 name.append("_kerning");
178 } 178 }
179 return name; 179 return name;
180 } 180 }
181 181
182 virtual SkISize onISize() SK_OVERRIDE { 182 SkISize onISize() SK_OVERRIDE {
183 return SkISize::Make(640, 480); 183 return SkISize::Make(640, 480);
184 } 184 }
185 185
186 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 186 void onDraw(SkCanvas* canvas) SK_OVERRIDE {
187 SkPaint paint; 187 SkPaint paint;
188 paint.setAntiAlias(true); 188 paint.setAntiAlias(true);
189 paint.setTextSize(SkIntToScalar(30)); 189 paint.setTextSize(SkIntToScalar(30));
190 190
191 const char* text = fApplyKerning ? "Type AWAY" : "Hamburgefons"; 191 const char* text = fApplyKerning ? "Type AWAY" : "Hamburgefons";
192 const size_t textLen = strlen(text); 192 const size_t textLen = strlen(text);
193 193
194 SkScalar x = SkIntToScalar(10); 194 SkScalar x = SkIntToScalar(10);
195 SkScalar dy = paint.getFontMetrics(NULL); 195 SkScalar dy = paint.getFontMetrics(NULL);
196 SkScalar y = dy; 196 SkScalar y = dy;
(...skipping 15 matching lines...) Expand all
212 212
213 private: 213 private:
214 typedef skiagm::GM INHERITED; 214 typedef skiagm::GM INHERITED;
215 }; 215 };
216 216
217 /////////////////////////////////////////////////////////////////////////////// 217 ///////////////////////////////////////////////////////////////////////////////
218 218
219 DEF_GM( return new TypefaceGM; ) 219 DEF_GM( return new TypefaceGM; )
220 DEF_GM( return new TypefaceStylesGM(false); ) 220 DEF_GM( return new TypefaceStylesGM(false); )
221 DEF_GM( return new TypefaceStylesGM(true); ) 221 DEF_GM( return new TypefaceStylesGM(true); )
OLDNEW
« no previous file with comments | « gm/tilemodes_scaled.cpp ('k') | gm/variedtext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698