6 #define CLIP_LEFT_EDGE 0x1
7 #define CLIP_RIGHT_EDGE 0x2
8 #define CLIP_BOTTOM_EDGE 0x4
9 #define CLIP_TOP_EDGE 0x8
10 #define CLIP_INSIDE(a) (!a)
11 #define CLIP_REJECT(a,b) ((a) & (b))
12 #define CLIP_ACCEPT(a,b) (!((a) | (b)))
20 if (x < context->view_x)
24 if (y < context->view_y)
35 mask = ((mask >> 1) & 0x5555) | ((mask & 0x5555) << 1);
36 mask = ((mask >> 2) & 0x3333) | ((mask & 0x3333) << 2);
37 mask = ((mask >> 4) & 0x0F0F) | ((mask & 0x0F0F) << 4);
38 mask = ((mask >> 8) & 0x00FF) | ((mask & 0x00FF) << 8);
51 code1 =
encode(context, *x1, *y1);
52 code2 =
encode(context, *x2, *y2);
64 m = (*y2 - *y1) / (
float)(*x2 - *x1);
68 *y1 += (context->
view_x - *x1) * m;
72 *y1 += (context->
view_x + context->
view_w - 1 - *x1) * m;
77 *x1 += (context->
view_y - *y1) / m;
82 *x1 += (context->
view_y + context->
view_h - 1 - *y1) / m;
92 FBCALL void fb_GfxLine(
void *target,
float fx1,
float fy1,
float fx2,
float fy2,
unsigned int color,
int type,
unsigned int style,
int flags)
96 int x, y, len, d, dx, dy, ax, ay, bit = 0x8000;
118 if (
clip_line(context, &x1, &y1, &x2, &y2))
126 bit = 1 << ((y2 - y1) & 0xF);
128 for (y = y1; y <= y2; y++) {
130 context->
put_pixel(context, x1, y, color);
138 bit = 1 << ((x2 - x1) & 0xF);
143 for (x = x1; x <= x2; x++) {
145 context->
put_pixel(context, x, y1, color);
171 context->
put_pixel(context, x, y, color);
188 context->
put_pixel(context, x, y, color);