home *** CD-ROM | disk | FTP | other *** search
/ Kyūkyoku!! X68000 Emulator / X68000Book.dat / mac / OLS / X68000 / Ko-Window / kow142s.lzh / wsrv / put.c < prev    next >
C/C++ Source or Header  |  1995-02-27  |  2KB  |  76 lines

  1. #include <stdio.h>
  2. /* 1991 modified H.Ogasawara(COR.) */
  3.  
  4. #define    AUTOGPOS    1
  5.  
  6. #include "super.h"
  7. #include "clip.h"
  8. #include "screen.h"
  9.  
  10. int        Xlen, Ylen, GramH, BufH, GramTop, BufTop;
  11.  
  12.  
  13. extern    void    GramPut1( void );
  14. extern    void    GramPut2( void );
  15.  
  16. extern int        GraphicMode;
  17. #if AUTOGPOS
  18. extern int        GraphicHomeX, GraphicHomeY;
  19. #endif
  20.  
  21. void
  22. GramPut( clip, x1, y1, x2, y2, buf )
  23. ClipClass    *clip;
  24. int            x1, y1, x2, y2;
  25. char        *buf;
  26. {
  27.     int            mode;
  28.     ClipClass    c1, c2;
  29.  
  30.     /*  âRâsü[ɵé╠ö═ê═  */
  31.     c1.clip.x1= x1;
  32.     c1.clip.y1= y1;
  33.     c1.clip.x2= x2;
  34.     c1.clip.y2= y2;
  35.  
  36.     if( ClipOverlap( &c1, &c1, clip ) ){
  37.  
  38.         /*  âRâsü[î│é╠ö═ê═  */
  39.         c2.clip.x1= c1.clip.x1 - x1;
  40.         c2.clip.y1= c1.clip.y1 - y1;
  41.         c2.clip.x2= c1.clip.x2 - x1;
  42.         c2.clip.y2= c1.clip.y2 - y1;
  43.  
  44.         BufH= x2 - x1 + 1;
  45.         Xlen= c2.clip.x2 - c2.clip.x1 + 1;
  46.         Ylen= c2.clip.y2 - c2.clip.y1 + 1;
  47.  
  48.         switch( mode = GraphicMode ){
  49.             case 8:        /* WindowAttrGraphic256 */
  50.             case 12:    /* WindowAttrGraphic65536 */
  51.                 GramH= 512 * 2;
  52. #if AUTOGPOS
  53.                 c1.clip.x1-= GraphicHomeX;
  54.                 c1.clip.y1-= GraphicHomeY;
  55. #endif
  56.                 break;
  57.             case 4:        /* WindowAttrGraphic16 */
  58.                 GramH= 1024 * 2 ;
  59.                 break;
  60.             default:
  61.                 return;
  62.         }
  63.         GramTop= 0xC00000 + GramH * c1.clip.y1 + c1.clip.x1 * 2;
  64.  
  65.         InSuper();
  66.         if( mode == 12 /* WindowAttrGraphic65536 */ ){
  67.             BufTop= (int)buf + BufH * 2 * c2.clip.y1 + c2.clip.x1 * 2 ;
  68.             GramPut2();
  69.         }else{
  70.             BufTop= (int)buf + BufH * c2.clip.y1 + c2.clip.x1 ;
  71.             GramPut1();
  72.         }
  73.         OutSuper();
  74.     }
  75. }
  76.