Added SDL_FOURCC()
authorSam Lantinga <slouken@libsdl.org>
Wed, 07 Jul 2010 21:36:09 -0700
changeset 4492bff93336121e
parent 4491 2cd7bb613a83
child 4493 f0b7c8d169f5
Added SDL_FOURCC()
include/SDL_pixels.h
include/SDL_stdinc.h
     1.1 --- a/include/SDL_pixels.h	Wed Jul 07 21:35:44 2010 -0700
     1.2 +++ b/include/SDL_pixels.h	Wed Jul 07 21:36:09 2010 -0700
     1.3 @@ -112,8 +112,7 @@
     1.4      SDL_PACKEDLAYOUT_1010102
     1.5  };
     1.6  
     1.7 -#define SDL_DEFINE_PIXELFOURCC(A, B, C, D) \
     1.8 -    ((A) | ((B) << 8) | ((C) << 16) | ((D) << 24))
     1.9 +#define SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D)
    1.10  
    1.11  #define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \
    1.12      ((1 << 31) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \
     2.1 --- a/include/SDL_stdinc.h	Wed Jul 07 21:35:44 2010 -0700
     2.2 +++ b/include/SDL_stdinc.h	Wed Jul 07 21:36:09 2010 -0700
     2.3 @@ -101,6 +101,13 @@
     2.4  #endif
     2.5  /*@}*//*Cast operators*/
     2.6  
     2.7 +/* Define a four character code as a Uint32 */
     2.8 +#define SDL_FOURCC(A, B, C, D) \
     2.9 +    ((SDL_static_cast(Uint32, SDL_static_cast(Uint8, (A))) << 0) | \
    2.10 +     (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (B))) << 8) | \
    2.11 +     (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (C))) << 16) | \
    2.12 +     (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (D))) << 24))
    2.13 +
    2.14  /**
    2.15   *  \name Basic data types
    2.16   */