Added SDL_DrawRect(), SDL_DrawRects(), SDL_BlendRect() and SDL_BlendRects()
Fixed line drawing so when blending a sequence of lines there are no overlapping pixels drawn. --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404344
This commit is contained in:
parent
e4c73114dc
commit
2b04928c0e
6 changed files with 165 additions and 442 deletions
|
@ -283,7 +283,7 @@ do { \
|
|||
|
||||
#define ABS(_x) ((_x) < 0 ? -(_x) : (_x))
|
||||
|
||||
#define BRESENHAM(x1, y1, x2, y2, op) \
|
||||
#define BRESENHAM(x1, y1, x2, y2, op, draw_end) \
|
||||
{ \
|
||||
int i, deltax, deltay, numpixels; \
|
||||
int d, dinc1, dinc2; \
|
||||
|
@ -325,6 +325,9 @@ do { \
|
|||
x = x1; \
|
||||
y = y1; \
|
||||
\
|
||||
if (!draw_end) { \
|
||||
--numpixels; \
|
||||
} \
|
||||
for (i = 0; i < numpixels; ++i) { \
|
||||
op(x, y); \
|
||||
if (d < 0) { \
|
||||
|
@ -338,10 +341,11 @@ do { \
|
|||
} \
|
||||
} \
|
||||
}
|
||||
#define DRAWLINE(x0, y0, x1, y1, op) BRESENHAM(x0, y0, x1, y1, op)
|
||||
#define DRAWLINE BRESENHAM
|
||||
|
||||
/*
|
||||
* Define draw rect macro
|
||||
* (not tested, this level of optimization not needed ... yet?)
|
||||
*/
|
||||
#define DRAWRECT(type, op) \
|
||||
do { \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue