home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / D / SVGALIB / SVGALIB1.TAR / svgalib / gl / def.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-19  |  2.2 KB  |  71 lines

  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. #ifdef DLL_CONTEXT_SHADOW
  30.  
  31. /* Library uses internal currentcontext for faster DLL library. */
  32.  
  33. #undef BYTESPERPIXEL
  34. #undef BYTEWIDTH
  35. #undef WIDTH
  36. #undef HEIGHT
  37. #undef VBUF
  38. #undef MODETYPE
  39. #undef MODEFLAGS
  40. #undef BITSPERPIXEL
  41. #undef COLORS
  42. #undef __clip
  43. #undef __clipx1
  44. #undef __clipy1
  45. #undef __clipx2
  46. #undef __clipy2
  47.  
  48. extern GraphicsContext __currentcontext;
  49.  
  50. #define BYTESPERPIXEL (__currentcontext.bytesperpixel)
  51. #define BYTEWIDTH (__currentcontext.bytewidth)
  52. #define WIDTH (__currentcontext.width)
  53. #define HEIGHT (__currentcontext.height)
  54. #define VBUF (__currentcontext.vbuf)
  55. #define MODETYPE (__currentcontext.modetype)
  56. #define MODEFLAGS (__currentcontext.modeflags)
  57. #define BITSPERPIXEL (__currentcontext.bitsperpixel)
  58. #define COLORS (__currentcontext.colors)
  59.  
  60. #define __clip (__currentcontext.clip)
  61. #define __clipx1 (__currentcontext.clipx1)
  62. #define __clipy1 (__currentcontext.clipy1)
  63. #define __clipx2 (__currentcontext.clipx2)
  64. #define __clipy2 (__currentcontext.clipy2)
  65.  
  66. #else
  67.  
  68. #define __currentcontext currentcontext
  69.  
  70. #endif
  71.