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 "SkGraphics.h" | 10 #include "SkGraphics.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 fTypefaces[0] = NULL; | 24 fTypefaces[0] = NULL; |
25 fTypefaces[1] = NULL; | 25 fTypefaces[1] = NULL; |
26 } | 26 } |
27 | 27 |
28 virtual ~FontCacheGM() { | 28 virtual ~FontCacheGM() { |
29 SkSafeUnref(fTypefaces[0]); | 29 SkSafeUnref(fTypefaces[0]); |
30 SkSafeUnref(fTypefaces[1]); | 30 SkSafeUnref(fTypefaces[1]); |
31 } | 31 } |
32 | 32 |
33 protected: | 33 protected: |
34 SkString onShortName() SK_OVERRIDE { | 34 SkString onShortName() override { |
35 return SkString("fontcache"); | 35 return SkString("fontcache"); |
36 } | 36 } |
37 | 37 |
38 SkISize onISize() SK_OVERRIDE { | 38 SkISize onISize() override { |
39 return SkISize::Make(1280, 640); | 39 return SkISize::Make(1280, 640); |
40 } | 40 } |
41 | 41 |
42 void onOnceBeforeDraw() SK_OVERRIDE { | 42 void onOnceBeforeDraw() override { |
43 fTypefaces[0] = sk_tool_utils::create_portable_typeface("serif", SkTypef
ace::kItalic); | 43 fTypefaces[0] = sk_tool_utils::create_portable_typeface("serif", SkTypef
ace::kItalic); |
44 fTypefaces[1] = sk_tool_utils::create_portable_typeface("sans-serif", Sk
Typeface::kItalic); | 44 fTypefaces[1] = sk_tool_utils::create_portable_typeface("sans-serif", Sk
Typeface::kItalic); |
45 } | 45 } |
46 | 46 |
47 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 47 void onDraw(SkCanvas* canvas) override { |
48 SkPaint paint; | 48 SkPaint paint; |
49 paint.setAntiAlias(true); | 49 paint.setAntiAlias(true); |
50 paint.setLCDRenderText(true); | 50 paint.setLCDRenderText(true); |
51 paint.setSubpixelText(true); | 51 paint.setSubpixelText(true); |
52 paint.setTypeface(fTypefaces[0]); | 52 paint.setTypeface(fTypefaces[0]); |
53 paint.setTextSize(192); | 53 paint.setTextSize(192); |
54 | 54 |
55 // Make sure the nul character does not cause problems. | 55 // Make sure the nul character does not cause problems. |
56 paint.measureText("\0", 1); | 56 paint.measureText("\0", 1); |
57 | 57 |
(...skipping 19 matching lines...) Expand all Loading... |
77 | 77 |
78 private: | 78 private: |
79 SkTypeface* fTypefaces[2]; | 79 SkTypeface* fTypefaces[2]; |
80 typedef GM INHERITED; | 80 typedef GM INHERITED; |
81 }; | 81 }; |
82 | 82 |
83 | 83 |
84 ////////////////////////////////////////////////////////////////////////////// | 84 ////////////////////////////////////////////////////////////////////////////// |
85 | 85 |
86 DEF_GM( return SkNEW(FontCacheGM); ) | 86 DEF_GM( return SkNEW(FontCacheGM); ) |
OLD | NEW |