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 "Resources.h" | 8 #include "Resources.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkStream.h" | 10 #include "SkStream.h" |
11 #include "SkSurface.h" | 11 #include "SkSurface.h" |
12 #include "SkTypeface.h" | 12 #include "SkTypeface.h" |
13 | 13 |
14 class DFTextGM : public skiagm::GM { | 14 class DFTextGM : public skiagm::GM { |
15 public: | 15 public: |
16 DFTextGM() { | 16 DFTextGM() { |
17 this->setBGColor(0xFFFFFFFF); | 17 this->setBGColor(0xFFFFFFFF); |
18 } | 18 } |
19 | 19 |
20 protected: | 20 protected: |
21 void onOnceBeforeDraw() override { | 21 void onOnceBeforeDraw() override { |
22 fEmojiTypeface = sk_tool_utils::emoji_typeface(); | 22 sk_tool_utils::emoji_typeface(&fEmojiTypeface); |
23 fEmojiText = sk_tool_utils::emoji_sample_text(); | 23 fEmojiText = sk_tool_utils::emoji_sample_text(); |
24 } | 24 } |
25 | 25 |
26 SkString onShortName() override { | 26 SkString onShortName() override { |
27 SkString name("dftext"); | 27 SkString name("dftext"); |
28 name.append(sk_tool_utils::platform_os_emoji()); | 28 name.append(sk_tool_utils::platform_os_emoji()); |
29 return name; | 29 return name; |
30 } | 30 } |
31 | 31 |
32 SkISize onISize() override { | 32 SkISize onISize() override { |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 if (surface) { | 203 if (surface) { |
204 SkAutoCanvasRestore acr(inputCanvas, true); | 204 SkAutoCanvasRestore acr(inputCanvas, true); |
205 // since we prepended this matrix already, we blit using identity | 205 // since we prepended this matrix already, we blit using identity |
206 inputCanvas->resetMatrix(); | 206 inputCanvas->resetMatrix(); |
207 inputCanvas->drawImage(surface->makeImageSnapshot().get(), 0, 0, nul
lptr); | 207 inputCanvas->drawImage(surface->makeImageSnapshot().get(), 0, 0, nul
lptr); |
208 } | 208 } |
209 #endif | 209 #endif |
210 } | 210 } |
211 | 211 |
212 private: | 212 private: |
213 sk_sp<SkTypeface> fEmojiTypeface; | 213 SkAutoTUnref<SkTypeface> fEmojiTypeface; |
214 const char* fEmojiText; | 214 const char* fEmojiText; |
215 | 215 |
216 typedef skiagm::GM INHERITED; | 216 typedef skiagm::GM INHERITED; |
217 }; | 217 }; |
218 | 218 |
219 DEF_GM(return new DFTextGM;) | 219 DEF_GM(return new DFTextGM;) |
OLD | NEW |