comparison src/video/SDL_blit.h @ 3976:8582c6a5ca16 SDL-1.2

Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
author Sam Lantinga <slouken@libsdl.org>
date Mon, 25 Jun 2007 00:50:20 +0000
parents d910939febfa
children a1b03ba2fcd0
comparison
equal deleted inserted replaced
3975:e85e65aec22f 3976:8582c6a5ca16
164 } \ 164 } \
165 RGB_FROM_PIXEL(Pixel, fmt, r, g, b); \ 165 RGB_FROM_PIXEL(Pixel, fmt, r, g, b); \
166 } while(0) 166 } while(0)
167 167
168 /* Assemble R-G-B values into a specified pixel format and store them */ 168 /* Assemble R-G-B values into a specified pixel format and store them */
169 #ifdef __NDS__ // FIXME
170 #define PIXEL_FROM_RGB(Pixel, fmt, r, g, b) \
171 { \
172 Pixel = ((r>>fmt->Rloss)<<fmt->Rshift)| \
173 ((g>>fmt->Gloss)<<fmt->Gshift)| \
174 ((b>>fmt->Bloss)<<fmt->Bshift) | (1<<15); \
175 }
176 #else
169 #define PIXEL_FROM_RGB(Pixel, fmt, r, g, b) \ 177 #define PIXEL_FROM_RGB(Pixel, fmt, r, g, b) \
170 { \ 178 { \
171 Pixel = ((r>>fmt->Rloss)<<fmt->Rshift)| \ 179 Pixel = ((r>>fmt->Rloss)<<fmt->Rshift)| \
172 ((g>>fmt->Gloss)<<fmt->Gshift)| \ 180 ((g>>fmt->Gloss)<<fmt->Gshift)| \
173 ((b>>fmt->Bloss)<<fmt->Bshift); \ 181 ((b>>fmt->Bloss)<<fmt->Bshift); \
174 } 182 }
183 #endif // __NDS__ FIXME
175 #define RGB565_FROM_RGB(Pixel, r, g, b) \ 184 #define RGB565_FROM_RGB(Pixel, r, g, b) \
176 { \ 185 { \
177 Pixel = ((r>>3)<<11)|((g>>2)<<5)|(b>>3); \ 186 Pixel = ((r>>3)<<11)|((g>>2)<<5)|(b>>3); \
178 } 187 }
179 #define RGB555_FROM_RGB(Pixel, r, g, b) \ 188 #define RGB555_FROM_RGB(Pixel, r, g, b) \
319 RGBA_FROM_PIXEL(Pixel, fmt, r, g, b, a); \ 328 RGBA_FROM_PIXEL(Pixel, fmt, r, g, b, a); \
320 Pixel &= ~fmt->Amask; \ 329 Pixel &= ~fmt->Amask; \
321 } while(0) 330 } while(0)
322 331
323 /* FIXME: this isn't correct, especially for Alpha (maximum != 255) */ 332 /* FIXME: this isn't correct, especially for Alpha (maximum != 255) */
333 #ifdef __NDS__ // FIXME
334 #define PIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a) \
335 { \
336 Pixel = ((r>>fmt->Rloss)<<fmt->Rshift)| \
337 ((g>>fmt->Gloss)<<fmt->Gshift)| \
338 ((b>>fmt->Bloss)<<fmt->Bshift)| \
339 ((a>>fmt->Aloss)<<fmt->Ashift) | (1<<15); \
340 }
341 #else
324 #define PIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a) \ 342 #define PIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a) \
325 { \ 343 { \
326 Pixel = ((r>>fmt->Rloss)<<fmt->Rshift)| \ 344 Pixel = ((r>>fmt->Rloss)<<fmt->Rshift)| \
327 ((g>>fmt->Gloss)<<fmt->Gshift)| \ 345 ((g>>fmt->Gloss)<<fmt->Gshift)| \
328 ((b>>fmt->Bloss)<<fmt->Bshift)| \ 346 ((b>>fmt->Bloss)<<fmt->Bshift)| \
329 ((a>>fmt->Aloss)<<fmt->Ashift); \ 347 ((a>>fmt->Aloss)<<fmt->Ashift); \
330 } 348 }
349 #endif // __NDS__ FIXME
331 #define ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a) \ 350 #define ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a) \
332 { \ 351 { \
333 switch (bpp) { \ 352 switch (bpp) { \
334 case 2: { \ 353 case 2: { \
335 Uint16 Pixel; \ 354 Uint16 Pixel; \