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 { |
(...skipping 29 matching lines...) Expand all Loading... |
40 } | 40 } |
41 | 41 |
42 virtual void onDraw(SkCanvas* canvas) { | 42 virtual void onDraw(SkCanvas* canvas) { |
43 SkPaint paint; | 43 SkPaint paint; |
44 | 44 |
45 paint.setAntiAlias(true); | 45 paint.setAntiAlias(true); |
46 paint.setLCDRenderText(true); | 46 paint.setLCDRenderText(true); |
47 //With freetype the default (normal hinting) can be really ugly. | 47 //With freetype the default (normal hinting) can be really ugly. |
48 //Most distros now set slight (vertical hinting only) in any event. | 48 //Most distros now set slight (vertical hinting only) in any event. |
49 paint.setHinting(SkPaint::kSlight_Hinting); | 49 paint.setHinting(SkPaint::kSlight_Hinting); |
50 SkSafeUnref(paint.setTypeface(SkTypeface::CreateFromName("Times Roman",
SkTypeface::kNormal))); | 50 sk_tool_utils::set_portable_typeface(&paint, "Times Roman", SkTypeface::
kNormal); |
51 | 51 |
52 const char* text = "Hamburgefons ooo mmm"; | 52 const char* text = "Hamburgefons ooo mmm"; |
53 const size_t textLen = strlen(text); | 53 const size_t textLen = strlen(text); |
54 | 54 |
55 for (int j = 0; j < 2; ++j) { | 55 for (int j = 0; j < 2; ++j) { |
56 // This used to do 6 iterations but it causes the N4 to crash in the
MSAA4 config. | 56 // This used to do 6 iterations but it causes the N4 to crash in the
MSAA4 config. |
57 for (int i = 0; i < 5; ++i) { | 57 for (int i = 0; i < 5; ++i) { |
58 SkScalar x = SkIntToScalar(10); | 58 SkScalar x = SkIntToScalar(10); |
59 SkScalar y = SkIntToScalar(20); | 59 SkScalar y = SkIntToScalar(20); |
60 | 60 |
(...skipping 27 matching lines...) Expand all Loading... |
88 private: | 88 private: |
89 typedef GM INHERITED; | 89 typedef GM INHERITED; |
90 }; | 90 }; |
91 | 91 |
92 ////////////////////////////////////////////////////////////////////////////// | 92 ////////////////////////////////////////////////////////////////////////////// |
93 | 93 |
94 static GM* MyFactory(void*) { return new FontScalerGM; } | 94 static GM* MyFactory(void*) { return new FontScalerGM; } |
95 static GMRegistry reg(MyFactory); | 95 static GMRegistry reg(MyFactory); |
96 | 96 |
97 } | 97 } |
OLD | NEW |