1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/src/core/SkDebug.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,59 @@ 1.4 + 1.5 +/* 1.6 + * Copyright 2006 The Android Open Source Project 1.7 + * 1.8 + * Use of this source code is governed by a BSD-style license that can be 1.9 + * found in the LICENSE file. 1.10 + */ 1.11 + 1.12 + 1.13 +#include "SkTypes.h" 1.14 + 1.15 +#ifdef SK_DEBUG 1.16 + 1.17 +int8_t SkToS8(intmax_t x) { 1.18 + SkASSERT((int8_t)x == x); 1.19 + return (int8_t)x; 1.20 +} 1.21 + 1.22 +uint8_t SkToU8(uintmax_t x) { 1.23 + SkASSERT((uint8_t)x == x); 1.24 + return (uint8_t)x; 1.25 +} 1.26 + 1.27 +int16_t SkToS16(intmax_t x) { 1.28 + SkASSERT((int16_t)x == x); 1.29 + return (int16_t)x; 1.30 +} 1.31 + 1.32 +uint16_t SkToU16(uintmax_t x) { 1.33 + SkASSERT((uint16_t)x == x); 1.34 + return (uint16_t)x; 1.35 +} 1.36 + 1.37 +int32_t SkToS32(intmax_t x) { 1.38 + SkASSERT((int32_t)x == x); 1.39 + return (int32_t)x; 1.40 +} 1.41 + 1.42 +uint32_t SkToU32(uintmax_t x) { 1.43 + SkASSERT((uint32_t)x == x); 1.44 + return (uint32_t)x; 1.45 +} 1.46 + 1.47 +int SkToInt(intmax_t x) { 1.48 + SkASSERT((int)x == x); 1.49 + return (int)x; 1.50 +} 1.51 + 1.52 +unsigned SkToUInt(uintmax_t x) { 1.53 + SkASSERT((unsigned)x == x); 1.54 + return (unsigned)x; 1.55 +} 1.56 + 1.57 +size_t SkToSizeT(uintmax_t x) { 1.58 + SkASSERT((size_t)x == x); 1.59 + return (size_t)x; 1.60 +} 1.61 + 1.62 +#endif