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 / apa16RArea.c < prev    next >
C/C++ Source or Header  |  1991-12-30  |  4KB  |  112 lines

  1. /***********************************************************
  2.         Copyright IBM Corporation 1988
  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. Copyright 1989 by the Massachusetts Institute of Technology
  25.  
  26.                      All rights reserved.
  27.  
  28. Permission to use, copy, modify, and distribute this software and its
  29. documentation for any purpose and without fee is hereby granted,
  30. provided that the above copyright notice appear in all copies and that
  31. both that copyright notice and this permission notice appear in
  32. supporting documentation, and that the name of the Massachusetts
  33. Institute of Technology (M.I.T.) not be used in advertising or publicity
  34. pertaining to distribution of the software without specific, written
  35. prior permission.
  36.  
  37. M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  38. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  39. M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  40. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  41. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  42. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  43. SOFTWARE.
  44.  
  45. ******************************************************************/
  46.  
  47. /* $Header: /afs/athena.mit.edu/astaff/project/x11r5/src/athena/ibm/apa16/RCS/apa16RArea.c,v 5.0 1991/12/30 19:22:51 jfc Exp $ */
  48. /* $Source: /afs/athena.mit.edu/astaff/project/x11r5/src/athena/ibm/apa16/RCS/apa16RArea.c,v $ */
  49.  
  50. #ifndef lint
  51. static char *Id = "$Header: /afs/athena.mit.edu/astaff/project/x11r5/src/athena/ibm/apa16/RCS/apa16RArea.c,v 5.0 1991/12/30 19:22:51 jfc Exp $";
  52. #endif
  53.  
  54. #include "X.h"
  55. #include "scrnintstr.h"
  56.  
  57. #include "mfb.h"
  58.  
  59. #include "OScompiler.h"
  60. #include "apa16Hdwr.h"
  61.  
  62. /* apa16 Replicate Area -- A Divide & Conquer Algorithm
  63.  * an "apa16" Helper Function For Stipples And Tiling
  64.  * P. Shupak 9/88
  65.  * J. Carr 12/91
  66.  */
  67.  
  68. void
  69. apa16replicateArea( x, y, goalWidth, goalHeight, currentHoriz, currentVert )
  70. register int x;
  71. register int y;
  72. register int goalWidth;
  73. register int goalHeight;
  74. register int currentHoriz;
  75. register int currentVert;
  76. {
  77.     register int offset;
  78.     register unsigned long int cmd;
  79.  
  80.     APA16_GET_CMD_COPY(ROP_RECT_COPY, GXcopy, cmd);
  81.     cmd |= EXEC_MASK;
  82.     /* reserve space for graphics commands:
  83.        max of 12 iterations * 2 dimensions * 7 words per command */
  84.     RESERVE_QUEUE(168);
  85.  
  86.     for (;
  87.           (offset = currentHoriz << 1 ) <= goalWidth;
  88.           currentHoriz = offset ) {
  89.         COPY_RECT_NOCHECK(cmd,  x + offset, y + currentVert,
  90.                   x + currentHoriz, y + currentVert,
  91.                   currentHoriz, currentVert);
  92.     }
  93.     if (offset = goalWidth - currentHoriz) {
  94.         COPY_RECT_NOCHECK(cmd,  x + goalWidth, y + currentVert,
  95.                   x + offset, y + currentVert,
  96.                   offset, currentVert);
  97.     }
  98.     x += goalWidth; /* All Done For x dimension */
  99.     for (;
  100.           (offset = currentVert << 1) <= goalHeight;
  101.           currentVert = offset) {
  102.         COPY_RECT_NOCHECK(cmd, x, y + offset,x, y + currentVert,
  103.                   goalWidth, currentVert);
  104.     }
  105.     if (offset = goalHeight - currentVert) {
  106.       COPY_RECT_NOCHECK(cmd, x, y + goalHeight,
  107.                 x, y + offset, goalWidth, offset);
  108.     }
  109. }
  110.  
  111.  
  112.