1 
2 
3 #define uchar unsigned char
4 #define swap(x, y) { int temp = x; x = y; y = temp; }
5 #define swapb(x, y) { uchar temp = x; x = y; y = temp; }
6 #define max(x, y) ((x > y) ? x : y)
7 #define min(x, y) ((x > y) ? y : x)
8 #define outside(x, y) (x < __clipx1 || x > __clipx2 || y < __clipy1 \
9 	|| y > __clipy2)
10 #define x_outside(x) (x < __clipx1 || x > __clipx2)
11 #define y_outside(y) (y < __clipy1 || y > __clipy2)
12 #define clipxleft(x) if (x < __clipx1) x = __clipx1;
13 #define clipxright(x) if (x > __clipx2) x = __clipx2;
14 #define clipytop(y) if (y < __clipy1) y = __clipy1;
15 #define clipybottom(y) if (y > __clipy2) y = __clipy2;
16 
17 
18 #define setpixel (*(__currentcontext.ff.driver_setpixel_func))
19 #define getpixel (*(__currentcontext.ff.driver_getpixel_func))
20 #define hline (*(__currentcontext.ff.driver_hline_func))
21 #define fillbox (*(__currentcontext.ff.driver_fillbox_func))
22 #define putbox (*(__currentcontext.ff.driver_putbox_func))
23 #define getbox (*(__currentcontext.ff.driver_getbox_func))
24 #define putboxmask (*(__currentcontext.ff.driver_putboxmask_func))
25 #define putboxpart (*(__currentcontext.ff.driver_putboxpart_func))
26 #define getboxpart (*(__currentcontext.ff.driver_getboxpart_func))
27 #define copybox (*(__currentcontext.ff.driver_copybox_func))
28 
29 #define TEXT_TABSIZE 8
30 
31 #ifdef DLL_CONTEXT_SHADOW
32 
33 /* Library uses internal currentcontext for faster DLL library. */
34 
35 #undef BYTESPERPIXEL
36 #undef BYTEWIDTH
37 #undef WIDTH
38 #undef HEIGHT
39 #undef VBUF
40 #undef MODETYPE
41 #undef MODEFLAGS
42 #undef BITSPERPIXEL
43 #undef COLORS
44 #undef __clip
45 #undef __clipx1
46 #undef __clipy1
47 #undef __clipx2
48 #undef __clipy2
49 
50 extern GraphicsContext __currentcontext;
51 
52 #define BYTESPERPIXEL (__currentcontext.bytesperpixel)
53 #define BYTEWIDTH (__currentcontext.bytewidth)
54 #define WIDTH (__currentcontext.width)
55 #define HEIGHT (__currentcontext.height)
56 #define VBUF (__currentcontext.vbuf)
57 #define MODETYPE (__currentcontext.modetype)
58 #define MODEFLAGS (__currentcontext.modeflags)
59 #define BITSPERPIXEL (__currentcontext.bitsperpixel)
60 #define COLORS (__currentcontext.colors)
61 
62 #define __clip (__currentcontext.clip)
63 #define __clipx1 (__currentcontext.clipx1)
64 #define __clipy1 (__currentcontext.clipy1)
65 #define __clipx2 (__currentcontext.clipx2)
66 #define __clipy2 (__currentcontext.clipy2)
67 
68 #else
69 
70 #define __currentcontext currentcontext
71 
72 #endif
73