summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--x11perf.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/x11perf.c b/x11perf.c
index c5129d7..9caf150 100644
--- a/x11perf.c
+++ b/x11perf.c
@@ -130,6 +130,8 @@ static char *foreground = NULL;
static char *background = NULL;
static char *ddbackground = NULL;
static int clips = 0;
+static Bool clipmask = False;
+static Pixmap clipmaskpix;
static int numSubWindows = 7;
static unsigned long subWindows[] = {4, 16, 25, 50, 75, 100, 200, 0};
@@ -491,6 +493,7 @@ usage(void)
" -fg the foreground color to use",
" -bg the background color to use",
" -clips <default> default number of clip windows per test",
+" -clipmask perform tests with a clipmask",
" -ddbg the background color to use for DoubleDash",
" -rop <rop0 rop1 ...> use the given rops to draw (default = GXcopy)",
" -pm <pm0 pm1 ...> use the given planemasks to draw (default = ~0)",
@@ -755,6 +758,29 @@ CreatePerfGCs(XParms xp, int func, unsigned long pm)
gcvbg.function = func;
gcvddfg.function = func;
gcvddbg.function = func;
+
+ if (clipmask) {
+ XGCValues gcv;
+ GC tempGC;
+
+ clipmaskpix = XCreatePixmap(xp->d, xp->w, WIDTH, HEIGHT, 1);
+ gcv.foreground = 0;
+ tempGC = XCreateGC(xp->d, clipmaskpix, GCForeground, &gcv);
+ XFillRectangle(xp->d, clipmaskpix, tempGC, 0,0,WIDTH,HEIGHT);
+
+ XSetForeground(xp->d, tempGC, 1);
+ XFillArc(xp->d, clipmaskpix, tempGC, 100, 100, WIDTH-200, HEIGHT-200, 0, 360*64);
+ XFillArc(xp->d, clipmaskpix, tempGC, 25, 25, 100, 100, 0, 360*64);
+ XFillArc(xp->d, clipmaskpix, tempGC, 25, HEIGHT-125, 100, 100, 0, 360*64);
+ XFillArc(xp->d, clipmaskpix, tempGC, WIDTH-125, 25, 100, 100, 0, 360*64);
+ XFillArc(xp->d, clipmaskpix, tempGC, WIDTH-125, HEIGHT-125, 100, 100, 0, 360*64);
+
+ XFreeGC(xp->d, tempGC);
+ gcvfg.clip_mask = clipmaskpix;
+ gcvbg.clip_mask = clipmaskpix;
+ gcvddfg.clip_mask = clipmaskpix;
+ gcvddbg.clip_mask = clipmaskpix;
+ }
if (func == GXxor) {
/* Make test look good visually if possible */
@@ -774,15 +800,19 @@ CreatePerfGCs(XParms xp, int func, unsigned long pm)
gcvddbg.background = fg;
}
xp->fggc = XCreateGC(xp->d, xp->w,
+ (clipmask ? GCClipMask : 0) |
GCForeground | GCBackground | GCGraphicsExposures
| GCFunction | GCPlaneMask, &gcvfg);
xp->bggc = XCreateGC(xp->d, xp->w,
+ (clipmask ? GCClipMask : 0) |
GCForeground | GCBackground | GCGraphicsExposures
| GCFunction | GCPlaneMask, &gcvbg);
xp->ddfggc = XCreateGC(xp->d, xp->w,
+ (clipmask ? GCClipMask : 0) |
GCForeground | GCBackground | GCGraphicsExposures
| GCFunction | GCPlaneMask, &gcvddfg);
xp->ddbggc = XCreateGC(xp->d, xp->w,
+ (clipmask ? GCClipMask : 0) |
GCForeground | GCBackground | GCGraphicsExposures
| GCFunction | GCPlaneMask, &gcvddbg);
}
@@ -795,6 +825,8 @@ DestroyPerfGCs(XParms xp)
XFreeGC(xp->d, xp->bggc);
XFreeGC(xp->d, xp->ddfggc);
XFreeGC(xp->d, xp->ddbggc);
+ if (clipmask)
+ XFreePixmap(xp->d, clipmaskpix);
}
static unsigned long
@@ -978,6 +1010,8 @@ main(int argc, char *argv[])
foundOne = True;
} else if (strcmp (argv[i], "-sync") == 0) {
synchronous = True;
+ } else if (strcmp (argv[i], "-clipmask") == 0) {
+ clipmask = True;
} else if (strcmp (argv[i], "-pack") == 0) {
xparms.pack = True;
} else if (strcmp (argv[i], "-draw") == 0) {