1 | /* |
2 | * Copyright 2006 The Android Open Source Project |
3 | * |
4 | * Use of this source code is governed by a BSD-style license that can be |
5 | * found in the LICENSE file. |
6 | */ |
7 | |
8 | #include "src/core/SkUtils.h" |
9 | |
10 | template <typename T> |
11 | static SkUnichar next(const T** srcPtr, unsigned N, SkUnichar (*fn)(const T**, const T*)) { |
12 | SkASSERT(srcPtr); |
13 | const T* ptr = *srcPtr; |
14 | SkUnichar c = fn(&ptr, ptr + N); |
15 | if (c == -1) { |
16 | SkASSERT(false); |
17 | ++(*srcPtr); |
18 | return 0xFFFD; // REPLACEMENT CHARACTER |
19 | } |
20 | *srcPtr = ptr; |
21 | return c; |
22 | } |
23 | SkUnichar SkUTF8_NextUnichar(const char** p) { |
24 | return next<char>(p, SkUTF::kMaxBytesInUTF8Sequence, SkUTF::NextUTF8); |
25 | } |
26 | SkUnichar SkUTF16_NextUnichar(const uint16_t** p) { |
27 | return next<uint16_t>(p, 2, SkUTF::NextUTF16); |
28 | } |
29 | |
30 | /////////////////////////////////////////////////////////////////////////////// |
31 | |
32 | const char SkHexadecimalDigits::gUpper[16] = |
33 | { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; |
34 | const char SkHexadecimalDigits::gLower[16] = |
35 | { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; |
36 | |