do_valgc.c revision 533545b5
1/*****************************************************************************
2Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
3
4                        All Rights Reserved
5
6Permission to use, copy, modify, and distribute this software and its
7documentation for any purpose and without fee is hereby granted,
8provided that the above copyright notice appear in all copies and that
9both that copyright notice and this permission notice appear in
10supporting documentation, and that the name of Digital not be
11used in advertising or publicity pertaining to distribution of the
12software without specific, written prior permission.
13
14DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
15ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
16DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
17ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
18WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
19ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
20SOFTWARE.
21
22******************************************************************************/
23
24#ifndef VMS
25#include <X11/Xatom.h>
26#else
27#include <decw$include/Xatom.h>
28#endif
29#include "x11perf.h"
30
31static Window win[2];
32
33int
34InitGC(XParms xp, Parms p, int64_t reps)
35{
36    win[0] = XCreateSimpleWindow(
37	xp->d, xp->w, 10, 10, 10, 10, 1, xp->foreground, xp->background);
38    win[1] = XCreateSimpleWindow(
39	xp->d, xp->w, 30, 30, 10, 10, 1, xp->foreground, xp->background);
40    XMapSubwindows(xp->d, xp->w);
41    return reps;
42}
43
44void
45DoChangeGC(XParms xp, Parms p, int64_t reps)
46{
47    int		i;
48    XGCValues   gcv;
49
50    for (i = 0; i != reps; i++) {
51        gcv.foreground = xp->foreground;
52        XChangeGC(xp->d, xp->fggc, GCForeground , &gcv);
53        XDrawPoint(xp->d, win[0], xp->fggc, 5, 5);
54
55        gcv.foreground = xp->background;
56        XChangeGC(xp->d, xp->fggc, GCForeground , &gcv);
57        XDrawPoint(xp->d, win[1], xp->fggc, 5, 5);
58
59        gcv.foreground = xp->background;
60        XChangeGC(xp->d, xp->fggc, GCForeground , &gcv);
61        XDrawPoint(xp->d, win[0], xp->fggc, 5, 5);
62
63        gcv.foreground = xp->foreground;
64        XChangeGC(xp->d, xp->fggc, GCForeground , &gcv);
65        XDrawPoint(xp->d, win[1], xp->fggc, 5, 5);
66	CheckAbort ();
67    }
68}
69
70void
71EndGC(XParms xp, Parms p)
72{
73    XDestroyWindow(xp->d, win[0]);
74    XDestroyWindow(xp->d, win[1]);
75}
76
77