include/core/SkTypes.h File Reference

#include "SkPreConfig.h"
#include "SkUserConfig.h"
#include "SkPostConfig.h"
#include <stdint.h>
#include <stdio.h>
Include dependency graph for SkTypes.h:
This graph shows which files directly or indirectly include this file:

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

Definition at line 75 of file SkTypes.h.

#define SK_MaxS16   32767

Definition at line 142 of file SkTypes.h.

#define SK_MaxS32   0x7FFFFFFF

Definition at line 146 of file SkTypes.h.

#define SK_MaxU16   0xFFFF

Definition at line 144 of file SkTypes.h.

#define SK_MaxU32   0xFFFFFFFF

Definition at line 148 of file SkTypes.h.

#define SK_MinS16   -32767

Definition at line 143 of file SkTypes.h.

#define SK_MinS32   0x80000001

Definition at line 147 of file SkTypes.h.

#define SK_MinU16   0

Definition at line 145 of file SkTypes.h.

#define SK_MinU32   0

Definition at line 149 of file SkTypes.h.

#define SK_MSec1   1000

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

Definition at line 150 of file SkTypes.h.

#define SK_OFFSETOF ( type,
field   )     ((char*)&(((type*)1)->field) - (char*)1)

Definition at line 153 of file SkTypes.h.

#define SkAlign2 (  )     (((x) + 1) >> 1 << 1)

Returns x rounded up to a multiple of 2

Definition at line 162 of file SkTypes.h.

#define SkAlign4 (  )     (((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)

Definition at line 82 of file SkTypes.h.

#define SkAssertResult ( cond   )     SkASSERT(cond)

Definition at line 88 of file SkTypes.h.

#define SkDEBUGCODE ( code   )     code

Definition at line 83 of file SkTypes.h.

#define SkDEBUGF ( args   )     SkDebugf args

Definition at line 87 of file SkTypes.h.

#define SkDECLAREPARAM ( type,
var   )     , type var

Definition at line 84 of file SkTypes.h.

#define SkMSec_LE ( a,
 )     ((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,
 )     ((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

Definition at line 85 of file SkTypes.h.

#define SkSetFourByteTag ( a,
b,
c,
 )     (((a) << 24) | ((b) << 16) | ((c) << 8) | (d))

Definition at line 168 of file SkTypes.h.

#define SkToBool ( cond   )     ((cond) != 0)

Returns 0 or 1 based on the condition

Definition at line 140 of file SkTypes.h.


Typedef Documentation

typedef int S16CPU

Fast type for unsigned 8 bits. Use for parameter passing and local variables, not for storage

Definition at line 107 of file SkTypes.h.

typedef int S8CPU

Fast type for signed 8 bits. Use for parameter passing and local variables, not for storage

Definition at line 104 of file SkTypes.h.

typedef int SkBool

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.

typedef uint8_t SkBool8

Meant to be a small version of bool, for storage purposes. Will be 0 or 1

Definition at line 120 of file SkTypes.h.

typedef uint32_t SkFourByteTag

Definition at line 167 of file SkTypes.h.

typedef uint32_t SkMSec

32 bit value to hold a millisecond count

Definition at line 175 of file SkTypes.h.

typedef int32_t SkUnichar

32 bit integer to hold a unicode value

Definition at line 172 of file SkTypes.h.

typedef unsigned U16CPU

Fast type for unsigned 16 bits. Use for parameter passing and local variables, not for storage

Definition at line 113 of file SkTypes.h.

typedef unsigned U8CPU

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

anonymous enum
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

void sk_free ( void *   ) 

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.

void sk_throw ( void   ) 

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[],
  ... 
)
int16_t SkToS16 ( long   ) 
int32_t SkToS32 ( long   ) 
int8_t SkToS8 ( long   ) 
uint16_t SkToU16 ( size_t   ) 
uint32_t SkToU32 ( size_t   ) 
uint8_t SkToU8 ( size_t   ) 

Generated on Tue Oct 20 11:03:41 2009 for Skia by  doxygen 1.6.1