OLD | NEW |
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 #include "gm.h" | 7 #include "gm.h" |
8 #include "SkTypeface.h" | 8 #include "SkTypeface.h" |
9 | 9 |
10 namespace skiagm { | 10 namespace skiagm { |
11 | 11 |
12 class FontScalerGM : public GM { | 12 class FontScalerGM : public GM { |
13 public: | 13 public: |
14 FontScalerGM() { | 14 FontScalerGM() { |
15 this->setBGColor(0xFFFFFFFF); | 15 this->setBGColor(0xFFFFFFFF); |
16 } | 16 } |
17 | 17 |
18 virtual ~FontScalerGM() { | 18 virtual ~FontScalerGM() { |
19 } | 19 } |
20 | 20 |
21 protected: | 21 protected: |
22 | 22 |
23 SkString onShortName() SK_OVERRIDE { | 23 SkString onShortName() override { |
24 return SkString("fontscaler"); | 24 return SkString("fontscaler"); |
25 } | 25 } |
26 | 26 |
27 SkISize onISize() SK_OVERRIDE { | 27 SkISize onISize() override { |
28 return SkISize::Make(1450, 750); | 28 return SkISize::Make(1450, 750); |
29 } | 29 } |
30 | 30 |
31 static void rotate_about(SkCanvas* canvas, | 31 static void rotate_about(SkCanvas* canvas, |
32 SkScalar degrees, | 32 SkScalar degrees, |
33 SkScalar px, SkScalar py) { | 33 SkScalar px, SkScalar py) { |
34 canvas->translate(px, py); | 34 canvas->translate(px, py); |
35 canvas->rotate(degrees); | 35 canvas->rotate(degrees); |
36 canvas->translate(-px, -py); | 36 canvas->translate(-px, -py); |
37 } | 37 } |
38 | 38 |
39 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 39 void onDraw(SkCanvas* canvas) override { |
40 SkPaint paint; | 40 SkPaint paint; |
41 | 41 |
42 paint.setAntiAlias(true); | 42 paint.setAntiAlias(true); |
43 paint.setLCDRenderText(true); | 43 paint.setLCDRenderText(true); |
44 //With freetype the default (normal hinting) can be really ugly. | 44 //With freetype the default (normal hinting) can be really ugly. |
45 //Most distros now set slight (vertical hinting only) in any event. | 45 //Most distros now set slight (vertical hinting only) in any event. |
46 paint.setHinting(SkPaint::kSlight_Hinting); | 46 paint.setHinting(SkPaint::kSlight_Hinting); |
47 sk_tool_utils::set_portable_typeface(&paint, "Times Roman", SkTypeface::
kNormal); | 47 sk_tool_utils::set_portable_typeface(&paint, "Times Roman", SkTypeface::
kNormal); |
48 | 48 |
49 const char* text = "Hamburgefons ooo mmm"; | 49 const char* text = "Hamburgefons ooo mmm"; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 private: | 83 private: |
84 typedef GM INHERITED; | 84 typedef GM INHERITED; |
85 }; | 85 }; |
86 | 86 |
87 ////////////////////////////////////////////////////////////////////////////// | 87 ////////////////////////////////////////////////////////////////////////////// |
88 | 88 |
89 static GM* MyFactory(void*) { return new FontScalerGM; } | 89 static GM* MyFactory(void*) { return new FontScalerGM; } |
90 static GMRegistry reg(MyFactory); | 90 static GMRegistry reg(MyFactory); |
91 | 91 |
92 } | 92 } |
OLD | NEW |