include/core/SkTypes.h File Reference
#include "SkPreConfig.h"
#include "SkUserConfig.h"
#include "SkPostConfig.h"
#include <stdint.h>
#include <stdio.h>
Go to the source code of this file.
Defines |
#define | SK_INIT_TO_AVOID_WARNING = 0 |
#define | SkASSERT(cond) SK_DEBUGBREAK(cond) |
#define | SkDEBUGCODE(code) code |
#define | SkDECLAREPARAM(type, var) , type var |
#define | SkPARAM(var) , var |
#define | SkDEBUGF(args) SkDebugf args |
#define | SkAssertResult(cond) SkASSERT(cond) |
#define | SkToBool(cond) ((cond) != 0) |
#define | SK_MaxS16 32767 |
#define | SK_MinS16 -32767 |
#define | SK_MaxU16 0xFFFF |
#define | SK_MinU16 0 |
#define | SK_MaxS32 0x7FFFFFFF |
#define | SK_MinS32 0x80000001 |
#define | SK_MaxU32 0xFFFFFFFF |
#define | SK_MinU32 0 |
#define | SK_NaN32 0x80000000 |
#define | SK_OFFSETOF(type, field) ((char*)&(((type*)1)->field) - (char*)1) |
#define | SK_ARRAY_COUNT(array) (sizeof(array) / sizeof(array[0])) |
#define | SkAlign2(x) (((x) + 1) >> 1 << 1) |
#define | SkAlign4(x) (((x) + 3) >> 2 << 2) |
#define | SkSetFourByteTag(a, b, c, d) (((a) << 24) | ((b) << 16) | ((c) << 8) | (d)) |
#define | SK_MSec1 1000 |
#define | SK_MSecMax 0x7FFFFFFF |
#define | SkMSec_LT(a, b) ((int32_t)(a) - (int32_t)(b) < 0) |
#define | SkMSec_LE(a, b) ((int32_t)(a) - (int32_t)(b) <= 0) |
Typedefs |
typedef int | S8CPU |
typedef int | S16CPU |
typedef unsigned | U8CPU |
typedef unsigned | U16CPU |
typedef int | SkBool |
typedef uint8_t | SkBool8 |
typedef uint32_t | SkFourByteTag |
typedef int32_t | SkUnichar |
typedef uint32_t | SkMSec |
Enumerations |
enum | { SK_MALLOC_TEMP = 0x01,
SK_MALLOC_THROW = 0x02
} |
Functions |
void | sk_out_of_memory (void) |
void | sk_throw (void) |
void * | sk_malloc_flags (size_t size, unsigned flags) |
void * | sk_malloc_throw (size_t size) |
void * | sk_realloc_throw (void *buffer, size_t size) |
void | sk_free (void *) |
void | SkDebugf (const char format[],...) |
int8_t | SkToS8 (long) |
uint8_t | SkToU8 (size_t) |
int16_t | SkToS16 (long) |
uint16_t | SkToU16 (size_t) |
int32_t | SkToS32 (long) |
uint32_t | SkToU32 (size_t) |
Detailed Description
Definition in file SkTypes.h.
Define Documentation
#define SK_ARRAY_COUNT |
( |
array |
|
) |
(sizeof(array) / sizeof(array[0])) |
Returns the number of entries in an array (not a pointer)
Definition at line 158 of file SkTypes.h.
#define SK_INIT_TO_AVOID_WARNING = 0 |
#define SK_MaxS32 0x7FFFFFFF |
#define SK_MaxU32 0xFFFFFFFF |
#define SK_MinS32 0x80000001 |
1 second measured in milliseconds
Definition at line 178 of file SkTypes.h.
#define SK_MSecMax 0x7FFFFFFF |
maximum representable milliseconds
Definition at line 181 of file SkTypes.h.
#define SK_NaN32 0x80000000 |
#define SK_OFFSETOF |
( |
type, |
|
|
field |
|
) |
((char*)&(((type*)1)->field) - (char*)1) |
#define SkAlign2 |
( |
x |
|
) |
(((x) + 1) >> 1 << 1) |
Returns x rounded up to a multiple of 2
Definition at line 162 of file SkTypes.h.
#define SkAlign4 |
( |
x |
|
) |
(((x) + 3) >> 2 << 2) |
Returns x rounded up to a multiple of 4
Definition at line 165 of file SkTypes.h.
#define SkASSERT |
( |
cond |
|
) |
SK_DEBUGBREAK(cond) |
#define SkAssertResult |
( |
cond |
|
) |
SkASSERT(cond) |
#define SkDEBUGCODE |
( |
code |
|
) |
code |
#define SkDEBUGF |
( |
args |
|
) |
SkDebugf args |
#define SkDECLAREPARAM |
( |
type, |
|
|
var |
|
) |
, type var |
#define SkMSec_LE |
( |
a, |
|
|
b |
|
) |
((int32_t)(a) - (int32_t)(b) <= 0) |
Returns a <= b for milliseconds, correctly handling wrap-around from 0xFFFFFFFF to 0
Definition at line 187 of file SkTypes.h.
#define SkMSec_LT |
( |
a, |
|
|
b |
|
) |
((int32_t)(a) - (int32_t)(b) < 0) |
Returns a < b for milliseconds, correctly handling wrap-around from 0xFFFFFFFF to 0
Definition at line 184 of file SkTypes.h.
#define SkPARAM |
( |
var |
|
) |
, var |
#define SkSetFourByteTag |
( |
a, |
|
|
b, |
|
|
c, |
|
|
d |
|
) |
(((a) << 24) | ((b) << 16) | ((c) << 8) | (d)) |
#define SkToBool |
( |
cond |
|
) |
((cond) != 0) |
Returns 0 or 1 based on the condition
Definition at line 140 of file SkTypes.h.
Typedef Documentation
Fast type for unsigned 8 bits. Use for parameter passing and local variables, not for storage
Definition at line 107 of file SkTypes.h.
Fast type for signed 8 bits. Use for parameter passing and local variables, not for storage
Definition at line 104 of file SkTypes.h.
Meant to be faster than bool (doesn't promise to be 0 or 1, just 0 or non-zero
Definition at line 117 of file SkTypes.h.
Meant to be a small version of bool, for storage purposes. Will be 0 or 1
Definition at line 120 of file SkTypes.h.
32 bit value to hold a millisecond count
Definition at line 175 of file SkTypes.h.
32 bit integer to hold a unicode value
Definition at line 172 of file SkTypes.h.
Fast type for unsigned 16 bits. Use for parameter passing and local variables, not for storage
Definition at line 113 of file SkTypes.h.
Fast type for signed 16 bits. Use for parameter passing and local variables, not for storage
Definition at line 110 of file SkTypes.h.
Enumeration Type Documentation
- Enumerator:
SK_MALLOC_TEMP |
hint to sk_malloc that the requested memory will be freed in the scope of the stack frame
|
SK_MALLOC_THROW |
instructs sk_malloc to call sk_throw if the memory cannot be allocated.
|
Definition at line 47 of file SkTypes.h.
Function Documentation
Free memory returned by sk_malloc(). It is safe to pass null.
void* sk_malloc_flags |
( |
size_t |
size, |
|
|
unsigned |
flags | |
|
) |
| | |
Return a block of memory (at least 4-byte aligned) of at least the specified size. If the requested memory cannot be returned, either return null (if SK_MALLOC_TEMP bit is clear) or call sk_throw() (if SK_MALLOC_TEMP bit is set). To free the memory, call sk_free().
void* sk_malloc_throw |
( |
size_t |
size |
) |
|
Same as sk_malloc(), but hard coded to pass SK_MALLOC_THROW as the flag
void sk_out_of_memory |
( |
void |
|
) |
|
Called internally if we run out of memory. The platform implementation must not return, but should either throw an exception or otherwise exit.
void* sk_realloc_throw |
( |
void * |
buffer, |
|
|
size_t |
size | |
|
) |
| | |
Same as standard realloc(), but this one never returns null on failure. It will throw an exception if it fails.
Called internally if we hit an unrecoverable error. The platform implementation must not return, but should either throw an exception or otherwise exit.
void SkDebugf |
( |
const char |
format[], |
|
|
|
... | |
|
) |
| | |
uint16_t SkToU16 |
( |
size_t |
|
) |
|
uint32_t SkToU32 |
( |
size_t |
|
) |
|
uint8_t SkToU8 |
( |
size_t |
|
) |
|