OLD | NEW |
| 1 |
1 /* | 2 /* |
2 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
3 * | 4 * |
4 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 6 * found in the LICENSE file. |
6 */ | 7 */ |
7 | 8 |
| 9 |
8 #include "SkTypes.h" | 10 #include "SkTypes.h" |
9 | 11 |
| 12 #ifdef SK_DEBUG |
| 13 |
| 14 int8_t SkToS8(intmax_t x) { |
| 15 SkASSERT((int8_t)x == x); |
| 16 return (int8_t)x; |
| 17 } |
| 18 |
| 19 uint8_t SkToU8(uintmax_t x) { |
| 20 SkASSERT((uint8_t)x == x); |
| 21 return (uint8_t)x; |
| 22 } |
| 23 |
| 24 int16_t SkToS16(intmax_t x) { |
| 25 SkASSERT((int16_t)x == x); |
| 26 return (int16_t)x; |
| 27 } |
| 28 |
| 29 uint16_t SkToU16(uintmax_t x) { |
| 30 SkASSERT((uint16_t)x == x); |
| 31 return (uint16_t)x; |
| 32 } |
| 33 |
| 34 int32_t SkToS32(intmax_t x) { |
| 35 SkASSERT((int32_t)x == x); |
| 36 return (int32_t)x; |
| 37 } |
| 38 |
| 39 uint32_t SkToU32(uintmax_t x) { |
| 40 SkASSERT((uint32_t)x == x); |
| 41 return (uint32_t)x; |
| 42 } |
| 43 |
| 44 int SkToInt(intmax_t x) { |
| 45 SkASSERT((int)x == x); |
| 46 return (int)x; |
| 47 } |
| 48 |
| 49 unsigned SkToUInt(uintmax_t x) { |
| 50 SkASSERT((unsigned)x == x); |
| 51 return (unsigned)x; |
| 52 } |
| 53 |
| 54 size_t SkToSizeT(uintmax_t x) { |
| 55 SkASSERT((size_t)x == x); |
| 56 return (size_t)x; |
| 57 } |
| 58 |
| 59 #endif |
| 60 |
10 #if defined(GOOGLE3) | 61 #if defined(GOOGLE3) |
11 void SkDebugfForDumpStackTrace(const char* data, void* unused) { | 62 void SkDebugfForDumpStackTrace(const char* data, void* unused) { |
12 SkDebugf("%s", data); | 63 SkDebugf("%s", data); |
13 } | 64 } |
14 #endif | 65 #endif |
OLD | NEW |