Mercurial > sdl-ios-xcode
comparison include/SDL_pixels.h @ 5159:307ccc9c135e
Made it possible to create a texture of any format, even if not supported by the renderer.
This allows me to reduce the set of formats supported by the renderers to the most optimal set, for a nice speed boost.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 03 Feb 2011 00:19:40 -0800 |
parents | 660d3a432102 |
children | b530ef003506 |
comparison
equal
deleted
inserted
replaced
5158:f3ebd1950442 | 5159:307ccc9c135e |
---|---|
120 | 120 |
121 #define SDL_PIXELTYPE(X) (((X) >> 24) & 0x0F) | 121 #define SDL_PIXELTYPE(X) (((X) >> 24) & 0x0F) |
122 #define SDL_PIXELORDER(X) (((X) >> 20) & 0x0F) | 122 #define SDL_PIXELORDER(X) (((X) >> 20) & 0x0F) |
123 #define SDL_PIXELLAYOUT(X) (((X) >> 16) & 0x0F) | 123 #define SDL_PIXELLAYOUT(X) (((X) >> 16) & 0x0F) |
124 #define SDL_BITSPERPIXEL(X) (((X) >> 8) & 0xFF) | 124 #define SDL_BITSPERPIXEL(X) (((X) >> 8) & 0xFF) |
125 #define SDL_BYTESPERPIXEL(X) (((X) >> 0) & 0xFF) | 125 #define SDL_BYTESPERPIXEL(X) \ |
126 (SDL_ISPIXELFORMAT_FOURCC(X) ? \ | |
127 ((((X) == SDL_PIXELFORMAT_YV12) || \ | |
128 ((X) == SDL_PIXELFORMAT_IYUV) || \ | |
129 ((X) == SDL_PIXELFORMAT_YUY2) || \ | |
130 ((X) == SDL_PIXELFORMAT_UYVY) || \ | |
131 ((X) == SDL_PIXELFORMAT_YVYU)) ? 2 : 1) : (((X) >> 0) & 0xFF)) | |
126 | 132 |
127 #define SDL_ISPIXELFORMAT_INDEXED(format) \ | 133 #define SDL_ISPIXELFORMAT_INDEXED(format) \ |
128 ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \ | 134 (!SDL_ISPIXELFORMAT_FOURCC(format) && \ |
129 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \ | 135 ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \ |
130 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8)) | 136 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \ |
137 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8))) | |
131 | 138 |
132 #define SDL_ISPIXELFORMAT_ALPHA(format) \ | 139 #define SDL_ISPIXELFORMAT_ALPHA(format) \ |
133 ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \ | 140 (!SDL_ISPIXELFORMAT_FOURCC(format) && \ |
134 (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \ | 141 ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \ |
135 (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \ | 142 (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \ |
136 (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA)) | 143 (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \ |
144 (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA))) | |
137 | 145 |
138 #define SDL_ISPIXELFORMAT_FOURCC(format) \ | 146 #define SDL_ISPIXELFORMAT_FOURCC(format) \ |
139 ((format) && !((format) & 0x80000000)) | 147 ((format) && !((format) & 0x80000000)) |
140 | 148 |
141 /* Note: If you modify this list, update SDL_GetPixelFormatName() */ | 149 /* Note: If you modify this list, update SDL_GetPixelFormatName() */ |