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 |
11 #include "SkBitmap.h" | 11 #include "SkBitmap.h" |
12 #include "SkCanvas.h" | 12 #include "SkCanvas.h" |
13 #include "SkCommonFlags.h" | 13 #include "SkCommonFlags.h" |
14 #include "SkShader.h" | 14 #include "SkShader.h" |
15 #include "SkTestScalerContext.h" | 15 #include "SkTestScalerContext.h" |
16 #include "SkTextBlob.h" | 16 #include "SkTextBlob.h" |
17 | 17 |
18 DEFINE_bool(portableFonts, false, "Use portable fonts"); | 18 DEFINE_bool(portableFonts, false, "Use portable fonts"); |
19 DEFINE_bool(resourceFonts, false, "Use resource fonts"); | 19 DEFINE_bool(resourceFonts, false, "Use resource fonts"); |
20 | 20 |
21 namespace sk_tool_utils { | 21 namespace sk_tool_utils { |
22 | 22 |
| 23 const char* platform_os_emoji() { |
| 24 const char* osName = platform_os_name(); |
| 25 if (!strcmp(osName, "Android") || !strcmp(osName, "Unbuntu")) { |
| 26 return "CBDT"; |
| 27 } |
| 28 if (!strncmp(osName, "Mac", 3)) { |
| 29 return "SBIX"; |
| 30 } |
| 31 return ""; |
| 32 } |
| 33 |
23 const char* platform_os_name() { | 34 const char* platform_os_name() { |
24 for (int index = 0; index < FLAGS_key.count(); index += 2) { | 35 for (int index = 0; index < FLAGS_key.count(); index += 2) { |
25 if (!strcmp("os", FLAGS_key[index])) { | 36 if (!strcmp("os", FLAGS_key[index])) { |
26 return FLAGS_key[index + 1]; | 37 return FLAGS_key[index + 1]; |
27 } | 38 } |
28 } | 39 } |
29 // when running SampleApp or dm without a --key pair, omit the platform name | 40 // when running SampleApp or dm without a --key pair, omit the platform name |
30 return ""; | 41 return ""; |
31 } | 42 } |
32 | 43 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 paint.textToGlyphs(text, len, glyphs.begin()); | 134 paint.textToGlyphs(text, len, glyphs.begin()); |
124 | 135 |
125 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); | 136 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); |
126 const SkTextBlobBuilder::RunBuffer& run = builder->allocRun(paint, glyphs.co
unt(), x, y, | 137 const SkTextBlobBuilder::RunBuffer& run = builder->allocRun(paint, glyphs.co
unt(), x, y, |
127 NULL); | 138 NULL); |
128 memcpy(run.glyphs, glyphs.begin(), glyphs.count() * sizeof(uint16_t)); | 139 memcpy(run.glyphs, glyphs.begin(), glyphs.count() * sizeof(uint16_t)); |
129 } | 140 } |
130 | 141 |
131 | 142 |
132 } // namespace sk_tool_utils | 143 } // namespace sk_tool_utils |
OLD | NEW |