home *** CD-ROM | disk | FTP | other *** search
/ Computer Panoráma / computer_panorama_1997-12-hibas.iso / SHARE / GRAPH / PTC051.ZIP / SRC / CLEAR.H < prev    next >
C/C++ Source or Header  |  1997-06-21  |  965b  |  63 lines

  1. ///////////////////
  2. // memory clears //
  3. ///////////////////
  4.  
  5. #ifndef __CLEAR_H
  6. #define __CLEAR_H
  7.  
  8. #include "misc.h"
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16. inline void Clear_1BYTE(void *dest,void *data,uint pixels)
  17. {
  18.     // clear (1 byte per pixel)
  19.     memset(dest,*(char*)data,pixels);
  20. }
  21.  
  22.  
  23. inline void Clear_2BYTE(void *dest,void *data,uint pixels)
  24. {
  25.     // clear (2 bytes per pixel)
  26.     ushort color=*(ushort*)data;
  27.     ushort *p=(ushort*)dest;
  28.     ushort *pmax=p+pixels;
  29.     while (p<pmax)
  30.     {
  31.         *p=color;
  32.         p++;
  33.     }
  34. }
  35.  
  36. inline void Clear_3BYTE(void *dest,void *data,uint pixels)
  37. {
  38.     // clear (3 bytes per pixel)
  39. }                               
  40.  
  41.  
  42. inline void Clear_4BYTE(void *dest,void *data,uint pixels)
  43. {
  44.     // clear (4 bytes per pixel)
  45.     uint color=*(uint*)data;
  46.     uint *p=(uint*)dest;
  47.     uint *pmax=p+pixels;
  48.     while (p<pmax)
  49.     {
  50.         *p=color;
  51.         p++;
  52.     }
  53. }
  54.  
  55.  
  56.                 
  57.  
  58.  
  59.  
  60.  
  61.  
  62. #endif
  63.