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 SkTypes_DEFINED | 8 #ifndef SkTypes_DEFINED |
9 #define SkTypes_DEFINED | 9 #define SkTypes_DEFINED |
10 | 10 |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 #define SkToU16(x) ((uint16_t)(x)) | 250 #define SkToU16(x) ((uint16_t)(x)) |
251 #define SkToS32(x) ((int32_t)(x)) | 251 #define SkToS32(x) ((int32_t)(x)) |
252 #define SkToU32(x) ((uint32_t)(x)) | 252 #define SkToU32(x) ((uint32_t)(x)) |
253 #define SkToInt(x) ((int)(x)) | 253 #define SkToInt(x) ((int)(x)) |
254 #define SkToUInt(x) ((unsigned)(x)) | 254 #define SkToUInt(x) ((unsigned)(x)) |
255 #define SkToSizeT(x) ((size_t)(x)) | 255 #define SkToSizeT(x) ((size_t)(x)) |
256 #endif | 256 #endif |
257 | 257 |
258 /** Returns 0 or 1 based on the condition | 258 /** Returns 0 or 1 based on the condition |
259 */ | 259 */ |
260 #if defined(_MSC_VER) | 260 #define SkToBool(cond) ((cond) != 0) |
261 #define SkToBool(cond) (!!(cond)) // MSVC doesn't like a cast. | |
262 #else | |
263 #define SkToBool(cond) static_cast<bool>(cond) | |
264 #endif | |
265 | 261 |
266 #define SK_MaxS16 32767 | 262 #define SK_MaxS16 32767 |
267 #define SK_MinS16 -32767 | 263 #define SK_MinS16 -32767 |
268 #define SK_MaxU16 0xFFFF | 264 #define SK_MaxU16 0xFFFF |
269 #define SK_MinU16 0 | 265 #define SK_MinU16 0 |
270 #define SK_MaxS32 0x7FFFFFFF | 266 #define SK_MaxS32 0x7FFFFFFF |
271 #define SK_MinS32 -SK_MaxS32 | 267 #define SK_MinS32 -SK_MaxS32 |
272 #define SK_MaxU32 0xFFFFFFFF | 268 #define SK_MaxU32 0xFFFFFFFF |
273 #define SK_MinU32 0 | 269 #define SK_MinU32 0 |
274 #define SK_NaN32 (1 << 31) | 270 #define SK_NaN32 (1 << 31) |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 private: | 668 private: |
673 void* fPtr; | 669 void* fPtr; |
674 size_t fSize; // can be larger than the requested size (see kReuse) | 670 size_t fSize; // can be larger than the requested size (see kReuse) |
675 uint32_t fStorage[(kSize + 3) >> 2]; | 671 uint32_t fStorage[(kSize + 3) >> 2]; |
676 }; | 672 }; |
677 // Can't guard the constructor because it's a template class. | 673 // Can't guard the constructor because it's a template class. |
678 | 674 |
679 #endif /* C++ */ | 675 #endif /* C++ */ |
680 | 676 |
681 #endif | 677 #endif |
OLD | NEW |