OLD | NEW |
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 virtual SkISize onISize() SK_OVERRIDE { | 43 virtual 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 virtual 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 (size_t i = 0; i < 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--) { |
58 this->drawWithFace(text, i, y, paint, canvas); | 58 this->drawWithFace(text, i, y, paint, canvas); |
59 } | 59 } |
60 } | 60 } |
61 | 61 |
62 private: | 62 private: |
63 void drawWithFace(const SkString& text, int i, SkScalar& y, SkPaint& paint, | 63 void drawWithFace(const SkString& text, int i, SkScalar& y, SkPaint& paint, |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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); ) |
OLD | NEW |