home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / x / xibm.zip / ppc / ppcArea.c < prev    next >
C/C++ Source or Header  |  1989-11-14  |  4KB  |  117 lines

  1. /*
  2.  * Copyright IBM Corporation 1987,1988,1989
  3.  *
  4.  * All Rights Reserved
  5.  *
  6.  * Permission to use, copy, modify, and distribute this software and its
  7.  * documentation for any purpose and without fee is hereby granted,
  8.  * provided that the above copyright notice appear in all copies and that 
  9.  * both that copyright notice and this permission notice appear in
  10.  * supporting documentation, and that the name of IBM not be
  11.  * used in advertising or publicity pertaining to distribution of the
  12.  * software without specific, written prior permission.
  13.  *
  14.  * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  15.  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  16.  * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  17.  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  18.  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  19.  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  20.  * SOFTWARE.
  21.  *
  22. */
  23.  
  24. /* $Header: /andrew/X11/r3src/earlyRelease/server/ddx/ibm/ppc/RCS/ppcArea.c,v 9.4 88/11/21 14:58:39 paul Exp $ */
  25. /* $Source: /andrew/X11/r3src/earlyRelease/server/ddx/ibm/ppc/RCS/ppcArea.c,v $ */
  26.  
  27. #ifndef lint
  28. static char *rcsid = "$Header: /andrew/X11/r3src/earlyRelease/server/ddx/ibm/ppc/RCS/ppcArea.c,v 9.4 88/11/21 14:58:39 paul Exp $" ;
  29. #endif
  30.  
  31. /* 
  32.  * ppc solid area fill
  33.  *
  34.  * Tom Paquin 8/87 
  35.  */
  36.  
  37. #include "X.h"
  38. #include "pixmapstr.h"
  39. #include "gcstruct.h"
  40. #include "windowstr.h"
  41. #include "miscstruct.h"
  42. #include "scrnintstr.h"
  43.  
  44. #include "ppc.h"
  45.  
  46. #include "ibmTrace.h"
  47. extern int mfbGCPrivateIndex;
  48.  
  49. void
  50. ppcAreaFill( pWin, nboxes, pBox, pGC )
  51.     register WindowPtr pWin ;
  52.     register int nboxes ;
  53.     register BoxPtr pBox ;
  54.     GCPtr    pGC ;
  55. {
  56. register void (*FillFunc)() ;
  57. register int x, y, w, h ;
  58. int alu ;
  59. unsigned long int fg, bg, pm ;
  60. int xSrc, ySrc ;
  61. PixmapPtr pPixmap ;
  62.  
  63. TRACE( ( "ppcAreaFill(0x%x,%d,0x%x,0x%x)\n", pWin, nboxes, pBox, pGC ) ) ;
  64.  
  65. if ( ( alu = ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr )->colorRrop.alu ) == GXnoop
  66.   || !nboxes )
  67.     return ;
  68.  
  69. xSrc = pGC->patOrg.x + pWin->drawable.x ;
  70. ySrc = pGC->patOrg.y + pWin->drawable.y ;
  71.  
  72. pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr )->colorRrop.planemask ;
  73. fg = ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr )->colorRrop.fgPixel ;
  74. bg = ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr )->colorRrop.bgPixel ;
  75.  
  76. nboxes++ ;
  77. switch (  ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr )->colorRrop.fillStyle ) {
  78.     case FillTiled:
  79.         FillFunc =
  80.  ( (ppcScrnPriv *) ( ( (DrawablePtr) pWin )->pScreen->devPrivate ) )->tileFill ;
  81.         for ( pPixmap = pGC->tile.pixmap ; --nboxes ; pBox++ )
  82.             if ( ( w = pBox->x2 - ( x = pBox->x1 ) )
  83.               && ( h = pBox->y2 - ( y = pBox->y1 ) ) )
  84.                 (*FillFunc)( pPixmap, alu, pm,
  85.                          x, y, w, h, xSrc, ySrc ) ;
  86.         break ;
  87.     case FillOpaqueStippled:
  88.         FillFunc =
  89. ( (ppcScrnPriv *) ( ( (DrawablePtr) pWin )->pScreen->devPrivate ) )->opstipFill;
  90.         for ( pPixmap = pGC->stipple ; --nboxes ; pBox++ )
  91.             if ( ( w = pBox->x2 - ( x = pBox->x1 ) )
  92.               && ( h = pBox->y2 - ( y = pBox->y1 ) ) )
  93.                 (*FillFunc)( pPixmap, fg, bg, alu, pm,
  94.                          x, y, w, h, xSrc, ySrc ) ;
  95.         break ;
  96.     case FillStippled:
  97.         FillFunc =
  98. ( (ppcScrnPriv *) ( ( (DrawablePtr) pWin )->pScreen->devPrivate ) )->stipFill ;
  99.         for ( pPixmap = pGC->stipple ; --nboxes ; pBox++ )
  100.             if ( ( w = pBox->x2 - ( x = pBox->x1 ) )
  101.               && ( h = pBox->y2 - ( y = pBox->y1 ) ) )
  102.                 (*FillFunc)( pPixmap, fg, alu, pm,
  103.                          x, y, w, h, xSrc, ySrc ) ;
  104.         break ;
  105.     case FillSolid:
  106.         FillFunc =
  107. ( (ppcScrnPriv *) ( ( (DrawablePtr) pWin )->pScreen->devPrivate ) )->solidFill ;
  108.         for ( ; --nboxes ; pBox++ )
  109.             if ( ( w = pBox->x2 - ( x = pBox->x1 ) )
  110.               && ( h = pBox->y2 - ( y = pBox->y1 ) ) )
  111.                 (*FillFunc)( fg, alu, pm, x, y, w, h ) ;
  112.         break ;
  113. }
  114.  
  115. return ;
  116. }
  117.