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_dots.c,v < prev    next >
Text File  |  1989-12-07  |  5KB  |  273 lines

  1. head     2.4;
  2. access   ;
  3. symbols  pre-merge:2.0;
  4. locks    ; strict;
  5. comment  @ * @;
  6.  
  7.  
  8. 2.4
  9. date     89.12.07.16.34.10;  author joel;  state Exp;
  10. branches ;
  11. next     2.3;
  12.  
  13. 2.3
  14. date     89.11.20.13.23.49;  author joel;  state Exp;
  15. branches ;
  16. next     2.2;
  17.  
  18. 2.2
  19. date     89.05.11.16.44.18;  author joel;  state Exp;
  20. branches ;
  21. next     2.1;
  22.  
  23. 2.1
  24. date     89.05.03.14.17.33;  author joel;  state Exp;
  25. branches ;
  26. next     2.0;
  27.  
  28. 2.0
  29. date     89.01.31.17.04.53;  author erik;  state Exp;
  30. branches ;
  31. next     1.2;
  32.  
  33. 1.2
  34. date     89.01.31.17.04.53;  author joel;  state Exp;
  35. branches ;
  36. next     1.1;
  37.  
  38. 1.1
  39. date     88.06.10.13.34.26;  author joel;  state Exp;
  40. branches ;
  41. next     ;
  42.  
  43.  
  44. desc
  45. @@
  46.  
  47.  
  48. 2.4
  49. log
  50. @Changed interface to p->reps
  51. @
  52. text
  53. @/*****************************************************************************
  54. Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
  55.  
  56.                         All Rights Reserved
  57.  
  58. Permission to use, copy, modify, and distribute this software and its 
  59. documentation for any purpose and without fee is hereby granted, 
  60. provided that the above copyright notice appear in all copies and that
  61. both that copyright notice and this permission notice appear in 
  62. supporting documentation, and that the name of Digital not be
  63. used in advertising or publicity pertaining to distribution of the
  64. software without specific, written prior permission.  
  65.  
  66. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  67. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  68. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  69. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  70. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  71. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  72. SOFTWARE.
  73.  
  74. ******************************************************************************/
  75.  
  76. #include "x11perf.h"
  77.  
  78. static XPoint   *points;
  79. static GC       pgc;
  80.  
  81. int InitDots(xp, p, reps)
  82.     XParms  xp;
  83.     Parms   p;
  84.     int     reps;
  85. {
  86.     int i;
  87.  
  88.     pgc = xp->fggc;
  89.  
  90.     points = (XPoint *)malloc(p->objects * sizeof(XPoint));
  91.  
  92.     for (i = 0; i != p->objects; i++) {
  93.     points[i].x = 2 * (i/MAXROWS);
  94.     points[i].y = 2 * (i%MAXROWS);
  95.     }
  96.     return reps;
  97. }
  98.  
  99. void DoDots(xp, p, reps)
  100.     XParms  xp;
  101.     Parms   p;
  102.     int     reps;
  103. {
  104.     int     i;
  105.  
  106.     for (i = 0; i != reps; i++) {
  107.         XDrawPoints(xp->d, xp->w, pgc, points, p->objects, CoordModeOrigin);
  108.         if (pgc == xp->bggc)
  109.             pgc = xp->fggc;
  110.         else
  111.             pgc = xp->bggc;
  112.     }
  113. }
  114.  
  115. void EndDots(xp, p)
  116.     XParms  xp;
  117.     Parms   p;
  118. {
  119.     free(points);
  120. }
  121.  
  122. @
  123.  
  124.  
  125. 2.3
  126. log
  127. @Declare pgc as static, so switch between fggc and bggc happens every time,
  128. not just within one iteration of tests.  (Helps make things look better on
  129. slow machines, which may only run 1 iteration.)
  130. @
  131. text
  132. @d29 1
  133. a29 1
  134. Bool InitDots(xp, p)
  135. d32 1
  136. d44 1
  137. a44 1
  138.     return True;
  139. d47 1
  140. a47 1
  141. void DoDots(xp, p)
  142. d50 1
  143. d54 1
  144. a54 1
  145.     for (i = 0; i != p->reps; i++) {
  146. @
  147.  
  148.  
  149. 2.2
  150. log
  151. @Parameters to all routines now (xp, p)
  152. MAXROWS used in all routines
  153. Junked most global communication variables
  154. @
  155. text
  156. @d26 2
  157. a27 1
  158. static XPoint *points;
  159. d35 2
  160. a49 1
  161.     GC      pgc;
  162. a51 1
  163.     pgc = xp->fggc;
  164. @
  165.  
  166.  
  167. 2.1
  168. log
  169. @Massive changes, I'm not going to go into details.
  170. @
  171. text
  172. @d1 23
  173. a26 2
  174. static GC bggc, fggc;
  175. static Window w;
  176. d28 3
  177. a30 3
  178. Bool InitDots(d, p)
  179.     Display *d;
  180.     Parms p;
  181. d32 1
  182. a32 1
  183.     int i, x, y;
  184. a33 1
  185.     i = 0;
  186. d35 5
  187. a39 7
  188.     for (x = 0; x < COLS; x++)
  189.     for (y = 0; y < p->objects/COLS; y++) {
  190.         points[i].x = 2*x;
  191.         points[i].y = 2*y;
  192.         i++;
  193.     }
  194.     CreatePerfStuff(d, 1, WIDTH, HEIGHT, &w, &bggc, &fggc);
  195. d43 3
  196. a45 3
  197. void DoDots(d, p)
  198.     Display *d;
  199.     Parms p;
  200. d47 2
  201. a48 2
  202.     GC pgc;
  203.     int i;
  204. d50 5
  205. a54 6
  206.     pgc = bggc;
  207.     for (i=0; i < p->reps; i++)
  208.     {
  209.         XDrawPoints(d, w, pgc, points, p->objects, CoordModeOrigin);
  210.         if (pgc == bggc)
  211.             pgc = fggc;
  212. d56 1
  213. a56 1
  214.             pgc = bggc;
  215. d60 3
  216. a62 3
  217. void EndDots(d, p)
  218.     Display *d;
  219.     Parms p;
  220. a63 3
  221.     XDestroyWindow(d, w);
  222.     XFreeGC(d, bggc);
  223.     XFreeGC(d, fggc);
  224. @
  225.  
  226.  
  227. 2.0
  228. log
  229. @version from /usr/src/pmax
  230. @
  231. text
  232. @d7 1
  233. a7 1
  234. void InitDots(d, p)
  235. d22 1
  236. @
  237.  
  238.  
  239. 1.2
  240. log
  241. @Added -fg -bg capabilities
  242. @
  243. text
  244. @@
  245.  
  246.  
  247. 1.1
  248. log
  249. @Initial revision
  250. @
  251. text
  252. @d4 1
  253. a4 1
  254. static GC whitegc, blackgc;
  255. d21 1
  256. a21 1
  257.     CreatePerfStuff(d, 1, WIDTH, HEIGHT, &w, &whitegc, &blackgc);
  258. d31 1
  259. a31 1
  260.     pgc = whitegc;
  261. d35 2
  262. a36 2
  263.         if (pgc == whitegc)
  264.             pgc = blackgc;
  265. d38 1
  266. a38 1
  267.             pgc = whitegc;
  268. d47 2
  269. a48 2
  270.     XFreeGC(d, whitegc);
  271.     XFreeGC(d, blackgc);
  272. @
  273.