# HG changeset patch # User Sam Lantinga # Date 1278563769 25200 # Node ID bff93336121eb89c0389bed3c9989f4b383f234e # Parent 2cd7bb613a830fa5a86d410450bbe7948d05ebdd Added SDL_FOURCC() diff -r 2cd7bb613a83 -r bff93336121e include/SDL_pixels.h --- a/include/SDL_pixels.h Wed Jul 07 21:35:44 2010 -0700 +++ b/include/SDL_pixels.h Wed Jul 07 21:36:09 2010 -0700 @@ -112,8 +112,7 @@ SDL_PACKEDLAYOUT_1010102 }; -#define SDL_DEFINE_PIXELFOURCC(A, B, C, D) \ - ((A) | ((B) << 8) | ((C) << 16) | ((D) << 24)) +#define SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D) #define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \ ((1 << 31) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \ diff -r 2cd7bb613a83 -r bff93336121e include/SDL_stdinc.h --- a/include/SDL_stdinc.h Wed Jul 07 21:35:44 2010 -0700 +++ b/include/SDL_stdinc.h Wed Jul 07 21:36:09 2010 -0700 @@ -101,6 +101,13 @@ #endif /*@}*//*Cast operators*/ +/* Define a four character code as a Uint32 */ +#define SDL_FOURCC(A, B, C, D) \ + ((SDL_static_cast(Uint32, SDL_static_cast(Uint8, (A))) << 0) | \ + (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (B))) << 8) | \ + (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (C))) << 16) | \ + (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (D))) << 24)) + /** * \name Basic data types */