OLD | NEW |
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 #include "gm.h" | 7 #include "gm.h" |
8 #include "SkBitmapDevice.h" | 8 #include "SkBitmapDevice.h" |
9 #include "SkTypeface.h" | 9 #include "SkTypeface.h" |
10 | 10 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 SkCanvas canvas(&device); | 48 SkCanvas canvas(&device); |
49 canvas.drawColor(SK_ColorWHITE); | 49 canvas.drawColor(SK_ColorWHITE); |
50 | 50 |
51 SkPaint paint; | 51 SkPaint paint; |
52 | 52 |
53 paint.setAntiAlias(true); | 53 paint.setAntiAlias(true); |
54 paint.setLCDRenderText(true); | 54 paint.setLCDRenderText(true); |
55 //With freetype the default (normal hinting) can be really ugly. | 55 //With freetype the default (normal hinting) can be really ugly. |
56 //Most distros now set slight (vertical hinting only) in any event. | 56 //Most distros now set slight (vertical hinting only) in any event. |
57 paint.setHinting(SkPaint::kSlight_Hinting); | 57 paint.setHinting(SkPaint::kSlight_Hinting); |
58 SkSafeUnref(paint.setTypeface(SkTypeface::CreateFromName("Times Roman",
SkTypeface::kNormal))); | 58 sk_tool_utils::set_portable_typeface(&paint, "Times Roman", SkTypeface::
kNormal); |
59 | 59 |
60 const char* text = "Hamburgefons ooo mmm"; | 60 const char* text = "Hamburgefons ooo mmm"; |
61 const size_t textLen = strlen(text); | 61 const size_t textLen = strlen(text); |
62 | 62 |
63 for (int j = 0; j < 2; ++j) { | 63 for (int j = 0; j < 2; ++j) { |
64 for (int i = 0; i < 6; ++i) { | 64 for (int i = 0; i < 6; ++i) { |
65 SkScalar x = SkIntToScalar(10); | 65 SkScalar x = SkIntToScalar(10); |
66 SkScalar y = SkIntToScalar(20); | 66 SkScalar y = SkIntToScalar(20); |
67 | 67 |
68 SkAutoCanvasRestore acr(&canvas, true); | 68 SkAutoCanvasRestore acr(&canvas, true); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 private: | 104 private: |
105 typedef GM INHERITED; | 105 typedef GM INHERITED; |
106 }; | 106 }; |
107 | 107 |
108 ////////////////////////////////////////////////////////////////////////////// | 108 ////////////////////////////////////////////////////////////////////////////// |
109 | 109 |
110 static GM* MyFactory(void*) { return new DevicePropertiesGM; } | 110 static GM* MyFactory(void*) { return new DevicePropertiesGM; } |
111 static GMRegistry reg(MyFactory); | 111 static GMRegistry reg(MyFactory); |
112 | 112 |
113 } | 113 } |
OLD | NEW |