include/SDL_pixels.h
changeset 5156 307ccc9c135e
parent 4982 660d3a432102
child 5262 b530ef003506
     1.1 --- a/include/SDL_pixels.h	Wed Feb 02 22:55:12 2011 -0800
     1.2 +++ b/include/SDL_pixels.h	Thu Feb 03 00:19:40 2011 -0800
     1.3 @@ -122,18 +122,26 @@
     1.4  #define SDL_PIXELORDER(X)	(((X) >> 20) & 0x0F)
     1.5  #define SDL_PIXELLAYOUT(X)	(((X) >> 16) & 0x0F)
     1.6  #define SDL_BITSPERPIXEL(X)	(((X) >> 8) & 0xFF)
     1.7 -#define SDL_BYTESPERPIXEL(X)	(((X) >> 0) & 0xFF)
     1.8 +#define SDL_BYTESPERPIXEL(X) \
     1.9 +    (SDL_ISPIXELFORMAT_FOURCC(X) ? \
    1.10 +        ((((X) == SDL_PIXELFORMAT_YV12) || \
    1.11 +          ((X) == SDL_PIXELFORMAT_IYUV) || \
    1.12 +          ((X) == SDL_PIXELFORMAT_YUY2) || \
    1.13 +          ((X) == SDL_PIXELFORMAT_UYVY) || \
    1.14 +          ((X) == SDL_PIXELFORMAT_YVYU)) ? 2 : 1) : (((X) >> 0) & 0xFF))
    1.15  
    1.16  #define SDL_ISPIXELFORMAT_INDEXED(format)   \
    1.17 -    ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \
    1.18 -     (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \
    1.19 -     (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8))
    1.20 +    (!SDL_ISPIXELFORMAT_FOURCC(format) && \
    1.21 +     ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \
    1.22 +      (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \
    1.23 +      (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8)))
    1.24  
    1.25  #define SDL_ISPIXELFORMAT_ALPHA(format)   \
    1.26 -    ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \
    1.27 -     (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \
    1.28 -     (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \
    1.29 -     (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA))
    1.30 +    (!SDL_ISPIXELFORMAT_FOURCC(format) && \
    1.31 +     ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \
    1.32 +      (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \
    1.33 +      (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \
    1.34 +      (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA)))
    1.35  
    1.36  #define SDL_ISPIXELFORMAT_FOURCC(format)    \
    1.37      ((format) && !((format) & 0x80000000))