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 | 7 |
8 #include "gm.h" | 8 #include "gm.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkFontMgr.h" | 10 #include "SkFontMgr.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 FontMgrGM(SkFontMgr* fontMgr = NULL) { | 58 FontMgrGM(SkFontMgr* fontMgr = NULL) { |
59 SkGraphics::SetFontCacheLimit(16 * 1024 * 1024); | 59 SkGraphics::SetFontCacheLimit(16 * 1024 * 1024); |
60 | 60 |
61 fName.set("fontmgr_iter"); | 61 fName.set("fontmgr_iter"); |
62 if (fontMgr) { | 62 if (fontMgr) { |
63 fName.append("_factory"); | 63 fName.append("_factory"); |
64 fFM.reset(fontMgr); | 64 fFM.reset(fontMgr); |
65 } else { | 65 } else { |
66 fFM.reset(SkFontMgr::RefDefault()); | 66 fFM.reset(SkFontMgr::RefDefault()); |
67 } | 67 } |
| 68 fName.append(sk_tool_utils::platform_os_name()); |
| 69 fName.append(sk_tool_utils::platform_extra_config("GDI")); |
68 } | 70 } |
69 | 71 |
70 protected: | 72 protected: |
71 SkString onShortName() override { | 73 SkString onShortName() override { |
72 return fName; | 74 return fName; |
73 } | 75 } |
74 | 76 |
75 SkISize onISize() override { | 77 SkISize onISize() override { |
76 return SkISize::Make(1536, 768); | 78 return SkISize::Make(1536, 768); |
77 } | 79 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 class FontMgrMatchGM : public skiagm::GM { | 126 class FontMgrMatchGM : public skiagm::GM { |
125 SkAutoTUnref<SkFontMgr> fFM; | 127 SkAutoTUnref<SkFontMgr> fFM; |
126 | 128 |
127 public: | 129 public: |
128 FontMgrMatchGM() : fFM(SkFontMgr::RefDefault()) { | 130 FontMgrMatchGM() : fFM(SkFontMgr::RefDefault()) { |
129 SkGraphics::SetFontCacheLimit(16 * 1024 * 1024); | 131 SkGraphics::SetFontCacheLimit(16 * 1024 * 1024); |
130 } | 132 } |
131 | 133 |
132 protected: | 134 protected: |
133 SkString onShortName() override { | 135 SkString onShortName() override { |
134 return SkString("fontmgr_match"); | 136 SkString name("fontmgr_match"); |
| 137 name.append(sk_tool_utils::platform_os_name()); |
| 138 name.append(sk_tool_utils::platform_extra_config("GDI")); |
| 139 return name; |
135 } | 140 } |
136 | 141 |
137 SkISize onISize() override { | 142 SkISize onISize() override { |
138 return SkISize::Make(640, 1024); | 143 return SkISize::Make(640, 1024); |
139 } | 144 } |
140 | 145 |
141 void iterateFamily(SkCanvas* canvas, const SkPaint& paint, | 146 void iterateFamily(SkCanvas* canvas, const SkPaint& paint, |
142 SkFontStyleSet* fset) { | 147 SkFontStyleSet* fset) { |
143 SkPaint p(paint); | 148 SkPaint p(paint); |
144 SkScalar y = 0; | 149 SkScalar y = 0; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 class FontMgrBoundsGM : public skiagm::GM { | 216 class FontMgrBoundsGM : public skiagm::GM { |
212 public: | 217 public: |
213 FontMgrBoundsGM(double scale, double skew) | 218 FontMgrBoundsGM(double scale, double skew) |
214 : fScaleX(SkDoubleToScalar(scale)) | 219 : fScaleX(SkDoubleToScalar(scale)) |
215 , fSkewX(SkDoubleToScalar(skew)) | 220 , fSkewX(SkDoubleToScalar(skew)) |
216 { | 221 { |
217 fName.set("fontmgr_bounds"); | 222 fName.set("fontmgr_bounds"); |
218 if (scale != 1 || skew != 0) { | 223 if (scale != 1 || skew != 0) { |
219 fName.appendf("_%g_%g", scale, skew); | 224 fName.appendf("_%g_%g", scale, skew); |
220 } | 225 } |
| 226 fName.append(sk_tool_utils::platform_os_name()); |
| 227 fName.append(sk_tool_utils::platform_extra_config("GDI")); |
221 fFM.reset(SkFontMgr::RefDefault()); | 228 fFM.reset(SkFontMgr::RefDefault()); |
222 } | 229 } |
223 | 230 |
224 static void show_bounds(SkCanvas* canvas, const SkPaint& paint, SkScalar x,
SkScalar y, | 231 static void show_bounds(SkCanvas* canvas, const SkPaint& paint, SkScalar x,
SkScalar y, |
225 SkColor boundsColor) { | 232 SkColor boundsColor) { |
226 const char str[] = "jyHO[]{}@-_&%$"; | 233 const char str[] = "jyHO[]{}@-_&%$"; |
227 | 234 |
228 for (int i = 0; str[i]; ++i) { | 235 for (int i = 0; str[i]; ++i) { |
229 canvas->drawText(&str[i], 1, x, y, paint); | 236 canvas->drawText(&str[i], 1, x, y, paint); |
230 } | 237 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 | 302 |
296 DEF_GM( return SkNEW(FontMgrGM); ) | 303 DEF_GM( return SkNEW(FontMgrGM); ) |
297 DEF_GM( return SkNEW(FontMgrMatchGM); ) | 304 DEF_GM( return SkNEW(FontMgrMatchGM); ) |
298 DEF_GM( return SkNEW(FontMgrBoundsGM(1.0, 0)); ) | 305 DEF_GM( return SkNEW(FontMgrBoundsGM(1.0, 0)); ) |
299 DEF_GM( return SkNEW(FontMgrBoundsGM(0.75, 0)); ) | 306 DEF_GM( return SkNEW(FontMgrBoundsGM(0.75, 0)); ) |
300 DEF_GM( return SkNEW(FontMgrBoundsGM(1.0, -0.25)); ) | 307 DEF_GM( return SkNEW(FontMgrBoundsGM(1.0, -0.25)); ) |
301 | 308 |
302 #ifdef SK_BUILD_FOR_WIN | 309 #ifdef SK_BUILD_FOR_WIN |
303 DEF_GM( return SkNEW_ARGS(FontMgrGM, (SkFontMgr_New_DirectWrite())); ) | 310 DEF_GM( return SkNEW_ARGS(FontMgrGM, (SkFontMgr_New_DirectWrite())); ) |
304 #endif | 311 #endif |
OLD | NEW |