| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "sk_tool_utils.h" | 8 #include "sk_tool_utils.h" |
| 9 #include "sk_tool_utils_flags.h" | 9 #include "sk_tool_utils_flags.h" |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 const char* osName = platform_os_name(); | 25 const char* osName = platform_os_name(); |
| 26 if (!strcmp(osName, "Android") || !strcmp(osName, "Ubuntu")) { | 26 if (!strcmp(osName, "Android") || !strcmp(osName, "Ubuntu")) { |
| 27 return "CBDT"; | 27 return "CBDT"; |
| 28 } | 28 } |
| 29 if (!strncmp(osName, "Mac", 3)) { | 29 if (!strncmp(osName, "Mac", 3)) { |
| 30 return "SBIX"; | 30 return "SBIX"; |
| 31 } | 31 } |
| 32 return ""; | 32 return ""; |
| 33 } | 33 } |
| 34 | 34 |
| 35 SkTypeface* emoji_typeface() { | 35 void emoji_typeface(SkAutoTUnref<SkTypeface>* tf) { |
| 36 if (!strcmp(sk_tool_utils::platform_os_emoji(), "CBDT")) { | 36 if (!strcmp(sk_tool_utils::platform_os_emoji(), "CBDT")) { |
| 37 return GetResourceAsTypeface("/fonts/Funkster.ttf"); | 37 tf->reset(GetResourceAsTypeface("/fonts/Funkster.ttf")); |
| 38 return; |
| 38 } | 39 } |
| 39 if (!strcmp(sk_tool_utils::platform_os_emoji(), "SBIX")) { | 40 if (!strcmp(sk_tool_utils::platform_os_emoji(), "SBIX")) { |
| 40 return SkTypeface::CreateFromName("Apple Color Emoji", SkTypeface::kNorm
al); | 41 tf->reset(SkTypeface::CreateFromName("Apple Color Emoji", SkTypeface::kN
ormal)); |
| 42 return; |
| 41 } | 43 } |
| 42 return NULL; | 44 tf->reset(NULL); |
| 45 return; |
| 43 } | 46 } |
| 44 | 47 |
| 45 const char* emoji_sample_text() { | 48 const char* emoji_sample_text() { |
| 46 if (!strcmp(sk_tool_utils::platform_os_emoji(), "CBDT")) { | 49 if (!strcmp(sk_tool_utils::platform_os_emoji(), "CBDT")) { |
| 47 return "Hamburgefons"; | 50 return "Hamburgefons"; |
| 48 } | 51 } |
| 49 if (!strcmp(sk_tool_utils::platform_os_emoji(), "SBIX")) { | 52 if (!strcmp(sk_tool_utils::platform_os_emoji(), "SBIX")) { |
| 50 return "\xF0\x9F\x92\xB0" "\xF0\x9F\x8F\xA1" "\xF0\x9F\x8E\x85" // 💰🏡🎅 | 53 return "\xF0\x9F\x92\xB0" "\xF0\x9F\x8F\xA1" "\xF0\x9F\x8E\x85" // 💰🏡🎅 |
| 51 "\xF0\x9F\x8D\xAA" "\xF0\x9F\x8D\x95" "\xF0\x9F\x9A\x80" // 🍪🍕🚀 | 54 "\xF0\x9F\x8D\xAA" "\xF0\x9F\x8D\x95" "\xF0\x9F\x9A\x80" // 🍪🍕🚀 |
| 52 "\xF0\x9F\x9A\xBB" "\xF0\x9F\x92\xA9" "\xF0\x9F\x93\xB7" // 🚻💩📷 | 55 "\xF0\x9F\x9A\xBB" "\xF0\x9F\x92\xA9" "\xF0\x9F\x93\xB7" // 🚻💩📷 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 paint.textToGlyphs(text, len, glyphs.begin()); | 162 paint.textToGlyphs(text, len, glyphs.begin()); |
| 160 | 163 |
| 161 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); | 164 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); |
| 162 const SkTextBlobBuilder::RunBuffer& run = builder->allocRun(paint, glyphs.co
unt(), x, y, | 165 const SkTextBlobBuilder::RunBuffer& run = builder->allocRun(paint, glyphs.co
unt(), x, y, |
| 163 NULL); | 166 NULL); |
| 164 memcpy(run.glyphs, glyphs.begin(), glyphs.count() * sizeof(uint16_t)); | 167 memcpy(run.glyphs, glyphs.begin(), glyphs.count() * sizeof(uint16_t)); |
| 165 } | 168 } |
| 166 | 169 |
| 167 | 170 |
| 168 } // namespace sk_tool_utils | 171 } // namespace sk_tool_utils |
| OLD | NEW |