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 | 9 |
10 #include "Resources.h" | 10 #include "Resources.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 ColorEmojiGM() { | 49 ColorEmojiGM() { |
50 fTypeface = NULL; | 50 fTypeface = NULL; |
51 } | 51 } |
52 | 52 |
53 ~ColorEmojiGM() { | 53 ~ColorEmojiGM() { |
54 SkSafeUnref(fTypeface); | 54 SkSafeUnref(fTypeface); |
55 } | 55 } |
56 protected: | 56 protected: |
57 void onOnceBeforeDraw() SK_OVERRIDE { | 57 void onOnceBeforeDraw() SK_OVERRIDE { |
58 SkString filename = GetResourcePath("/Funkster.ttf"); | 58 SkString filename = GetResourcePath("/Funkster.ttf"); |
59 SkAutoTUnref<SkFILEStream> stream(new SkFILEStream(filename.c_str())); | 59 SkAutoTDelete<SkFILEStream> stream(new SkFILEStream(filename.c_str())); |
60 if (!stream->isValid()) { | 60 if (!stream->isValid()) { |
61 SkDebugf("Could not find Funkster.ttf, please set --resourcePath cor
rectly.\n"); | 61 SkDebugf("Could not find Funkster.ttf, please set --resourcePath cor
rectly.\n"); |
62 return; | 62 return; |
63 } | 63 } |
64 | 64 |
65 fTypeface = SkTypeface::CreateFromStream(stream); | 65 fTypeface = SkTypeface::CreateFromStream(stream.detach()); |
66 } | 66 } |
67 | 67 |
68 SkString onShortName() SK_OVERRIDE { | 68 SkString onShortName() SK_OVERRIDE { |
69 return SkString("coloremoji"); | 69 return SkString("coloremoji"); |
70 } | 70 } |
71 | 71 |
72 SkISize onISize() SK_OVERRIDE { | 72 SkISize onISize() SK_OVERRIDE { |
73 return SkISize::Make(650, 480); | 73 return SkISize::Make(650, 480); |
74 } | 74 } |
75 | 75 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 165 |
166 typedef GM INHERITED; | 166 typedef GM INHERITED; |
167 }; | 167 }; |
168 | 168 |
169 ////////////////////////////////////////////////////////////////////////////// | 169 ////////////////////////////////////////////////////////////////////////////// |
170 | 170 |
171 static GM* MyFactory(void*) { return new ColorEmojiGM; } | 171 static GM* MyFactory(void*) { return new ColorEmojiGM; } |
172 static GMRegistry reg(MyFactory); | 172 static GMRegistry reg(MyFactory); |
173 | 173 |
174 } | 174 } |
OLD | NEW |