home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / x / x11p-13.zip / RCS / do_lines.c,v < prev    next >
Text File  |  1989-12-13  |  16KB  |  854 lines

  1. head     2.9;
  2. access   ;
  3. symbols  pre-merge:2.0;
  4. locks    ; strict;
  5. comment  @ * @;
  6.  
  7.  
  8. 2.9
  9. date     89.12.13.19.07.37;  author joel;  state Exp;
  10. branches ;
  11. next     2.8;
  12.  
  13. 2.8
  14. date     89.12.07.16.34.21;  author joel;  state Exp;
  15. branches ;
  16. next     2.7;
  17.  
  18. 2.7
  19. date     89.11.20.13.25.34;  author joel;  state Exp;
  20. branches ;
  21. next     2.6;
  22.  
  23. 2.6
  24. date     89.10.23.18.11.00;  author joel;  state Exp;
  25. branches ;
  26. next     2.5;
  27.  
  28. 2.5
  29. date     89.10.02.13.40.11;  author joel;  state Exp;
  30. branches ;
  31. next     2.4;
  32.  
  33. 2.4
  34. date     89.06.23.14.13.29;  author joel;  state Exp;
  35. branches ;
  36. next     2.3;
  37.  
  38. 2.3
  39. date     89.05.11.16.44.23;  author joel;  state Exp;
  40. branches ;
  41. next     2.2;
  42.  
  43. 2.2
  44. date     89.05.03.14.17.36;  author joel;  state Exp;
  45. branches ;
  46. next     2.1;
  47.  
  48. 2.1
  49. date     89.04.19.14.28.03;  author joel;  state Exp;
  50. branches ;
  51. next     2.0;
  52.  
  53. 2.0
  54. date     89.01.31.17.03.29;  author erik;  state Exp;
  55. branches ;
  56. next     1.3;
  57.  
  58. 1.3
  59. date     89.01.31.17.03.29;  author joel;  state Exp;
  60. branches ;
  61. next     1.2;
  62.  
  63. 1.2
  64. date     88.08.01.12.37.43;  author joel;  state Exp;
  65. branches ;
  66. next     1.1;
  67.  
  68. 1.1
  69. date     88.06.10.13.34.31;  author joel;  state Exp;
  70. branches ;
  71. next     ;
  72.  
  73.  
  74. desc
  75. @@
  76.  
  77.  
  78. 2.9
  79. log
  80. @Generate same lines as ever if we have enough objects to go round the compass at least once.  However, if fewer than the complete pattern, this code spreads
  81. lines out completely around compass
  82. @
  83. text
  84. @/*****************************************************************************
  85. Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
  86.  
  87.                         All Rights Reserved
  88.  
  89. Permission to use, copy, modify, and distribute this software and its 
  90. documentation for any purpose and without fee is hereby granted, 
  91. provided that the above copyright notice appear in all copies and that
  92. both that copyright notice and this permission notice appear in 
  93. supporting documentation, and that the name of Digital not be
  94. used in advertising or publicity pertaining to distribution of the
  95. software without specific, written prior permission.  
  96.  
  97. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  98. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  99. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  100. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  101. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  102. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  103. SOFTWARE.
  104.  
  105. ******************************************************************************/
  106.  
  107. #include "x11perf.h"
  108.  
  109. static XPoint   *points;
  110. static GC       pgc;
  111.  
  112. int InitLines(xp, p, reps)
  113.     XParms  xp;
  114.     Parms   p;
  115.     int     reps;
  116. {
  117.     int size;
  118.     int half;        /* Half of width if wide line                */
  119.     int i;
  120.     int     rows;       /* Number of rows filled in current column      */
  121.     int x, y;        /* Next point                    */
  122.     int xdir, ydir;    /* Which direction x, y are going        */
  123.     int bigxdir;    
  124.     int x1, y1;        /* offsets to compute next point from current    */
  125.     int phase;        /* how far into 0..4*(size_1) we are        */
  126.     float phasef;       /* how far we are in real numbers        */
  127.     float phaseinc;     /* how much to increment phasef at each segment */
  128.     int size4;        /* 4 * size                    */
  129.  
  130.     pgc = xp->fggc;
  131.  
  132.     size = p->special;
  133.     size4 = 4 * (size+1);
  134.     half = (size + 19) / 20;
  135.  
  136.     points = (XPoint *)malloc((p->objects+1) * sizeof(XPoint));
  137.  
  138.     /* All this x, x1, x1inc, etc. stuff is to create a pattern that
  139.     (1) scans down the screen vertically
  140.  
  141.     (2) rotates the endpoints through all possible orientations
  142.  
  143.     (3) bounces off bottom and top of window as needed
  144.  
  145.     (4) moves left or right at each bounce to make things less boring
  146.     */
  147.  
  148.     x     = half;
  149.     y     = half;
  150.     xdir  = 1;
  151.     ydir  = 1;
  152.     bigxdir = 1;
  153.     phasef = 0.0;
  154.     phaseinc = ((float)size4) / ((float)p->objects);
  155.     if (phaseinc < 1.0) phaseinc = 1.0;
  156.     rows = 0;
  157.  
  158.     points[0].x = x;
  159.     points[0].y = y;
  160.  
  161.     for (i = 1; i != (p->objects+1); i++) {    
  162.     phase = phasef;
  163.     switch (phase / (size+1)) {
  164.     case 0:
  165.         x1 = size;            
  166.         y1 = phase;
  167.         break;
  168.  
  169.     case 1:
  170.         x1 = size - phase % (size+1);
  171.         y1 = size;
  172.         break;
  173.  
  174.     case 2:
  175.         x1 = phase % (size+1);
  176.         y1 = size;
  177.         break;
  178.  
  179.     case 3:
  180.         x1 = size;
  181.         y1 = size - phase % (size+1);
  182.         break;
  183.     } /* end switch */
  184.  
  185.     /* Move down or up the screen */
  186.     y += (ydir * y1);
  187.  
  188.     /* If off either top or bottom, backtrack to previous position and go
  189.        the other way instead.  Also move in bigxdir if not already. */
  190.     rows++;
  191.     if (y < half || y >= (HEIGHT-half) || rows > MAXROWS) {
  192.         rows = 0;
  193.         if (bigxdir > 0) {
  194.         if (x + size < WIDTH - half) {
  195.             xdir = 1;
  196.         } else {
  197.             bigxdir = -1;
  198.         }
  199.         } else {
  200.         if (x - size > half) {
  201.             xdir = -1;
  202.         } else {
  203.             bigxdir = 1;
  204.         }
  205.         }
  206.         ydir = -ydir;
  207.         y += (2 * ydir * y1);
  208.         /* If still off top or bottom, we can't do the line we want.
  209.            This will happen infrequently if the window is not twice the
  210.            length of the line.  So instead, let's draw a line that puts
  211.            the line after this approximately through the center of the
  212.            window.   Since it is very unlikely that both x and y will
  213.            need such adjustment, line length (in pixels) should not
  214.            change...we just can't get the slope we want for this line. */
  215.         if (y < half) {
  216.         y = (HEIGHT - y1)/2;
  217.         ydir = 1;
  218.         } else if (y > (HEIGHT - half)) {
  219.         y = (HEIGHT + y1)/2;
  220.         ydir = -1;
  221.         }
  222.     }
  223.  
  224.     /* Move x left or right by x1 */
  225.     x += (xdir * x1);
  226.     xdir = -xdir;
  227.     /* Again, if we are off the bottom then we can't really draw the line
  228.        we want.  */
  229.     if (x < half) {
  230.         x = (WIDTH - x1)/2;
  231.         xdir = 1;
  232.     } else if (x > (WIDTH - half)) {
  233.         x = (WIDTH + x1)/2;
  234.         xdir = -1;
  235.     }
  236.     points[i].x = x;
  237.     points[i].y = y;
  238.  
  239.     /* Increment phasef */
  240.     phasef += phaseinc;
  241.     if (phasef >= size4) phasef -= size4;
  242.  
  243.     }
  244.     return reps;
  245. }
  246.  
  247. int InitWideLines(xp, p, reps)
  248.     XParms  xp;
  249.     Parms   p;
  250.     int     reps;
  251. {
  252.     int size;
  253.  
  254.     (void)InitLines(xp, p, reps);
  255.  
  256.     size = p->special;
  257.     XSetLineAttributes(xp->d, xp->bggc, (int) ((size + 9) / 10),
  258.     LineSolid, CapRound, JoinRound);
  259.     XSetLineAttributes(xp->d, xp->fggc, (int) ((size + 9) / 10),
  260.     LineSolid, CapRound, JoinRound);
  261.  
  262.     return reps;
  263. }
  264.  
  265. int InitDashedLines(xp, p, reps)
  266.     XParms  xp;
  267.     Parms   p;
  268.     int     reps;
  269. {
  270.     char dashes[2];
  271.  
  272.     (void)InitLines(xp, p, reps);
  273.  
  274.     /* Modify GCs to draw dashed */
  275.     XSetLineAttributes(xp->d, xp->bggc, 0, LineOnOffDash, CapButt, JoinMiter);
  276.     XSetLineAttributes(xp->d, xp->fggc, 0, LineOnOffDash, CapButt, JoinMiter);
  277.     dashes[0] = 3;   dashes[1] = 2;
  278.     XSetDashes(xp->d, xp->fggc, 0, dashes, 2);
  279.     XSetDashes(xp->d, xp->bggc, 0, dashes, 2);
  280.     return reps;
  281. }
  282.  
  283. int InitWideDashedLines(xp, p, reps)
  284.     XParms  xp;
  285.     Parms   p;
  286.     int     reps;
  287. {
  288.     int        size;
  289.     XGCValues   gcv;
  290.     char    dashes[2];
  291.  
  292.     (void)InitWideLines(xp, p, reps);
  293.     size = p->special;
  294.     size = (size + 9) / 10;
  295.  
  296.     /* Modify GCs to draw dashed */
  297.     dashes[0] = 2*size;   dashes[1] = 2*size;
  298.     gcv.line_style = LineOnOffDash;
  299.     XChangeGC(xp->d, xp->fggc, GCLineStyle, &gcv);
  300.     XChangeGC(xp->d, xp->bggc, GCLineStyle, &gcv);
  301.     XSetDashes(xp->d, xp->fggc, 0, dashes, 2);
  302.     XSetDashes(xp->d, xp->bggc, 0, dashes, 2);
  303.     return reps;
  304. }
  305.  
  306. int InitDoubleDashedLines(xp, p, reps)
  307.     XParms  xp;
  308.     Parms   p;
  309.     int     reps;
  310. {
  311.     char dashes[2];
  312.  
  313.     (void)InitLines(xp, p, reps);
  314.  
  315.     /* Modify GCs to draw dashed */
  316.     XSetLineAttributes(xp->d, xp->bggc, 0, LineDoubleDash, CapButt, JoinMiter);
  317.     XSetLineAttributes(xp->d, xp->fggc, 0, LineDoubleDash, CapButt, JoinMiter);
  318.     dashes[0] = 3;   dashes[1] = 2;
  319.     XSetDashes(xp->d, xp->fggc, 0, dashes, 2);
  320.     XSetDashes(xp->d, xp->bggc, 0, dashes, 2);
  321.     return reps;
  322. }
  323.  
  324. int InitWideDoubleDashedLines(xp, p, reps)
  325.     XParms  xp;
  326.     Parms   p;
  327.     int     reps;
  328. {
  329.     int        size;
  330.     XGCValues   gcv;
  331.     char    dashes[2];
  332.  
  333.     (void)InitWideLines(xp, p, reps);
  334.     size = p->special;
  335.     size = (size + 9) / 10;
  336.  
  337.     /* Modify GCs to draw dashed */
  338.     dashes[0] = 2*size;   dashes[1] = 2*size;
  339.     gcv.line_style = LineDoubleDash;
  340.     XChangeGC(xp->d, xp->fggc, GCLineStyle, &gcv);
  341.     XChangeGC(xp->d, xp->bggc, GCLineStyle, &gcv);
  342.     XSetDashes(xp->d, xp->fggc, 0, dashes, 2);
  343.     XSetDashes(xp->d, xp->bggc, 0, dashes, 2);
  344.     return reps;
  345. }
  346.  
  347. void DoLines(xp, p, reps)
  348.     XParms  xp;
  349.     Parms   p;
  350.     int     reps;
  351. {
  352.     int i;
  353.  
  354.     for (i = 0; i != reps; i++)
  355.     {
  356.         XDrawLines(xp->d, xp->w, pgc, points, p->objects+1, CoordModeOrigin);
  357.         if (pgc == xp->bggc)
  358.             pgc = xp->fggc;
  359.         else
  360.             pgc = xp->bggc;
  361.     }
  362. }
  363.  
  364. void EndLines(xp, p)
  365.     XParms  xp;
  366.     Parms   p;
  367. {
  368.     free(points);
  369. }
  370.  
  371. @
  372.  
  373.  
  374. 2.8
  375. log
  376. @Changed interface to p->reps
  377. @
  378. text
  379. @d42 4
  380. a45 3
  381.     int x1inc, y1inc;   /* How to get to next x1, y1            */
  382.     int minorphase;     /* # iterations left with current x1inc, y1inc  */
  383.     int majorphase;     /* count 0..3 for which type of x1inc, y1inc    */
  384. d50 1
  385. d65 4
  386. a68 2
  387.     x     = half;  y     = half;
  388.     xdir  = 1;     ydir  = 1;
  389. d70 3
  390. a72 5
  391.     x1    = size;  y1    = 0;
  392.     x1inc = 0;     y1inc = 1;
  393.     minorphase = size;
  394.     majorphase = 0;
  395.  
  396. d79 24
  397. a102 1
  398.     /* Move on down or up the screen */
  399. d125 14
  400. a140 3
  401.     /* Update y1 by 0 or 1 */
  402.     y1 += y1inc;
  403.  
  404. d144 9
  405. a152 4
  406.  
  407.     /* Update x1 by 0 or 1 */
  408.     x1 += x1inc;
  409.  
  410. d156 4
  411. a159 12
  412.     /* Change increments if needed */
  413.     minorphase--;
  414.     if (minorphase < 0) {
  415.         minorphase = size;
  416.         majorphase = (majorphase + 1) % 4;
  417.         switch (majorphase) {
  418.         case 0: x1 = size; x1inc =  0; y1 =    0; y1inc =  1; break;
  419.         case 1: x1 = size; x1inc = -1; y1 = size; y1inc =  0; break;
  420.         case 2: x1 =    0; x1inc =  1; y1 = size; y1inc =  0; break;
  421.         case 3: x1 = size; x1inc =  0; y1 = size; y1inc = -1; break;
  422.         }
  423.     }
  424. @
  425.  
  426.  
  427. 2.7
  428. log
  429. @Declare pgc as static, so switch between fggc and bggc happens every time,
  430. not just within one iteration of tests.  (Helps make things look better on
  431. slow machines, which may only run 1 iteration.)
  432. @
  433. text
  434. @d29 1
  435. a29 1
  436. Bool InitLines(xp, p)
  437. d32 1
  438. d128 1
  439. a128 1
  440.     return True;
  441. d131 1
  442. a131 1
  443. Bool InitWideLines(xp, p)
  444. d134 1
  445. d138 1
  446. a138 1
  447.     (void)InitLines(xp, p);
  448. d146 1
  449. a146 1
  450.     return True;
  451. d149 1
  452. a149 1
  453. Bool InitDashedLines(xp, p)
  454. d152 1
  455. d156 1
  456. a156 1
  457.     (void)InitLines(xp, p);
  458. d164 1
  459. a164 1
  460.     return True;
  461. d167 1
  462. a167 1
  463. Bool InitWideDashedLines(xp, p)
  464. d170 1
  465. d176 1
  466. a176 1
  467.     (void)InitWideLines(xp, p);
  468. d187 1
  469. a187 1
  470.     return True;
  471. d190 1
  472. a190 1
  473. Bool InitDoubleDashedLines(xp, p)
  474. d193 1
  475. d197 1
  476. a197 1
  477.     (void)InitLines(xp, p);
  478. d205 1
  479. a205 1
  480.     return True;
  481. d208 1
  482. a208 1
  483. Bool InitWideDoubleDashedLines(xp, p)
  484. d211 1
  485. d217 1
  486. a217 1
  487.     (void)InitWideLines(xp, p);
  488. d228 1
  489. a228 1
  490.     return True;
  491. d231 1
  492. a231 1
  493. void DoLines(xp, p)
  494. d234 1
  495. d238 1
  496. a238 1
  497.     for (i = 0; i != p->reps; i++)
  498. @
  499.  
  500.  
  501. 2.6
  502. log
  503. @Make sure that wide lines aren't clipped.
  504. @
  505. text
  506. @d26 2
  507. a27 1
  508. static XPoint *points;
  509. d45 2
  510. a228 1
  511.     GC pgc;
  512. a230 1
  513.     pgc = xp->fggc;
  514. @
  515.  
  516.  
  517. 2.5
  518. log
  519. @Moved wide lines into here
  520. @
  521. text
  522. @d33 1
  523. d45 1
  524. d59 1
  525. a59 1
  526.     x     = 0;     y     = 0;
  527. d79 1
  528. a79 1
  529.     if (y < 0 || y >= HEIGHT || rows > MAXROWS) {
  530. d82 1
  531. a82 1
  532.         if (x + size < WIDTH) {
  533. d88 1
  534. a88 1
  535.         if (x - size > 0) {
  536. @
  537.  
  538.  
  539. 2.4
  540. log
  541. @Added double-dashed lines
  542. @
  543. text
  544. @d125 17
  545. d159 22
  546. d193 22
  547. @
  548.  
  549.  
  550. 2.3
  551. log
  552. @Parameters to all routines now (xp, p)
  553. MAXROWS used in all routines
  554. Junked most global communication variables
  555. @
  556. text
  557. @d142 17
  558. @
  559.  
  560.  
  561. 2.2
  562. log
  563. @Massive changes, I'm not going to go into details.
  564. @
  565. text
  566. @d1 23
  567. a26 2
  568. static GC bggc, fggc;
  569. static Window w;
  570. d28 2
  571. a29 2
  572. Bool InitLines(d, p)
  573.     Display *d;
  574. d32 1
  575. a32 1
  576.     int     size;
  577. d34 1
  578. d37 1
  579. d54 1
  580. d57 1
  581. a57 1
  582.     x     = (WIDTH-size)/2;     y     = 0;
  583. d59 1
  584. a61 1
  585.  
  586. d65 2
  587. d70 1
  588. a70 8
  589.     for (i = 1; i < (p->objects+1); i++) {    
  590.     /* Move x left or right by x1 */
  591.     x += (xdir * x1);
  592.     xdir = -xdir;
  593.  
  594.     /* Update x1 by 0 or 1 */
  595.     x1 += x1inc;
  596.  
  597. d75 17
  598. a91 2
  599.        the other way instead */
  600.     if (y < 0 || y >= HEIGHT) {
  601. d99 7
  602. a121 1
  603.     CreatePerfStuff(d, 1, WIDTH, HEIGHT, &w, &bggc, &fggc);
  604. d125 2
  605. a126 2
  606. Bool InitDashedLines(d, p)
  607.     Display *d;
  608. d131 1
  609. a131 1
  610.     (void)InitLines(d, p);
  611. d134 5
  612. a138 5
  613.     XSetLineAttributes(d, bggc, 0, LineOnOffDash, CapButt, JoinMiter);
  614.     XSetLineAttributes(d, fggc, 0, LineOnOffDash, CapButt, JoinMiter);
  615.     dashes[0] = 1;   dashes[1] = 3;
  616.     XSetDashes(d, fggc, 0, dashes, 2);
  617.     XSetDashes(d, bggc, 0, dashes, 2);
  618. d142 3
  619. a144 3
  620. void DoLines(d, p)
  621.     Display *d;
  622.     Parms p;
  623. d149 2
  624. a150 2
  625.     pgc = bggc;
  626.     for (i=0; i<p->reps; i++)
  627. d152 3
  628. a154 3
  629.         XDrawLines(d, w, pgc, points, p->objects+1, CoordModeOrigin);
  630.         if (pgc == bggc)
  631.             pgc = fggc;
  632. d156 1
  633. a156 1
  634.             pgc = bggc;
  635. d160 3
  636. a162 3
  637. void EndLines(d, p)
  638.     Display *d;
  639.     Parms p;
  640. a163 3
  641.     XDestroyWindow(d, w);
  642.     XFreeGC(d, bggc);
  643.     XFreeGC(d, fggc);
  644. @
  645.  
  646.  
  647. 2.1
  648. log
  649. @Changed lines not to use random numbers, but to walk up and down the
  650. screen exercising all orientations, and thrashing the TLB as much as
  651. possible.
  652. @
  653. text
  654. @d5 1
  655. a5 6
  656. static Window w[4];
  657. static XRectangle ws[3] = {
  658.     {150, 150, 90, 90},
  659.     {300, 180, 90, 90},
  660.     {450, 210, 90, 90}
  661.   };
  662. d7 1
  663. a7 1
  664. void InitSizedLines(d, p, size)
  665. d10 1
  666. a11 1
  667. {
  668. d20 2
  669. a21 3
  670.     for (i = 0; i < 4; i++)
  671.     w[i] = None;
  672.     i = 0;
  673. d81 2
  674. a82 5
  675.     CreatePerfStuff(d, 1, WIDTH, HEIGHT, w, &bggc, &fggc);
  676.     for (i = 0; i < p->special; i++)
  677.     w[i+1] = CreatePerfWindow(
  678.         d, ws[i].x, ws[i].y, ws[i].width, ws[i].height);
  679.     
  680. d85 1
  681. a85 1
  682. void InitLines1(d, p)
  683. a86 48
  684.     Parms p;
  685. {
  686.     InitSizedLines(d, p, 1);
  687. }
  688.  
  689.  
  690. void InitLines10(d, p)
  691.     Display *d;
  692.     Parms p;
  693. {
  694.     InitSizedLines(d, p, 10);
  695. }
  696.  
  697.  
  698. void InitLines100(d, p)
  699.     Display *d;
  700.     Parms p;
  701. {
  702.     InitSizedLines(d, p, 100);
  703. }
  704.  
  705.  
  706. void InitLines500(d, p)
  707.     Display *d;
  708.     Parms p;
  709. {
  710.     InitSizedLines(d, p, 500);
  711.  /*
  712.     int i;
  713.  
  714.     for (i = 0; i < 4; i++)
  715.     w[i] = None;
  716.     i = 0;
  717.     points = (XPoint *)malloc((p->objects+1) * sizeof(XPoint));
  718.     for (i = 0; i < (p->objects+1); i++)
  719.     {    
  720.         points[i].x = rand() % WIDTH;
  721.         points[i].y = rand() % HEIGHT;
  722.     }
  723.     CreatePerfStuff(d, 1, WIDTH, HEIGHT, w, &bggc, &fggc);
  724.     for (i = 0; i < p->special; i++)
  725.     w[i+1] = CreatePerfWindow(
  726.         d, ws[i].x, ws[i].y, ws[i].width, ws[i].height);
  727. */    
  728. }
  729.  
  730. void InitDashedLines100(d, p)
  731.     Display *d;
  732. a88 1
  733.     XGCValues gcv;
  734. d91 1
  735. a91 1
  736.     InitLines100(d, p);
  737. d99 1
  738. d112 1
  739. a112 1
  740.         XDrawLines(d, w[0], pgc, points, p->objects+1, CoordModeOrigin);
  741. d124 1
  742. a124 4
  743.     int i;
  744.     for (i = 0; i < 4; i++)
  745.     if (w[i] != None)
  746.         XDestroyWindow(d, w[i]);
  747. @
  748.  
  749.  
  750. 2.0
  751. log
  752. @version from /usr/src/pmax
  753. @
  754. text
  755. @d7 3
  756. a9 3
  757.     {100, 100, 200, 200},
  758.     {150, 150, 200, 200},
  759.     {200, 200, 200, 200}
  760. d18 6
  761. d29 37
  762. a65 8
  763.     points[0].x = WIDTH / 2;
  764.     points[0].y = HEIGHT / 2;
  765.     for (i = 1; i < (p->objects+1); i++)
  766.     {    
  767.     if (points[i-1].x < size || ((rand() >> 12) & 1)) {
  768.         points[i].x = points[i-1].x + size;
  769.     } else {
  770.         points[i].x = points[i-1].x - size;
  771. d67 18
  772. a84 4
  773.     if (points[i-1].y < size || ((rand() >> 12) & 1)) {
  774.         points[i].y = points[i-1].y + size;
  775.     } else {
  776.         points[i].y = points[i-1].y - size;
  777. d91 1
  778. d93 2
  779. a94 2
  780.  
  781. void InitSmallLines(d, p)
  782. d102 1
  783. a102 1
  784. void InitMedLines(d, p)
  785. d110 1
  786. a110 1
  787. void InitLines(d, p)
  788. d114 10
  789. d139 1
  790. a139 1
  791.     
  792. d142 1
  793. a142 1
  794. void InitDashedLines(d, p)
  795. d149 1
  796. a149 1
  797.     InitLines(d, p);
  798. @
  799.  
  800.  
  801. 1.3
  802. log
  803. @Added -fg -bg capabilities
  804. Added 1-pixel and 10-pixel lines, though this is pretty crude right now.
  805. @
  806. text
  807. @@
  808.  
  809.  
  810. 1.2
  811. log
  812. @Dashed lines added
  813. @
  814. text
  815. @d4 1
  816. a4 1
  817. static GC whitegc, blackgc;
  818. d12 48
  819. d75 1
  820. a75 1
  821.     CreatePerfStuff(d, 1, WIDTH, HEIGHT, w, &whitegc, &blackgc);
  822. d92 2
  823. a93 2
  824.     XSetLineAttributes(d, whitegc, 0, LineOnOffDash, CapButt, JoinMiter);
  825.     XSetLineAttributes(d, blackgc, 0, LineOnOffDash, CapButt, JoinMiter);
  826. d95 2
  827. a96 2
  828.     XSetDashes(d, blackgc, 0, dashes, 2);
  829.     XSetDashes(d, whitegc, 0, dashes, 2);
  830. d106 1
  831. a106 1
  832.     pgc = whitegc;
  833. d110 2
  834. a111 2
  835.         if (pgc == whitegc)
  836.             pgc = blackgc;
  837. d113 1
  838. a113 1
  839.             pgc = whitegc;
  840. d125 2
  841. a126 2
  842.     XFreeGC(d, whitegc);
  843.     XFreeGC(d, blackgc);
  844. @
  845.  
  846.  
  847. 1.1
  848. log
  849. @Initial revision
  850. @
  851. text
  852. @d34 17
  853. @
  854.