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 | 7 |
8 | 8 |
9 #ifndef SkPDFUtils_DEFINED | 9 #ifndef SkPDFUtils_DEFINED |
10 #define SkPDFUtils_DEFINED | 10 #define SkPDFUtils_DEFINED |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 inline void WriteUInt16BE(SkDynamicMemoryWStream* wStream, uint16_t value) { | 70 inline void WriteUInt16BE(SkDynamicMemoryWStream* wStream, uint16_t value) { |
71 static const char gHex[] = "0123456789ABCDEF"; | 71 static const char gHex[] = "0123456789ABCDEF"; |
72 char result[4]; | 72 char result[4]; |
73 result[0] = gHex[ value >> 12 ]; | 73 result[0] = gHex[ value >> 12 ]; |
74 result[1] = gHex[0xF & (value >> 8 )]; | 74 result[1] = gHex[0xF & (value >> 8 )]; |
75 result[2] = gHex[0xF & (value >> 4 )]; | 75 result[2] = gHex[0xF & (value >> 4 )]; |
76 result[3] = gHex[0xF & (value )]; | 76 result[3] = gHex[0xF & (value )]; |
77 wStream->write(result, 4); | 77 wStream->write(result, 4); |
78 } | 78 } |
| 79 inline void WriteUInt8(SkDynamicMemoryWStream* wStream, uint8_t value) { |
| 80 static const char gHex[] = "0123456789ABCDEF"; |
| 81 char result[2]; |
| 82 result[0] = gHex[value >> 4 ]; |
| 83 result[1] = gHex[0xF & value]; |
| 84 wStream->write(result, 2); |
| 85 } |
79 | 86 |
80 } // namespace SkPDFUtils | 87 } // namespace SkPDFUtils |
81 | 88 |
82 #endif | 89 #endif |
OLD | NEW |