do_valgc.c revision 533545b5
1264fa531Smrg/*****************************************************************************
2264fa531SmrgCopyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
3264fa531Smrg
4264fa531Smrg                        All Rights Reserved
5264fa531Smrg
6264fa531SmrgPermission to use, copy, modify, and distribute this software and its
7264fa531Smrgdocumentation for any purpose and without fee is hereby granted,
8264fa531Smrgprovided that the above copyright notice appear in all copies and that
9264fa531Smrgboth that copyright notice and this permission notice appear in
10264fa531Smrgsupporting documentation, and that the name of Digital not be
11264fa531Smrgused in advertising or publicity pertaining to distribution of the
12264fa531Smrgsoftware without specific, written prior permission.
13264fa531Smrg
14264fa531SmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
15264fa531SmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
16264fa531SmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
17264fa531SmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
18264fa531SmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
19264fa531SmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
20264fa531SmrgSOFTWARE.
21264fa531Smrg
22264fa531Smrg******************************************************************************/
23264fa531Smrg
24264fa531Smrg#ifndef VMS
25264fa531Smrg#include <X11/Xatom.h>
26264fa531Smrg#else
27264fa531Smrg#include <decw$include/Xatom.h>
28264fa531Smrg#endif
29264fa531Smrg#include "x11perf.h"
30264fa531Smrg
31264fa531Smrgstatic Window win[2];
32264fa531Smrg
33264fa531Smrgint
34533545b5SmrgInitGC(XParms xp, Parms p, int64_t reps)
35264fa531Smrg{
36264fa531Smrg    win[0] = XCreateSimpleWindow(
37264fa531Smrg	xp->d, xp->w, 10, 10, 10, 10, 1, xp->foreground, xp->background);
38264fa531Smrg    win[1] = XCreateSimpleWindow(
39264fa531Smrg	xp->d, xp->w, 30, 30, 10, 10, 1, xp->foreground, xp->background);
40264fa531Smrg    XMapSubwindows(xp->d, xp->w);
41264fa531Smrg    return reps;
42264fa531Smrg}
43264fa531Smrg
44264fa531Smrgvoid
45533545b5SmrgDoChangeGC(XParms xp, Parms p, int64_t reps)
46264fa531Smrg{
47264fa531Smrg    int		i;
48264fa531Smrg    XGCValues   gcv;
49264fa531Smrg
50264fa531Smrg    for (i = 0; i != reps; i++) {
51264fa531Smrg        gcv.foreground = xp->foreground;
52264fa531Smrg        XChangeGC(xp->d, xp->fggc, GCForeground , &gcv);
53264fa531Smrg        XDrawPoint(xp->d, win[0], xp->fggc, 5, 5);
54264fa531Smrg
55264fa531Smrg        gcv.foreground = xp->background;
56264fa531Smrg        XChangeGC(xp->d, xp->fggc, GCForeground , &gcv);
57264fa531Smrg        XDrawPoint(xp->d, win[1], xp->fggc, 5, 5);
58264fa531Smrg
59264fa531Smrg        gcv.foreground = xp->background;
60264fa531Smrg        XChangeGC(xp->d, xp->fggc, GCForeground , &gcv);
61264fa531Smrg        XDrawPoint(xp->d, win[0], xp->fggc, 5, 5);
62264fa531Smrg
63264fa531Smrg        gcv.foreground = xp->foreground;
64264fa531Smrg        XChangeGC(xp->d, xp->fggc, GCForeground , &gcv);
65264fa531Smrg        XDrawPoint(xp->d, win[1], xp->fggc, 5, 5);
66264fa531Smrg	CheckAbort ();
67264fa531Smrg    }
68264fa531Smrg}
69264fa531Smrg
70264fa531Smrgvoid
71264fa531SmrgEndGC(XParms xp, Parms p)
72264fa531Smrg{
73264fa531Smrg    XDestroyWindow(xp->d, win[0]);
74264fa531Smrg    XDestroyWindow(xp->d, win[1]);
75264fa531Smrg}
76264fa531Smrg
77