comparison src/video/SDL_draw.h @ 2918:bd518fc76f28

Updated to build on Windows
author Sam Lantinga <slouken@libsdl.org>
date Thu, 25 Dec 2008 05:11:29 +0000
parents e426c4fc9cf7
children 9f2482d6662c
comparison
equal deleted inserted replaced
2917:4cecb110195d 2918:bd518fc76f28
28 */ 28 */
29 29
30 #define DRAW_MUL(_a, _b) (((unsigned)(_a)*(_b))/255) 30 #define DRAW_MUL(_a, _b) (((unsigned)(_a)*(_b))/255)
31 31
32 #define DRAW_FASTSETPIXEL(x, y, type, bpp, color) \ 32 #define DRAW_FASTSETPIXEL(x, y, type, bpp, color) \
33 *(type *)(dst->pixels + y * dst->pitch + x * bpp) = (type) color 33 *(type *)((Uint8 *)dst->pixels + y * dst->pitch + x * bpp) = (type) color
34 34
35 #define DRAW_FASTSETPIXEL1(x, y) DRAW_FASTSETPIXEL(x, y, Uint8, 1, color); 35 #define DRAW_FASTSETPIXEL1(x, y) DRAW_FASTSETPIXEL(x, y, Uint8, 1, color);
36 #define DRAW_FASTSETPIXEL2(x, y) DRAW_FASTSETPIXEL(x, y, Uint16, 2, color); 36 #define DRAW_FASTSETPIXEL2(x, y) DRAW_FASTSETPIXEL(x, y, Uint16, 2, color);
37 #define DRAW_FASTSETPIXEL4(x, y) DRAW_FASTSETPIXEL(x, y, Uint32, 4, color); 37 #define DRAW_FASTSETPIXEL4(x, y) DRAW_FASTSETPIXEL(x, y, Uint32, 4, color);
38 38
72 setpixel; \ 72 setpixel; \
73 } while (0) 73 } while (0)
74 74
75 #define DRAW_SETPIXELXY(x, y, type, bpp, op) \ 75 #define DRAW_SETPIXELXY(x, y, type, bpp, op) \
76 do { \ 76 do { \
77 type *pixel = (type *)(dst->pixels + y * dst->pitch + x * bpp); \ 77 type *pixel = (type *)((Uint8 *)dst->pixels + y * dst->pitch + x * bpp); \
78 op; \ 78 op; \
79 } while (0) 79 } while (0)
80 80
81 /* 81 /*
82 * Define draw operators for RGB555 82 * Define draw operators for RGB555
344 * Define blend fill macro 344 * Define blend fill macro
345 */ 345 */
346 346
347 #define FILLRECT(type, op) \ 347 #define FILLRECT(type, op) \
348 do { \ 348 do { \
349 int w; \
350 int width = dstrect->w; \ 349 int width = dstrect->w; \
351 int height = dstrect->h; \ 350 int height = dstrect->h; \
352 int pitch = (dst->pitch / dst->format->BytesPerPixel); \ 351 int pitch = (dst->pitch / dst->format->BytesPerPixel); \
353 int skip = pitch - width; \ 352 int skip = pitch - width; \
354 type *pixel = (type *)dst->pixels + dstrect->y * pitch + dstrect->x; \ 353 type *pixel = (type *)dst->pixels + dstrect->y * pitch + dstrect->x; \