home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / server / ddx / ibm / pgc / pgcPntWin.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-07-16  |  4.6 KB  |  187 lines

  1. /*
  2.  * $XConsortium: pgcPntWin.c,v 1.2 91/07/16 13:12:44 jap Exp $
  3.  *
  4.  * Copyright IBM Corporation 1987,1988,1989,1990,1991
  5.  *
  6.  * All Rights Reserved
  7.  *
  8.  * License to use, copy, modify, and distribute this software and its
  9.  * documentation for any purpose and without fee is hereby granted,
  10.  * provided that the above copyright notice appear in all copies and that
  11.  * both that copyright notice and this permission notice appear in
  12.  * supporting documentation, and that the name of IBM not be
  13.  * used in advertising or publicity pertaining to distribution of the
  14.  * software without specific, written prior permission.
  15.  *
  16.  * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  17.  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS, AND 
  18.  * NONINFRINGEMENT OF THIRD PARTY RIGHTS, IN NO EVENT SHALL
  19.  * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  20.  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  21.  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  22.  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  23.  * SOFTWARE.
  24.  *
  25. */
  26.  
  27. #include "X.h"
  28.  
  29. #include "windowstr.h"
  30. #include "regionstr.h"
  31. #include "pixmapstr.h"
  32. #include "scrnintstr.h"
  33.  
  34. #include "cfb.h"
  35. #include "ibmTrace.h"
  36.  
  37. #include "pgc.h"
  38.  
  39. extern pgcScreenRec pgcScreenInfo[] ; 
  40.  
  41. void pgcPaintWindowSolid();
  42. void pgcPaintWindowTile();
  43. void cfbPaintWindow();
  44.  
  45. void
  46. pgcPaintWindow(pWin, pRegion, what)
  47.     WindowPtr    pWin;
  48.     RegionPtr    pRegion;
  49.     int        what;
  50. {
  51.  
  52.     register cfbPrivWin    *pPrivWin;
  53.     pPrivWin = (cfbPrivWin *)(pWin->devPrivates[cfbWindowPrivateIndex].ptr);
  54.  
  55.     TRACE(("pgcPaintWindow( pWin= 0x%x, pRegion= 0x%x, what= %d )\n",
  56.                             pWin,pRegion,what));
  57.     
  58.     switch (what) {
  59.     case PW_BACKGROUND:
  60.     switch (pWin->backgroundState) {
  61.     case None:
  62.         return;
  63.     case ParentRelative:
  64.         do {
  65.         pWin = pWin->parent;
  66.         } while (pWin->backgroundState == ParentRelative);
  67.         (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, pRegion,
  68.                                  what);
  69.         return;
  70.     case BackgroundPixmap:
  71. #ifdef FUTURE
  72.         if (pPrivWin->fastBackground)
  73.         {
  74.         pgcPaintWindowTile(pWin, pRegion, what);
  75.         return;
  76.         }
  77. #endif
  78.         break;
  79.     case BackgroundPixel:
  80.         pgcPaintWindowSolid(pWin, pRegion, what);
  81.         return;
  82.         }
  83.         break;
  84.     case PW_BORDER:
  85.     if (pWin->borderIsPixel)
  86.     {
  87.         pgcPaintWindowSolid(pWin, pRegion, what);
  88.         return;
  89.     }
  90. #ifdef FUTURE
  91.     else if (pPrivWin->fastBorder)
  92.     {
  93.             pgcPaintWindowTile(pWin, pRegion, what);
  94.         return;
  95.     }
  96. #endif
  97.     break;
  98.     }
  99.     cfbPaintWindow(pWin, pRegion, what);
  100. }
  101.  
  102. void
  103. pgcPaintWindowSolid(pWin, pRegion, what)
  104.     register WindowPtr pWin;
  105.     register RegionPtr pRegion;
  106.     int what;        
  107. {
  108.     register int nbox;
  109.     register BoxPtr pbox;
  110.     register unsigned long int pixel;
  111.     register unsigned long int pm ;
  112.     void (*fnp)() ;
  113.     pgcScreenPtr    pPGCScreen ;
  114.     int index ;
  115.  
  116.     TRACE(("pgcPaintWindowSolid(pWin= 0x%x, pRegion= 0x%x, what= %d)\n", pWin, pRegion, what));
  117.  
  118.     if ( !( nbox = REGION_NUM_RECTS(pRegion)))
  119.     return ;
  120.     pbox = REGION_RECTS(pRegion);
  121.  
  122.     if (what == PW_BACKGROUND)
  123.     pixel = pWin->background.pixel;
  124.     else
  125.     pixel = pWin->border.pixel; 
  126.  
  127.     pm = ( 1 << pWin->drawable.depth ) - 1 ;
  128.     index = pWin->drawable.pScreen->myNum ;
  129.     pPGCScreen = &pgcScreenInfo[index] ;
  130.     fnp = pPGCScreen->solidFill ;
  131.  
  132.     for ( ; nbox-- ; pbox++ ) {
  133.     /*
  134.      * call fill routine, the parms are:
  135.      *     fill(color, alu, planes, x, y, width, height);
  136.      */
  137.     (* fnp)( pixel, GXcopy, pm, pbox->x1, pbox->y1, 
  138.     pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,index) ; 
  139.     }
  140.     return ;
  141. }
  142.  
  143.  
  144. void
  145. pgcPaintWindowTile(pWin, pRegion, what)
  146.     register WindowPtr pWin;
  147.     register RegionPtr pRegion;
  148.     int what;        
  149. {
  150.     register int nbox;
  151.     register BoxPtr pbox;
  152.     register PixmapPtr pTile;
  153.     register void (*fnp)();
  154.     register unsigned long int pm ;
  155.     pgcScreenPtr    pPGCScreen ;
  156.     int index ;
  157.  
  158.     TRACE(("pgcPaintWindowTile(pWin= 0x%x, pRegion= 0x%x, what= %d)\n", pWin, pRegion, what));
  159.  
  160.     if ( !( nbox = REGION_NUM_RECTS(pRegion)))
  161.     return ;
  162.     pbox = REGION_RECTS(pRegion);
  163.  
  164.     if (what == PW_BACKGROUND)
  165.     pTile = pWin->background.pixmap;
  166.     else
  167.     pTile = pWin->border.pixmap;
  168.  
  169.     pm = ( 1 << pWin->drawable.depth ) - 1 ;
  170.  
  171.     index = pWin->drawable.pScreen->myNum ;
  172.     pPGCScreen = &pgcScreenInfo[index] ;
  173.     fnp = pPGCScreen->tileFill ;
  174.  
  175.     for ( ; nbox-- ; pbox++ ) {
  176.     /*
  177.      * call tile routine, the parms are:
  178.      *     tile(tile, alu, planes, x, y, width, height,xSrc,ySrc);
  179.      */
  180.     (* fnp) (pTile, GXcopy, pm, 
  181.         pbox->x1, pbox->y1, 
  182.         pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,
  183.         pWin->drawable.x, pWin->drawable.y );
  184.     }
  185.     return ;
  186. }
  187.