home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / x / xibm.zip / apa16 / apa16PolyPt.c < prev    next >
C/C++ Source or Header  |  1991-12-30  |  3KB  |  106 lines

  1. /***********************************************************
  2. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
  3. and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  4.  
  5.                         All Rights Reserved
  6.  
  7. Permission to use, copy, modify, and distribute this software and its 
  8. documentation for any purpose and without fee is hereby granted, 
  9. provided that the above copyright notice appear in all copies and that
  10. both that copyright notice and this permission notice appear in 
  11. supporting documentation, and that the names of Digital or MIT not be
  12. used in advertising or publicity pertaining to distribution of the
  13. software without specific, written prior permission.  
  14.  
  15. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  16. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  17. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  18. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  19. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  20. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  21. SOFTWARE.
  22.  
  23. ******************************************************************/
  24. /* $Header: /afs/athena.mit.edu/astaff/project/x11r5/src/athena/ibm/apa16/RCS/apa16PolyPt.c,v 5.0 1991/12/30 19:22:51 jfc Exp $ */
  25.  
  26. #include "X.h"
  27. #include "pixmapstr.h"
  28. #include "gcstruct.h"
  29. #include "windowstr.h"
  30. #include "miscstruct.h"
  31. #include "regionstr.h"
  32. #include "scrnintstr.h"
  33.  
  34. #include "apa16Hdwr.h"
  35. #include "mfb.h"
  36.  
  37. void
  38. apa16PolyPoint(pDrawable, pGC, mode, npt, pptInit)
  39.     register DrawablePtr pDrawable;
  40.     GCPtr    pGC;
  41.     int        mode;        /* Origin or Previous */
  42.     int        npt;
  43.     xPoint     *pptInit;
  44. {
  45.     register BoxPtr pbox;
  46.     register int nbox;
  47.  
  48.     int nptTmp;
  49.     register xPoint *ppt;
  50.  
  51.     register int rop;
  52.     mfbPrivGC    *pGCPriv;
  53.  
  54.     if (!(pGC->planemask & 1))
  55.     return;
  56.  
  57.     pGCPriv = (mfbPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr;
  58.     rop = pGCPriv->rop;
  59.  
  60.     if (rop == RROP_NOP)
  61.     return;
  62.  
  63.     if (pDrawable->type != DRAWABLE_WINDOW)
  64.     {
  65.     mfbPolyPoint(pDrawable, pGC, mode, npt, pptInit);
  66.     return;
  67.     }
  68.  
  69.     if ((mode == CoordModePrevious) && (npt > 1))
  70.     {
  71.     for (ppt = pptInit + 1, nptTmp = npt - 1; --nptTmp >= 0; ppt++)
  72.     {
  73.         ppt->x += (ppt-1)->x;
  74.         ppt->y += (ppt-1)->y;
  75.     }
  76.     }
  77.  
  78.     QUEUE_WAIT();
  79.  
  80.     if (rop == RROP_BLACK)
  81.       MR = (MR_DEFAULT & MERGE_MODE_MASK) | MERGE_BLACK;
  82.     else if (rop == RROP_WHITE)
  83.       MR = (MR_DEFAULT & MERGE_MODE_MASK) | MERGE_WHITE;
  84.     else /* rop == RROP_INVERT */
  85.       MR = (MR_DEFAULT & MERGE_MODE_MASK) | MERGE_INVERT;
  86.  
  87.     nbox = REGION_NUM_RECTS(pGCPriv->pCompositeClip);
  88.     pbox = REGION_RECTS(pGCPriv->pCompositeClip);
  89.     for (; --nbox >= 0; pbox++)
  90.       {
  91.     int x1 = pbox->x1, x2 = pbox->x2;
  92.     int y1 = pbox->y1, y2 = pbox->y2;
  93.     for (ppt = pptInit, nptTmp = npt; --nptTmp >= 0; ppt++)
  94.       {
  95.         register int x;
  96.         register int y;
  97.         x = ppt->x + pDrawable->x;
  98.         y = ppt->y + pDrawable->y;
  99.         if (x >= x1 && x < x2 && y >= y1 && y < y2)
  100.         *((volatile unsigned short *)APA16_BASE + (y * APA16_WIDTH / 16) + (x >> 4)) = 1 << (~x & 0xf);
  101.       }
  102.       }
  103.     apa16Qmerge_mode_old = MERGE_COPY;
  104.     MR = MR_DEFAULT;
  105. }
  106.