Mercurial > sdl-ios-xcode
diff src/video/SDL_draw.h @ 3593:b931bcfd94a0
In the process of adding rectangle drawing
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 18 Dec 2009 07:03:09 +0000 |
parents | 0267b8b1595c |
children | c8bed77b0386 |
line wrap: on
line diff
--- a/src/video/SDL_draw.h Thu Dec 17 07:47:03 2009 +0000 +++ b/src/video/SDL_draw.h Fri Dec 18 07:03:09 2009 +0000 @@ -341,7 +341,44 @@ #define DRAWLINE(x0, y0, x1, y1, op) BRESENHAM(x0, y0, x1, y1, op) /* - * Define blend fill macro + * Define draw rect macro + */ +#define DRAWRECT(type, op) \ +do { \ + int width = rect->w; \ + int height = rect->h; \ + int pitch = (dst->pitch / dst->format->BytesPerPixel); \ + int skip = pitch - width; \ + type *pixel; \ + pixel = (type *)dst->pixels + rect->y * pitch + rect->x; \ + { int n = (width+3)/4; \ + switch (width & 3) { \ + case 0: do { op; pixel++; \ + case 3: op; pixel++; \ + case 2: op; pixel++; \ + case 1: op; pixel++; \ + } while ( --n > 0 ); \ + } \ + } \ + pixel += skip; \ + width -= 1; \ + height -= 2; \ + while (height--) { \ + op; pixel += width; op; pixel += skip; \ + } \ + { int n = (width+3)/4; \ + switch (width & 3) { \ + case 0: do { op; pixel++; \ + case 3: op; pixel++; \ + case 2: op; pixel++; \ + case 1: op; pixel++; \ + } while ( --n > 0 ); \ + } \ + } \ +} while (0) + +/* + * Define fill rect macro */ #define FILLRECT(type, op) \ @@ -365,8 +402,4 @@ } \ } while (0) -/* - * Define blend line macro - */ - /* vi: set ts=4 sw=4 expandtab: */