OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 #ifndef SkUtils_DEFINED | 8 #ifndef SkUtils_DEFINED |
9 #define SkUtils_DEFINED | 9 #define SkUtils_DEFINED |
10 | 10 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 or 0 if uni is illegal. | 64 or 0 if uni is illegal. |
65 */ | 65 */ |
66 size_t SkUTF8_FromUnichar(SkUnichar uni, char utf8[] = NULL); | 66 size_t SkUTF8_FromUnichar(SkUnichar uni, char utf8[] = NULL); |
67 | 67 |
68 /////////////////////////////////////////////////////////////////////////////// | 68 /////////////////////////////////////////////////////////////////////////////// |
69 | 69 |
70 #define SkUTF16_IsHighSurrogate(c) (((c) & 0xFC00) == 0xD800) | 70 #define SkUTF16_IsHighSurrogate(c) (((c) & 0xFC00) == 0xD800) |
71 #define SkUTF16_IsLowSurrogate(c) (((c) & 0xFC00) == 0xDC00) | 71 #define SkUTF16_IsLowSurrogate(c) (((c) & 0xFC00) == 0xDC00) |
72 | 72 |
73 int SkUTF16_CountUnichars(const uint16_t utf16[]); | 73 int SkUTF16_CountUnichars(const uint16_t utf16[]); |
74 int SkUTF16_CountUnichars(const uint16_t utf16[], | 74 int SkUTF16_CountUnichars(const uint16_t utf16[], int numberOf16BitValues); |
75 int numberOf16BitValues); | |
76 // returns the current unichar and then moves past it (*p++) | 75 // returns the current unichar and then moves past it (*p++) |
77 SkUnichar SkUTF16_NextUnichar(const uint16_t**); | 76 SkUnichar SkUTF16_NextUnichar(const uint16_t**); |
78 // this guy backs up to the previus unichar value, and returns it (*--p) | 77 // this guy backs up to the previus unichar value, and returns it (*--p) |
79 SkUnichar SkUTF16_PrevUnichar(const uint16_t**); | 78 SkUnichar SkUTF16_PrevUnichar(const uint16_t**); |
80 size_t SkUTF16_FromUnichar(SkUnichar uni, uint16_t utf16[] = NULL); | 79 size_t SkUTF16_FromUnichar(SkUnichar uni, uint16_t utf16[] = NULL); |
81 | 80 |
82 size_t SkUTF16_ToUTF8(const uint16_t utf16[], int numberOf16BitValues, | 81 size_t SkUTF16_ToUTF8(const uint16_t utf16[], int numberOf16BitValues, |
83 char utf8[] = NULL); | 82 char utf8[] = NULL); |
84 | 83 |
85 inline bool SkUnichar_IsVariationSelector(SkUnichar uni) { | 84 inline bool SkUnichar_IsVariationSelector(SkUnichar uni) { |
86 /* The 'true' ranges are: | 85 /* The 'true' ranges are: |
87 * 0x180B <= uni <= 0x180D | 86 * 0x180B <= uni <= 0x180D |
88 * 0xFE00 <= uni <= 0xFE0F | 87 * 0xFE00 <= uni <= 0xFE0F |
89 * 0xE0100 <= uni <= 0xE01EF | 88 * 0xE0100 <= uni <= 0xE01EF |
90 */ | 89 */ |
91 if (uni < 0x180B || uni > 0xE01EF) { | 90 if (uni < 0x180B || uni > 0xE01EF) { |
92 return false; | 91 return false; |
93 } | 92 } |
(...skipping 15 matching lines...) Expand all Loading... |
109 } | 108 } |
110 ~SkAutoTrace() { | 109 ~SkAutoTrace() { |
111 SkDebugf("--- trace: %s Leave\n", fLabel); | 110 SkDebugf("--- trace: %s Leave\n", fLabel); |
112 } | 111 } |
113 private: | 112 private: |
114 const char* fLabel; | 113 const char* fLabel; |
115 }; | 114 }; |
116 #define SkAutoTrace(...) SK_REQUIRE_LOCAL_VAR(SkAutoTrace) | 115 #define SkAutoTrace(...) SK_REQUIRE_LOCAL_VAR(SkAutoTrace) |
117 | 116 |
118 #endif | 117 #endif |
OLD | NEW |